aws / aws/bedrock-agentcore-sdk-python

Suppress "WARNING: Invalid HTTP request received." warning

Offen
#225 0 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
761
Forks
147
Ø Merge
1 T. 23 Std.
Gemergte PRs (30 T.)
7

Beschreibung

The following log may be recorded in the Application log output to CloudWatch Logs when the AgentCore runtime starts up.
When recorded during initialization after deployment, this is a message that does not affect the application. However, this could confuse users, so I would like to suppress it.

For example, you can confirm this log message by adding a lifespan to [strands_claude.py](https://github.com/awslabs/amazon-bedrock-agentcore-samples/blob/f50712e3474939965cff165a8cb60980b1d636d9/01-tutorials/01-AgentCore-runtime/01-hosting-agent/01-strands-with-bedrock-model/runtime_with_strands_and_bedrock_models.ipynb) as follows:

```
from contextlib import asynccontextmanager
from typing import AsyncGenerator

from strands import Agent, tool
from strands_tools import calculator # Import the calculator tool
import argparse
import json
from bedrock_agentcore.runtime import BedrockAgentCoreApp
from strands.models import BedrockModel

@asynccontextmanager
async def lifespan(_app: BedrockAgentCoreApp) -> AsyncGenerator[None, None]:
"""Completely empty lifespan context manager for testing."""
yield
app = BedrockAgentCoreApp(lifespan=lifespan)

# Create a custom tool
@tool
def weather():
""" Get weather """ # Dummy implementation
return "sunny"
(snip)
```

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginnen Sie mit dem Startpfad der Laufzeitumgebung und reproduzieren Sie die Warnung anhand des lifespan-Beispiels in 01-tutorials/01-AgentCore-runtime/01-hosting-agent/01-strands-with-bedrock-model/runtime_with_strands_and_bedrock_models.ipynb. Verfolgen Sie, wo "WARNING: Invalid HTTP request received." ausgegeben wird, und überprüfen Sie, dass die Initialisierung diese harmlose Meldung nicht mehr protokolliert, während die Anwendungsprotokolle unverändert bleiben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
45/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.