pydantic-ai-slim 0.4.3__py3-none-any.whl → 0.4.5__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pydantic-ai-slim might be problematic. Click here for more details.

Files changed (48) hide show
  1. pydantic_ai/_a2a.py +3 -3
  2. pydantic_ai/_agent_graph.py +220 -319
  3. pydantic_ai/_cli.py +9 -7
  4. pydantic_ai/_output.py +295 -331
  5. pydantic_ai/_parts_manager.py +2 -2
  6. pydantic_ai/_run_context.py +8 -14
  7. pydantic_ai/_tool_manager.py +190 -0
  8. pydantic_ai/_utils.py +18 -1
  9. pydantic_ai/ag_ui.py +675 -0
  10. pydantic_ai/agent.py +378 -164
  11. pydantic_ai/exceptions.py +12 -0
  12. pydantic_ai/ext/aci.py +12 -3
  13. pydantic_ai/ext/langchain.py +9 -1
  14. pydantic_ai/format_prompt.py +3 -6
  15. pydantic_ai/mcp.py +147 -84
  16. pydantic_ai/messages.py +13 -5
  17. pydantic_ai/models/__init__.py +30 -18
  18. pydantic_ai/models/anthropic.py +1 -1
  19. pydantic_ai/models/function.py +50 -24
  20. pydantic_ai/models/gemini.py +1 -18
  21. pydantic_ai/models/google.py +2 -11
  22. pydantic_ai/models/groq.py +1 -0
  23. pydantic_ai/models/instrumented.py +6 -1
  24. pydantic_ai/models/mistral.py +1 -1
  25. pydantic_ai/models/openai.py +16 -4
  26. pydantic_ai/output.py +21 -7
  27. pydantic_ai/profiles/google.py +1 -1
  28. pydantic_ai/profiles/moonshotai.py +8 -0
  29. pydantic_ai/providers/grok.py +13 -1
  30. pydantic_ai/providers/groq.py +2 -0
  31. pydantic_ai/result.py +58 -45
  32. pydantic_ai/tools.py +26 -119
  33. pydantic_ai/toolsets/__init__.py +22 -0
  34. pydantic_ai/toolsets/abstract.py +155 -0
  35. pydantic_ai/toolsets/combined.py +88 -0
  36. pydantic_ai/toolsets/deferred.py +38 -0
  37. pydantic_ai/toolsets/filtered.py +24 -0
  38. pydantic_ai/toolsets/function.py +238 -0
  39. pydantic_ai/toolsets/prefixed.py +37 -0
  40. pydantic_ai/toolsets/prepared.py +36 -0
  41. pydantic_ai/toolsets/renamed.py +42 -0
  42. pydantic_ai/toolsets/wrapper.py +37 -0
  43. pydantic_ai/usage.py +14 -8
  44. {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.5.dist-info}/METADATA +10 -7
  45. {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.5.dist-info}/RECORD +48 -35
  46. {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.5.dist-info}/WHEEL +0 -0
  47. {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.5.dist-info}/entry_points.txt +0 -0
  48. {pydantic_ai_slim-0.4.3.dist-info → pydantic_ai_slim-0.4.5.dist-info}/licenses/LICENSE +0 -0
pydantic_ai/_a2a.py CHANGED
@@ -59,12 +59,12 @@ except ImportError as _import_error:
59
59
 
60
60
 
61
61
  @asynccontextmanager
62
- async def worker_lifespan(app: FastA2A, worker: Worker) -> AsyncIterator[None]:
62
+ async def worker_lifespan(app: FastA2A, worker: Worker, agent: Agent[AgentDepsT, OutputDataT]) -> AsyncIterator[None]:
63
63
  """Custom lifespan that runs the worker during application startup.
64
64
 
65
65
  This ensures the worker is started and ready to process tasks as soon as the application starts.
66
66
  """
67
- async with app.task_manager:
67
+ async with app.task_manager, agent:
68
68
  async with worker.run():
69
69
  yield
70
70
 
@@ -93,7 +93,7 @@ def agent_to_a2a(
93
93
  broker = broker or InMemoryBroker()
94
94
  worker = AgentWorker(agent=agent, broker=broker, storage=storage)
95
95
 
96
- lifespan = lifespan or partial(worker_lifespan, worker=worker)
96
+ lifespan = lifespan or partial(worker_lifespan, worker=worker, agent=agent)
97
97
 
98
98
  return FastA2A(
99
99
  storage=storage,