Commit ea22edc
feat: add Pydantic AI sync streaming converter
Introduces convert_pydantic_ai_to_agentex_events at
agentex.lib.adk.providers._modules.pydantic_ai, mirroring the existing
OpenAI Agents SDK converter in sync_provider.py. Maps Pydantic AI's
AgentStreamEvent stream (PartStartEvent / PartDeltaEvent / PartEndEvent
/ FunctionToolResultEvent) into Agentex StreamTaskMessage* events,
with first-class support for tool-call argument tokens streaming via
ToolCallPartDelta.args_delta -> ToolRequestDelta.arguments_delta.
This is slice 1 of an Agentex <-> Pydantic AI integration intended to
match the level of support we have for OpenAI Agents SDK (sync,
non-Temporal async, and Temporal). Subsequent slices will add the
example agent, tracing wiring, and CLI templates.
Adds pydantic-ai-slim>=1.0,<2 as a hard dependency, consistent with
how openai-agents and other framework integrations are pinned.
22 unit tests cover text streaming, tool-call delta streaming,
multi-step runs (where Pydantic AI part indices restart at 0 per
model response), thinking/reasoning deltas, structured one-shot args,
RetryPromptPart results, and ignored events.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 73eca7a commit ea22edc
5 files changed
Lines changed: 723 additions & 0 deletions
File tree
- src/agentex/lib/adk/providers/_modules
- tests/lib/adk/providers
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| 39 | + | |
39 | 40 | | |
40 | 41 | | |
41 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
115 | 117 | | |
116 | 118 | | |
117 | 119 | | |
118 | 120 | | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| |||
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
| 132 | + | |
129 | 133 | | |
130 | 134 | | |
131 | 135 | | |
132 | 136 | | |
133 | 137 | | |
134 | 138 | | |
| 139 | + | |
| 140 | + | |
135 | 141 | | |
136 | 142 | | |
137 | 143 | | |
| |||
196 | 202 | | |
197 | 203 | | |
198 | 204 | | |
| 205 | + | |
| 206 | + | |
199 | 207 | | |
200 | 208 | | |
201 | 209 | | |
| |||
236 | 244 | | |
237 | 245 | | |
238 | 246 | | |
| 247 | + | |
239 | 248 | | |
240 | 249 | | |
241 | 250 | | |
| |||
287 | 296 | | |
288 | 297 | | |
289 | 298 | | |
| 299 | + | |
290 | 300 | | |
291 | 301 | | |
292 | 302 | | |
293 | 303 | | |
294 | 304 | | |
295 | 305 | | |
| 306 | + | |
| 307 | + | |
296 | 308 | | |
297 | 309 | | |
298 | 310 | | |
299 | 311 | | |
| 312 | + | |
| 313 | + | |
300 | 314 | | |
301 | 315 | | |
| 316 | + | |
| 317 | + | |
302 | 318 | | |
303 | 319 | | |
304 | 320 | | |
| |||
459 | 475 | | |
460 | 476 | | |
461 | 477 | | |
| 478 | + | |
| 479 | + | |
462 | 480 | | |
463 | 481 | | |
464 | 482 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| 102 | + | |
| 103 | + | |
102 | 104 | | |
103 | 105 | | |
104 | 106 | | |
105 | 107 | | |
| 108 | + | |
106 | 109 | | |
107 | 110 | | |
108 | 111 | | |
| |||
113 | 116 | | |
114 | 117 | | |
115 | 118 | | |
| 119 | + | |
116 | 120 | | |
117 | 121 | | |
118 | 122 | | |
119 | 123 | | |
120 | 124 | | |
121 | 125 | | |
| 126 | + | |
| 127 | + | |
122 | 128 | | |
123 | 129 | | |
124 | 130 | | |
| |||
180 | 186 | | |
181 | 187 | | |
182 | 188 | | |
| 189 | + | |
| 190 | + | |
183 | 191 | | |
184 | 192 | | |
185 | 193 | | |
| |||
214 | 222 | | |
215 | 223 | | |
216 | 224 | | |
| 225 | + | |
217 | 226 | | |
218 | 227 | | |
219 | 228 | | |
| |||
260 | 269 | | |
261 | 270 | | |
262 | 271 | | |
| 272 | + | |
263 | 273 | | |
264 | 274 | | |
265 | 275 | | |
266 | 276 | | |
267 | 277 | | |
268 | 278 | | |
| 279 | + | |
| 280 | + | |
269 | 281 | | |
270 | 282 | | |
271 | 283 | | |
272 | 284 | | |
| 285 | + | |
| 286 | + | |
273 | 287 | | |
274 | 288 | | |
| 289 | + | |
| 290 | + | |
275 | 291 | | |
276 | 292 | | |
277 | 293 | | |
| |||
424 | 440 | | |
425 | 441 | | |
426 | 442 | | |
| 443 | + | |
| 444 | + | |
427 | 445 | | |
428 | 446 | | |
429 | 447 | | |
| |||
0 commit comments