docs: add missing Python snippets to logging guide#512
Conversation
Fill the four `// TODO: Add python code here` placeholders in the logging cookbook with Python equivalents of the existing TypeScript snippets: the AgentSquad constructor signature, aws-lambda-powertools install command, Logger initialization, and AgentSquad creation with a custom logger. Closes 2FastLabs#439
|
@claude analyze this PR against the existing code and see if it follows the same style and implementation. More importantly is to check of the code is correct. |
|
Claude finished @cornelcroi's task in 1m 34s —— View job PR Review: Python Logging SnippetsTasks:
SummaryThe PR correctly fills in the four Python Snippet-by-Snippet Analysis1. Constructor signature ( class AgentSquad:
def __init__(self,
options: AgentSquadConfig | None = None,
storage: ChatStorage | None = None,
classifier: Classifier | None = None,
logger: Logger | None = None,
default_agent: Agent | None = None):
...✅ Matches
2. Install command ( pip install aws-lambda-powertools✅ Correct package name. Also correctly changed the code-block language from 3. Logger initialization from aws_lambda_powertools import Logger
logger = Logger(
service="MyOrchestratorService",
level="INFO"
)✅ Correct. The 4. Orchestrator creation from agent_squad.orchestrator import AgentSquad
from agent_squad.types import AgentSquadConfig
orchestrator = AgentSquad(
storage=storage,
options=AgentSquadConfig(
LOG_AGENT_CHAT=True,
LOG_CLASSIFIER_CHAT=True,
LOG_CLASSIFIER_RAW_OUTPUT=True,
LOG_CLASSIFIER_OUTPUT=True,
LOG_EXECUTION_TIMES=True,
),
logger=logger,
)✅ Import paths verified:
✅ All five ✅ Keyword argument names ( VerdictThe code is correct and safe to merge. All snippets accurately reflect the Python source, import paths are valid, and the API calls match both the internal SDK and the |
Issue Link (REQUIRED)
Fixes #439
Summary
Changes
The logging cookbook page (
docs/src/content/docs/cookbook/monitoring/logging.mdx) had four Python tabs containing// TODO: Add python code hereplaceholders. This fills all four with Python equivalents of the existing TypeScript snippets:AgentSquad.__init__constructor signature (Python's equivalent of the TS options interface)pip install aws-lambda-powertoolsfrom aws_lambda_powertools import Logger/Logger(service=..., level="INFO")AgentSquad(storage=..., options=AgentSquadConfig(...), logger=logger)Snippets were verified against the Python source: the constructor signature matches
python/src/agent_squad/orchestrator.py, theLOG_*flags matchAgentSquadConfiginpython/src/agent_squad/types/types.py, and import paths are correct.User experience
Before: every Python tab on the logging guide showed a
// TODOplaceholder with no working example. After: each tab shows a correct, copy-pasteable Python snippet mirroring the TypeScript side, restoring the repo's documented TS/Python feature parity.Checklist