From 02bfaf56bbd560b9ff34d652899bf4cab4a819dd Mon Sep 17 00:00:00 2001 From: guoyangzhen Date: Sat, 14 Mar 2026 16:30:03 +0800 Subject: [PATCH] docs: add Python code snippets to logging cookbook guide Replace 4 TODO placeholders in logging.mdx with equivalent Python code: - Basic OrchestratorOptions setup with custom logger - pip install command for aws-lambda-powertools - Logger import and initialization example - Full orchestrator configuration with all logging options Closes #439 --- .../docs/cookbook/monitoring/logging.mdx | 37 ++++++++++++++++--- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/docs/src/content/docs/cookbook/monitoring/logging.mdx b/docs/src/content/docs/cookbook/monitoring/logging.mdx index 4575d78e..1005593d 100644 --- a/docs/src/content/docs/cookbook/monitoring/logging.mdx +++ b/docs/src/content/docs/cookbook/monitoring/logging.mdx @@ -33,7 +33,19 @@ export interface OrchestratorOptions { ```python -// TODO: Add python code here +from agent_squad import AgentSquad +from agent_squad.types import AgentSquadConfig + +# options accepts a dict or AgentSquadConfig dataclass +# logger accepts any standard-library-compatible logger +orchestrator = AgentSquad( + options=AgentSquadConfig( + LOG_AGENT_CHAT=True, + LOG_CLASSIFIER_CHAT=True, + ), + storage=storage, + logger=my_logger, +) ``` @@ -56,8 +68,8 @@ npm install @aws-lambda-powertools/logger -```python -// TODO: Add python code here +```bash +pip install aws-lambda-powertools ``` @@ -81,7 +93,9 @@ const logger = new Logger({ ```python -// TODO: Add python code here +from aws_lambda_powertools import Logger + +logger = Logger(service="MyOrchestratorService") ``` @@ -109,7 +123,20 @@ const orchestrator = new AgentSquad({ ```python -// TODO: Add python code here +from agent_squad import AgentSquad +from agent_squad.types import AgentSquadConfig + +orchestrator = AgentSquad( + options=AgentSquadConfig( + LOG_AGENT_CHAT=True, + LOG_CLASSIFIER_CHAT=True, + LOG_CLASSIFIER_RAW_OUTPUT=True, + LOG_CLASSIFIER_OUTPUT=True, + LOG_EXECUTION_TIMES=True, + ), + storage=storage, + logger=logger, +) ```