You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -171,7 +170,7 @@ validate state contained in [`RunAgentInput.state`](https://docs.ag-ui.com/sdk/j
171
170
If the `state` field's type is a Pydantic `BaseModel` subclass, the raw state dictionary on the request is automatically validated. If not, you can validate the raw value yourself in your dependencies dataclass's `__post_init__` method.
172
171
173
172
174
-
```python {title="ag_ui_state.py" py="3.10"}
173
+
```python {title="ag_ui_state.py"}
175
174
from pydantic import BaseModel
176
175
177
176
from pydantic_ai import Agent
@@ -211,7 +210,7 @@ which returns a (subclass of)
211
210
[`BaseEvent`](https://docs.ag-ui.com/sdk/python/core/events#baseevent), which allows
Copy file name to clipboardExpand all lines: docs/agents.md
+7-14Lines changed: 7 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -116,7 +116,7 @@ import asyncio
116
116
from collections.abc import AsyncIterable
117
117
from datetime import date
118
118
119
-
from pydantic_ai import Agent
119
+
from pydantic_ai import Agent, RunContext
120
120
from pydantic_ai.messages import (
121
121
AgentStreamEvent,
122
122
FinalResultEvent,
@@ -128,7 +128,6 @@ from pydantic_ai.messages import (
128
128
ThinkingPartDelta,
129
129
ToolCallPartDelta,
130
130
)
131
-
from pydantic_ai.tools import RunContext
132
131
133
132
weather_agent = Agent(
134
133
'openai:gpt-4o',
@@ -215,10 +214,10 @@ Unlike `run_stream()`, it always runs the agent graph to completion even if text
215
214
To get the best of both worlds, at the expense of some additional complexity, you can use [`agent.iter()`][pydantic_ai.agent.AbstractAgent.iter] as described in the next section, which lets you [iterate over the agent graph](#iterating-over-an-agents-graph) and [stream both events and output](#streaming-all-events-and-output) at every step.
0 commit comments