Skip to content

Commit 25e83a6

Browse files
committed
docs(ag-ui): add warning about tool order
Add a warning about the use of PydanticAI tool followed by a AG-UI as this will not work as expected.
1 parent 43445be commit 25e83a6

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

docs/ag-ui.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,12 @@ convenience method, it accepts the same arguments as the
194194
AG-UI tools are seamlessly provided to the PydanticAI agent, enabling rich
195195
use experiences with frontend user interfaces.
196196

197+
!!! warning "Requests requiring PydanticAI and AG-UI tools"
198+
Agent requests which require a PydanticAI tool use followed by an
199+
AG-UI tool will currently fail to process correctly, as the response from
200+
AG-UI will not include details about the PydanticAI tool request / response.
201+
This will be fixed in a future release
202+
197203
#### Events
198204

199205
The adapter provides the ability for PydanticAI tools to send

pydantic_ai_ag_ui/pydantic_ai_ag_ui/adapter.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,15 @@ class Adapter(Generic[AgentDepsT, OutputDataT]):
108108
an adapter for running agents with Server-Sent Event (SSE) streaming
109109
responses using the AG-UI protocol.
110110
111-
Example:
111+
# Warning
112112
113+
Agent requests which require a PydanticAI tool use followed by an AG-UI
114+
tool will currently fail to process correctly, as the response from AG-UI
115+
will not include details about the PydanticAI tool request / response.
116+
This will be fixed in a future release
117+
118+
Examples:
119+
This is an example of base usage with FastAPI.
113120
.. code-block:: python
114121
from __future__ import annotations
115122
@@ -142,8 +149,6 @@ async def root(input_data: RunAgentInput, accept: Annotated[str, Header()] = SSE
142149
PydanticAI tools which return AG-UI events will be sent to the client
143150
as part of the event stream, single events and event iterables are
144151
supported.
145-
146-
Examples:
147152
.. code-block:: python
148153
@agent.tool
149154
def update_state(ctx: RunContext[StateDeps[DocumentState]]) -> StateSnapshotEvent:

0 commit comments

Comments
 (0)