File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -49,9 +49,15 @@ class AgentTool(BaseTool):
49
49
skip_summarization: Whether to skip summarization of the agent output.
50
50
"""
51
51
52
- def __init__ (self , agent : BaseAgent , skip_summarization : bool = False ):
52
+ def __init__ (
53
+ self ,
54
+ agent : BaseAgent ,
55
+ skip_summarization : bool = False ,
56
+ skip_thoughts : bool = False ,
57
+ ):
53
58
self .agent = agent
54
59
self .skip_summarization : bool = skip_summarization
60
+ self .skip_thoughts : bool = skip_thoughts
55
61
56
62
super ().__init__ (name = agent .name , description = agent .description )
57
63
@@ -155,7 +161,14 @@ async def run_async(
155
161
156
162
if not last_event or not last_event .content or not last_event .content .parts :
157
163
return ''
158
- merged_text = '\n ' .join (p .text for p in last_event .content .parts if p .text )
164
+ if self .skip_thoughts :
165
+ merged_text = '\n ' .join (
166
+ p .text for p in last_event .content .parts if (p .text and not p .thought )
167
+ )
168
+ else :
169
+ merged_text = '\n ' .join (
170
+ p .text for p in last_event .content .parts if p .text
171
+ )
159
172
if isinstance (self .agent , LlmAgent ) and self .agent .output_schema :
160
173
tool_result = self .agent .output_schema .model_validate_json (
161
174
merged_text
You can’t perform that action at this time.
0 commit comments