/opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilities/builtin_or_local.py:74: UserWarning: WebSearch local fallback requires the `duckduckgo` optional group — `pip install "pydantic-ai-slim[duckduckgo]"`. Without it, WebSearch only works with models that support it natively.
  self.local = self._default_local()
/opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_deep/agent.py:659: UserWarning: Default skills directory 'skills' does not exist. No skills will be loaded.
  skills_toolset = SkillsToolset(
╭───────────────────── Traceback (most recent call last) ──────────────────────╮
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/apps/cli/main.py:242 in │
│ run                                                                          │
│                                                                              │
│   239 │                                                                      │
│   240 │   import asyncio                                                     │
│   241 │                                                                      │
│ ❱ 242 │   result = asyncio.run(                                              │
│   243 │   │   execute_headless(                                              │
│   244 │   │   │   task=task_text,                                            │
│   245 │   │   │   working_dir=working_dir or os.getcwd(),                    │
│                                                                              │
│ /usr/lib/python3.12/asyncio/runners.py:194 in run                            │
│                                                                              │
│   191 │   │   │   "asyncio.run() cannot be called from a running event loop" │
│   192 │                                                                      │
│   193 │   with Runner(debug=debug, loop_factory=loop_factory) as runner:     │
│ ❱ 194 │   │   return runner.run(main)                                        │
│   195                                                                        │
│   196                                                                        │
│   197 def _cancel_all_tasks(loop):                                           │
│                                                                              │
│ /usr/lib/python3.12/asyncio/runners.py:118 in run                            │
│                                                                              │
│   115 │   │                                                                  │
│   116 │   │   self._interrupt_count = 0                                      │
│   117 │   │   try:                                                           │
│ ❱ 118 │   │   │   return self._loop.run_until_complete(task)                 │
│   119 │   │   except exceptions.CancelledError:                              │
│   120 │   │   │   if self._interrupt_count > 0:                              │
│   121 │   │   │   │   uncancel = getattr(task, "uncancel", None)             │
│                                                                              │
│ /usr/lib/python3.12/asyncio/base_events.py:687 in run_until_complete         │
│                                                                              │
│    684 │   │   if not future.done():                                         │
│    685 │   │   │   raise RuntimeError('Event loop stopped before Future comp │
│    686 │   │                                                                 │
│ ❱  687 │   │   return future.result()                                        │
│    688 │                                                                     │
│    689 │   def stop(self):                                                   │
│    690 │   │   """Stop running the event loop.                               │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/apps/cli/run.py:124 in  │
│ execute_headless                                                             │
│                                                                              │
│   121 │   │   │   _print_error("Timed out", output_json)                     │
│   122 │   │   │   return 1                                                   │
│   123 │   else:                                                              │
│ ❱ 124 │   │   result = await agent.run(task, deps=deps, **run_kwargs)        │
│   125 │                                                                      │
│   126 │   if output_json:                                                    │
│   127 │   │   output = _build_json_output(result.output, result.usage())     │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/agent/abstr │
│ act.py:339 in run                                                            │
│                                                                              │
│    336 │   │   │   │   if _stream_step is not None:                          │
│    337 │   │   │   │   │   node = await agent_run._run_node_with_hooks(node, │
│    338 │   │   │   │   else:                                                 │
│ ❱  339 │   │   │   │   │   node = await agent_run.next(node)  # pyright: ign │
│    340 │   │                                                                 │
│    341 │   │   assert agent_run.result is not None, 'The graph run did not f │
│    342 │   │   return agent_run.result                                       │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/run.py:380  │
│ in next                                                                      │
│                                                                              │
│   377 │   │   """                                                            │
│   378 │   │   # Note: It might be nice to expose a synchronous interface for │
│   379 │   │   # on this class, or else IDEs won't warn you if you accidental │
│ ❱ 380 │   │   return await self._run_node_with_hooks(node, self._advance_gra │
│   381 │                                                                      │
│   382 │   # TODO (v2): Make this a property                                  │
│   383 │   def usage(self) -> _usage.RunUsage:                                │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/run.py:306  │
│ in _run_node_with_hooks                                                      │
│                                                                              │
│   303 │   │   run_context = _agent_graph.build_run_context(self.ctx)         │
│   304 │   │   cap = self.ctx.deps.root_capability                            │
│   305 │   │   node = await cap.before_node_run(run_context, node=node)       │
│ ❱ 306 │   │   return await self._wrap_and_advance(run_context, node, step_fn │
│   307 │                                                                      │
│   308 │   async def next(                                                    │
│   309 │   │   self,                                                          │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/run.py:276  │
│ in _wrap_and_advance                                                         │
│                                                                              │
│   273 │   │   try:                                                           │
│   274 │   │   │   result = await cap.wrap_node_run(run_context, node=node, h │
│   275 │   │   except Exception as e:                                         │
│ ❱ 276 │   │   │   result = await cap.on_node_run_error(run_context, node=nod │
│   277 │   │   │   # on_node_run_error recovered by returning a result.       │
│   278 │   │   │   # The graph runner is in ErrorMarker state; update it to m │
│   279 │   │   │   self._sync_graph_state(result)                             │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:223 in on_node_run_error                                       │
│                                                                              │
│   220 │   │   │   │   return await capability.on_node_run_error(ctx, node=no │
│   221 │   │   │   except Exception as new_error:                             │
│   222 │   │   │   │   error = new_error                                      │
│ ❱ 223 │   │   raise error                                                    │
│   224 │                                                                      │
│   225 │   # --- Event stream hook ---                                        │
│   226                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:220 in on_node_run_error                                       │
│                                                                              │
│   217 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│   218 │   │   for capability in reversed(self.capabilities):                 │
│   219 │   │   │   try:                                                       │
│ ❱ 220 │   │   │   │   return await capability.on_node_run_error(ctx, node=no │
│   221 │   │   │   except Exception as new_error:                             │
│   222 │   │   │   │   error = new_error                                      │
│   223 │   │   raise error                                                    │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:325 in on_node_run_error                                       │
│                                                                              │
│   322 │   │   [`UnexpectedModelBehavior`][pydantic_ai.exceptions.UnexpectedM │
│   323 │   │   by redirecting to a different node (e.g. retry with different  │
│   324 │   │   """                                                            │
│ ❱ 325 │   │   raise error                                                    │
│   326 │                                                                      │
│   327 │   # --- Event stream hook ---                                        │
│   328                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:220 in on_node_run_error                                       │
│                                                                              │
│   217 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│   218 │   │   for capability in reversed(self.capabilities):                 │
│   219 │   │   │   try:                                                       │
│ ❱ 220 │   │   │   │   return await capability.on_node_run_error(ctx, node=no │
│   221 │   │   │   except Exception as new_error:                             │
│   222 │   │   │   │   error = new_error                                      │
│   223 │   │   raise error                                                    │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:325 in on_node_run_error                                       │
│                                                                              │
│   322 │   │   [`UnexpectedModelBehavior`][pydantic_ai.exceptions.UnexpectedM │
│   323 │   │   by redirecting to a different node (e.g. retry with different  │
│   324 │   │   """                                                            │
│ ❱ 325 │   │   raise error                                                    │
│   326 │                                                                      │
│   327 │   # --- Event stream hook ---                                        │
│   328                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:220 in on_node_run_error                                       │
│                                                                              │
│   217 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│   218 │   │   for capability in reversed(self.capabilities):                 │
│   219 │   │   │   try:                                                       │
│ ❱ 220 │   │   │   │   return await capability.on_node_run_error(ctx, node=no │
│   221 │   │   │   except Exception as new_error:                             │
│   222 │   │   │   │   error = new_error                                      │
│   223 │   │   raise error                                                    │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:325 in on_node_run_error                                       │
│                                                                              │
│   322 │   │   [`UnexpectedModelBehavior`][pydantic_ai.exceptions.UnexpectedM │
│   323 │   │   by redirecting to a different node (e.g. retry with different  │
│   324 │   │   """                                                            │
│ ❱ 325 │   │   raise error                                                    │
│   326 │                                                                      │
│   327 │   # --- Event stream hook ---                                        │
│   328                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:220 in on_node_run_error                                       │
│                                                                              │
│   217 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│   218 │   │   for capability in reversed(self.capabilities):                 │
│   219 │   │   │   try:                                                       │
│ ❱ 220 │   │   │   │   return await capability.on_node_run_error(ctx, node=no │
│   221 │   │   │   except Exception as new_error:                             │
│   222 │   │   │   │   error = new_error                                      │
│   223 │   │   raise error                                                    │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:325 in on_node_run_error                                       │
│                                                                              │
│   322 │   │   [`UnexpectedModelBehavior`][pydantic_ai.exceptions.UnexpectedM │
│   323 │   │   by redirecting to a different node (e.g. retry with different  │
│   324 │   │   """                                                            │
│ ❱ 325 │   │   raise error                                                    │
│   326 │                                                                      │
│   327 │   # --- Event stream hook ---                                        │
│   328                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:220 in on_node_run_error                                       │
│                                                                              │
│   217 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│   218 │   │   for capability in reversed(self.capabilities):                 │
│   219 │   │   │   try:                                                       │
│ ❱ 220 │   │   │   │   return await capability.on_node_run_error(ctx, node=no │
│   221 │   │   │   except Exception as new_error:                             │
│   222 │   │   │   │   error = new_error                                      │
│   223 │   │   raise error                                                    │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:325 in on_node_run_error                                       │
│                                                                              │
│   322 │   │   [`UnexpectedModelBehavior`][pydantic_ai.exceptions.UnexpectedM │
│   323 │   │   by redirecting to a different node (e.g. retry with different  │
│   324 │   │   """                                                            │
│ ❱ 325 │   │   raise error                                                    │
│   326 │                                                                      │
│   327 │   # --- Event stream hook ---                                        │
│   328                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/run.py:274  │
│ in _wrap_and_advance                                                         │
│                                                                              │
│   271 │   │   """                                                            │
│   272 │   │   cap = self.ctx.deps.root_capability                            │
│   273 │   │   try:                                                           │
│ ❱ 274 │   │   │   result = await cap.wrap_node_run(run_context, node=node, h │
│   275 │   │   except Exception as e:                                         │
│   276 │   │   │   result = await cap.on_node_run_error(run_context, node=nod │
│   277 │   │   │   # on_node_run_error recovered by returning a result.       │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:209 in wrap_node_run                                           │
│                                                                              │
│   206 │   │   chain = handler                                                │
│   207 │   │   for cap in reversed(self.capabilities):                        │
│   208 │   │   │   chain = _make_node_run_wrap(cap, ctx, chain)               │
│ ❱ 209 │   │   return await chain(node)                                       │
│   210 │                                                                      │
│   211 │   async def on_node_run_error(                                       │
│   212 │   │   self,                                                          │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:464 in wrapped                                                 │
│                                                                              │
│   461 │   async def wrapped(                                                 │
│   462 │   │   node: _agent_graph.AgentNode[AgentDepsT, Any],                 │
│   463 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│ ❱ 464 │   │   return await cap.wrap_node_run(ctx, node=node, handler=inner)  │
│   465 │                                                                      │
│   466 │   return wrapped                                                     │
│   467                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:304 in wrap_node_run                                           │
│                                                                              │
│   301 │   │   happens before the wrapper because `run_stream()` must yield t │
│   302 │   │   while the stream context is still open, which cannot happen fr │
│   303 │   │   """                                                            │
│ ❱ 304 │   │   return await handler(node)                                     │
│   305 │                                                                      │
│   306 │   async def on_node_run_error(                                       │
│   307 │   │   self,                                                          │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:464 in wrapped                                                 │
│                                                                              │
│   461 │   async def wrapped(                                                 │
│   462 │   │   node: _agent_graph.AgentNode[AgentDepsT, Any],                 │
│   463 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│ ❱ 464 │   │   return await cap.wrap_node_run(ctx, node=node, handler=inner)  │
│   465 │                                                                      │
│   466 │   return wrapped                                                     │
│   467                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:304 in wrap_node_run                                           │
│                                                                              │
│   301 │   │   happens before the wrapper because `run_stream()` must yield t │
│   302 │   │   while the stream context is still open, which cannot happen fr │
│   303 │   │   """                                                            │
│ ❱ 304 │   │   return await handler(node)                                     │
│   305 │                                                                      │
│   306 │   async def on_node_run_error(                                       │
│   307 │   │   self,                                                          │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:464 in wrapped                                                 │
│                                                                              │
│   461 │   async def wrapped(                                                 │
│   462 │   │   node: _agent_graph.AgentNode[AgentDepsT, Any],                 │
│   463 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│ ❱ 464 │   │   return await cap.wrap_node_run(ctx, node=node, handler=inner)  │
│   465 │                                                                      │
│   466 │   return wrapped                                                     │
│   467                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:304 in wrap_node_run                                           │
│                                                                              │
│   301 │   │   happens before the wrapper because `run_stream()` must yield t │
│   302 │   │   while the stream context is still open, which cannot happen fr │
│   303 │   │   """                                                            │
│ ❱ 304 │   │   return await handler(node)                                     │
│   305 │                                                                      │
│   306 │   async def on_node_run_error(                                       │
│   307 │   │   self,                                                          │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:464 in wrapped                                                 │
│                                                                              │
│   461 │   async def wrapped(                                                 │
│   462 │   │   node: _agent_graph.AgentNode[AgentDepsT, Any],                 │
│   463 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│ ❱ 464 │   │   return await cap.wrap_node_run(ctx, node=node, handler=inner)  │
│   465 │                                                                      │
│   466 │   return wrapped                                                     │
│   467                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:304 in wrap_node_run                                           │
│                                                                              │
│   301 │   │   happens before the wrapper because `run_stream()` must yield t │
│   302 │   │   while the stream context is still open, which cannot happen fr │
│   303 │   │   """                                                            │
│ ❱ 304 │   │   return await handler(node)                                     │
│   305 │                                                                      │
│   306 │   async def on_node_run_error(                                       │
│   307 │   │   self,                                                          │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/combined.py:464 in wrapped                                                 │
│                                                                              │
│   461 │   async def wrapped(                                                 │
│   462 │   │   node: _agent_graph.AgentNode[AgentDepsT, Any],                 │
│   463 │   ) -> _agent_graph.AgentNode[AgentDepsT, Any] | End[FinalResult[Any │
│ ❱ 464 │   │   return await cap.wrap_node_run(ctx, node=node, handler=inner)  │
│   465 │                                                                      │
│   466 │   return wrapped                                                     │
│   467                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/capabilitie │
│ s/abstract.py:304 in wrap_node_run                                           │
│                                                                              │
│   301 │   │   happens before the wrapper because `run_stream()` must yield t │
│   302 │   │   while the stream context is still open, which cannot happen fr │
│   303 │   │   """                                                            │
│ ❱ 304 │   │   return await handler(node)                                     │
│   305 │                                                                      │
│   306 │   async def on_node_run_error(                                       │
│   307 │   │   self,                                                          │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/run.py:252  │
│ in _advance_graph                                                            │
│                                                                              │
│   249 │   │   """Execute a single graph step without firing capability hooks │
│   250 │   │   task = [self._node_to_task(node)]                              │
│   251 │   │   try:                                                           │
│ ❱ 252 │   │   │   task = await self._graph_run.next(task)                    │
│   253 │   │   except StopAsyncIteration:                                     │
│   254 │   │   │   pass                                                       │
│   255 │   │   return self._task_to_node(task)                                │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_graph/beta/gra │
│ ph.py:515 in next                                                            │
│                                                                              │
│    512 │   │   │   await anext(self)                                         │
│    513 │   │   if value is not None:                                         │
│    514 │   │   │   self._set_next(value)                                     │
│ ❱  515 │   │   return await anext(self)                                      │
│    516 │                                                                     │
│    517 │   def override_next(self, value: Sequence[GraphTaskRequest] | EndMa │
│    518 │   │   """Override the next pending step, allowing the graph to cont │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_graph/beta/gra │
│ ph.py:492 in __anext__                                                       │
│                                                                              │
│    489 │   │   if isinstance(self._next, ErrorMarker):                       │
│    490 │   │   │   # A node raised an error. Store it so the caller can reco │
│    491 │   │   │   # override_next() before the next __anext__ call re-raise │
│ ❱  492 │   │   │   raise self._next.error                                    │
│    493 │   │   return self._next                                             │
│    494 │                                                                     │
│    495 │   async def next(                                                   │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_graph/beta/gra │
│ ph.py:802 in _run_tracked_task                                               │
│                                                                              │
│    799 │   │   with CancelScope() as scope:                                  │
│    800 │   │   │   self.cancel_scopes[t_.task_id] = scope                    │
│    801 │   │   │   try:                                                      │
│ ❱  802 │   │   │   │   result = await self._run_task(t_)                     │
│    803 │   │   │   except BaseException as exc:                              │
│    804 │   │   │   │   # Send the error through the stream instead of lettin │
│    805 │   │   │   │   # into the task group, which would transform it (e.g. │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_graph/beta/gra │
│ ph.py:843 in _run_task                                                       │
│                                                                              │
│    840 │   │   │   │   │   stack.enter_context(logfire_span('run node {node_ │
│    841 │   │   │   │                                                         │
│    842 │   │   │   │   step_context = StepContext[StateT, DepsT, Any](state= │
│ ❱  843 │   │   │   │   output = await node.call(step_context)                │
│    844 │   │   │   if isinstance(node, NodeStep):                            │
│    845 │   │   │   │   return self._handle_node(output, fork_stack)          │
│    846 │   │   │   else:                                                     │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_graph/beta/ste │
│ p.py:253 in _call_node                                                       │
│                                                                              │
│   250 │   │   if not isinstance(node, self.node_type):                       │
│   251 │   │   │   raise ValueError(f'Node {node} is not of type {self.node_t │
│   252 │   │   node = cast(BaseNode[StateT, DepsT, Any], node)                │
│ ❱ 253 │   │   return await node.run(GraphRunContext(state=ctx.state, deps=ct │
│   254                                                                        │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/_agent_grap │
│ h.py:965 in run                                                              │
│                                                                              │
│    962 │   async def run(                                                    │
│    963 │   │   self, ctx: GraphRunContext[GraphAgentState, GraphAgentDeps[De │
│    964 │   ) -> ModelRequestNode[DepsT, NodeRunEndT] | End[result.FinalResul │
│ ❱  965 │   │   async with self.stream(ctx):                                  │
│    966 │   │   │   pass                                                      │
│    967 │   │   assert self._next_node is not None, 'the stream should set `s │
│    968 │   │   return self._next_node                                        │
│                                                                              │
│ /usr/lib/python3.12/contextlib.py:217 in __aexit__                           │
│                                                                              │
│   214 │   async def __aexit__(self, typ, value, traceback):                  │
│   215 │   │   if typ is None:                                                │
│   216 │   │   │   try:                                                       │
│ ❱ 217 │   │   │   │   await anext(self.gen)                                  │
│   218 │   │   │   except StopAsyncIteration:                                 │
│   219 │   │   │   │   return False                                           │
│   220 │   │   │   else:                                                      │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/_agent_grap │
│ h.py:979 in stream                                                           │
│                                                                              │
│    976 │   │   yield stream                                                  │
│    977 │   │                                                                 │
│    978 │   │   # Run the stream to completion if it was not finished:        │
│ ❱  979 │   │   async for _event in stream:                                   │
│    980 │   │   │   pass                                                      │
│    981 │                                                                     │
│    982 │   async def _run_stream(  # noqa: C901                              │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/_agent_grap │
│ h.py:1113 in _run_stream                                                     │
│                                                                              │
│   1110 │   │   │                                                             │
│   1111 │   │   │   self._events_iterator = _run_stream()                     │
│   1112 │   │                                                                 │
│ ❱ 1113 │   │   async for event in self._events_iterator:                     │
│   1114 │   │   │   yield event                                               │
│   1115 │                                                                     │
│   1116 │   async def _handle_tool_calls(                                     │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/_agent_grap │
│ h.py:1040 in _run_stream                                                     │
│                                                                              │
│   1037 │   │   │   │   │   │   # essentially resubmit the most recent reques │
│   1038 │   │   │   │   │   │   # as the empty response and request will not  │
│   1039 │   │   │   │   │   │   # in the hope the model will return a non-emp │
│ ❱ 1040 │   │   │   │   │   │   ctx.state.increment_retries(ctx.deps.max_resu │
│   1041 │   │   │   │   │   │   self._next_node = ModelRequestNode[DepsT, Nod │
│   1042 │   │   │   │   │   │   return                                        │
│   1043                                                                       │
│                                                                              │
│ /opt/pydantic-deep-venv/lib/python3.12/site-packages/pydantic_ai/_agent_grap │
│ h.py:113 in increment_retries                                                │
│                                                                              │
│    110 │   │   if self.retries > max_result_retries:                         │
│    111 │   │   │   self.check_incomplete_tool_call()                         │
│    112 │   │   │   message = f'Exceeded maximum retries ({max_result_retries │
│ ❱  113 │   │   │   raise exceptions.UnexpectedModelBehavior(message) from er │
│    114                                                                       │
│    115                                                                       │
│    116 @dataclasses.dataclass(kw_only=True)                                  │
╰──────────────────────────────────────────────────────────────────────────────╯
UnexpectedModelBehavior: Exceeded maximum retries (3) for output validation
