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
Copy file name to clipboardExpand all lines: docs/agents.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -904,17 +904,15 @@ You should use:
904
904
905
905
In general, we recommend using `instructions` instead of `system_prompt` unless you have a specific reason to use `system_prompt`.
906
906
907
-
Instructions, like system prompts, fall into two categories:
907
+
Instructions, like system prompts, can be specified at different times:
908
908
909
909
1.**Static instructions**: These are known when writing the code and can be defined via the `instructions` parameter of the [`Agent` constructor][pydantic_ai.Agent.__init__].
910
-
2.**Dynamic instructions**: These rely on context that is only available at runtime. Dynamic instructions can be further divided into *temporary* dynamic instructions which are used only for a
911
-
single run and *permanent* dynamic instructions, which are used for all runs.
912
-
-**Dynamic temporary instructions*: Should be defined via the *instructions* argument to any of the `run` methods and will be effective only for the specific run for which they have been specified
913
-
-**Dynamic permanent instructions*: Should be defined using functions decorated with [`@agent.instructions`][pydantic_ai.Agent.instructions]. Unlike dynamic system prompts, which may be reused when `message_history` is present, dynamic instructions are always reevaluated.
910
+
2.**Dynamic instructions**: These rely on context that is only available at runtime and should be defined using functions decorated with [`@agent.instructions`][pydantic_ai.Agent.instructions]. Unlike dynamic system prompts, which may be reused when `message_history` is present, dynamic instructions are always reevaluated.
911
+
3.**Runtime instructions*:: These can be used to pass additional instructions to the agent at runtime and are valid for that specific run.
914
912
915
-
Both static and dynamic instructions can be added to a single agent, and they are appended in the order they are defined at runtime.
913
+
All three types of instructions can be added to a single agent, and they are appended in the order they are defined at runtime.
916
914
917
-
Here's an example using a static instruction as well as permanent dynamic instructions:
915
+
Here's an example using a static instruction as well as dynamic instructions:
0 commit comments