Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions src/google/adk/tools/agent_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,15 @@ class AgentTool(BaseTool):
skip_summarization: Whether to skip summarization of the agent output.
"""

def __init__(self, agent: BaseAgent, skip_summarization: bool = False):
def __init__(
self,
agent: BaseAgent,
skip_summarization: bool = False,
skip_thoughts: bool = False,
):
self.agent = agent
self.skip_summarization: bool = skip_summarization
self.skip_thoughts: bool = skip_thoughts

super().__init__(name=agent.name, description=agent.description)

Expand Down Expand Up @@ -155,7 +161,14 @@ async def run_async(

if not last_event or not last_event.content or not last_event.content.parts:
return ''
merged_text = '\n'.join(p.text for p in last_event.content.parts if p.text)
if self.skip_thoughts:
merged_text = '\n'.join(
p.text for p in last_event.content.parts if (p.text and not p.thought)
)
else:
merged_text = '\n'.join(
p.text for p in last_event.content.parts if p.text
)
if isinstance(self.agent, LlmAgent) and self.agent.output_schema:
tool_result = self.agent.output_schema.model_validate_json(
merged_text
Expand Down