@@ -97,17 +97,6 @@ async def run_async(
97
97
98
98
if isinstance (self .agent , LlmAgent ) and self .agent .input_schema :
99
99
input_value = self .agent .input_schema .model_validate (args )
100
- else :
101
- input_value = args ['request' ]
102
-
103
- if isinstance (self .agent , LlmAgent ) and self .agent .input_schema :
104
- if isinstance (input_value , dict ):
105
- input_value = self .agent .input_schema .model_validate (input_value )
106
- if not isinstance (input_value , self .agent .input_schema ):
107
- raise ValueError (
108
- f'Input value { input_value } is not of type'
109
- f' `{ self .agent .input_schema } `.'
110
- )
111
100
content = types .Content (
112
101
role = 'user' ,
113
102
parts = [
@@ -119,7 +108,7 @@ async def run_async(
119
108
else :
120
109
content = types .Content (
121
110
role = 'user' ,
122
- parts = [types .Part .from_text (text = input_value )],
111
+ parts = [types .Part .from_text (text = args [ 'request' ] )],
123
112
)
124
113
runner = Runner (
125
114
app_name = self .agent .name ,
@@ -145,15 +134,11 @@ async def run_async(
145
134
146
135
if not last_event or not last_event .content or not last_event .content .parts :
147
136
return ''
137
+ merged_text = '\n ' .join (p .text for p in last_event .content .parts if p .text )
148
138
if isinstance (self .agent , LlmAgent ) and self .agent .output_schema :
149
- merged_text = '\n ' .join (
150
- [p .text for p in last_event .content .parts if p .text ]
151
- )
152
139
tool_result = self .agent .output_schema .model_validate_json (
153
140
merged_text
154
141
).model_dump (exclude_none = True )
155
142
else :
156
- tool_result = '\n ' .join (
157
- [p .text for p in last_event .content .parts if p .text ]
158
- )
143
+ tool_result = merged_text
159
144
return tool_result
0 commit comments