Skip to content

Commit 599c088

Browse files
authored
tweak agent docs (#65)
1 parent f91c03a commit 599c088

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/agents.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ An agent **run** might represent an entire conversation — there's no limit to
9595

9696
Here's an example of a conversation comprised of multiple runs:
9797

98-
```python title="conversation_example.py"
98+
```python title="conversation_example.py" hl_lines="13"
9999
from pydantic_ai import Agent
100100

101101
agent = Agent('openai:gpt-4o')
@@ -107,12 +107,14 @@ print(result1.data)
107107

108108
# Second run, passing previous messages
109109
result2 = agent.run_sync(
110-
'What was his most famous equation?', message_history=result1.new_messages() # (1)!
110+
'What was his most famous equation?',
111+
message_history=result1.new_messages(), # (1)!
111112
)
112113
print(result2.data)
113114
#> Albert Einstein's most famous equation is (E = mc^2).
114115
```
115-
1. Continue the conversation, without `message_history` the model would not know who "he" was referring to.
116+
117+
1. Continue the conversation, without `message_history` the model would not know who "his" was referring to.
116118

117119
_(This example is complete, it can be run "as is")_
118120

@@ -158,7 +160,7 @@ print(result.data)
158160

159161
1. The agent expects a string dependency.
160162
2. Static system prompt defined at agent creation time.
161-
3. Dynamic system prompt defined via a decorator.
163+
3. Dynamic system prompt defined via a decorator with [`CallContext`][pydantic_ai.dependencies.CallContext], this is called just after `run_sync`, not when the agent is created, so can benefit from runtime information like the dependencies used on that run.
162164
4. Another dynamic system prompt, system prompts don't have to have the `CallContext` parameter.
163165

164166
_(This example is complete, it can be run "as is")_

0 commit comments

Comments
 (0)