From db9999e56f1216af67ba2fefbac70ce9f5ce7ea8 Mon Sep 17 00:00:00 2001 From: octo-patch Date: Mon, 20 Apr 2026 11:47:12 +0800 Subject: [PATCH] fix: assign comprehend_client correctly and fix on_llm_start docstring - ComprehendFilterAgent: use self.comprehend_client (not self.client) when no client is passed, so detect_sentiment/pii/toxicity methods can find it. Fixes #359 - AgentCallbacks.on_llm_start: correct docstring to match actual parameter names (name instead of agent_name, remove non-existent messages param). Fixes #360 --- python/src/agent_squad/agents/agent.py | 3 +-- python/src/agent_squad/agents/comprehend_filter_agent.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/python/src/agent_squad/agents/agent.py b/python/src/agent_squad/agents/agent.py index 59b2088e..11266f85 100644 --- a/python/src/agent_squad/agents/agent.py +++ b/python/src/agent_squad/agents/agent.py @@ -146,9 +146,8 @@ async def on_llm_start( Parameters: self: The instance of the callback handler class. - agent_name: Name of the agent that is starting. + name: Name of the llm that is starting. payload_input: Dictionary containing the agent's input. - messages: List of message dictionaries representing the conversation history. run_id: Unique identifier for this specific agent run. tags: Optional list of string tags associated with this agent run. metadata: Optional dictionary containing additional metadata about the run. diff --git a/python/src/agent_squad/agents/comprehend_filter_agent.py b/python/src/agent_squad/agents/comprehend_filter_agent.py index 9b2e2447..00af5398 100644 --- a/python/src/agent_squad/agents/comprehend_filter_agent.py +++ b/python/src/agent_squad/agents/comprehend_filter_agent.py @@ -31,12 +31,12 @@ def __init__(self, options: ComprehendFilterAgentOptions): self.comprehend_client = options.client else: if options.region: - self.client = boto3.client( + self.comprehend_client = boto3.client( 'comprehend', region_name=options.region or os.environ.get('AWS_REGION') ) else: - self.client = boto3.client('comprehend') + self.comprehend_client = boto3.client('comprehend') self.custom_checks: list[CheckFunction] = []