aws / aws/bedrock-agentcore-sdk-python
Suppress "WARNING: Invalid HTTP request received." warning
- Langage dominant
- Python
- Étoiles
- 764
- Forks
- 148
- Merge moyen
- 1 j 23 h
- PR mergées (30 j)
- 7
Description
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)
```
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
Commencez par le chemin de démarrage du runtime et reproduisez l’avertissement à l’aide de l’exemple de lifespan dans 01-tutorials/01-AgentCore-runtime/01-hosting-agent/01-strands-with-bedrock-model/runtime_with_strands_and_bedrock_models.ipynb. Suivez l’endroit où "WARNING: Invalid HTTP request received." est émis et vérifiez que l’initialisation n’enregistre plus ce message inoffensif, tandis que les logs de l’application restent inchangés.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Stack technique
- python
- Domaine
- backend
- Type d'issue
- Bug
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Activité
- À l'abandon
- Clarté
- Plutôt claire
- Accessibilité débutants
- 45/100