Skip to content

Commit 5d5a9aa

Browse files
author
baek54321
committed
Extend DBOS, Prefect and Temporal agent. Update docs after review.
1 parent d4ac8c7 commit 5d5a9aa

File tree

7 files changed

+90
-14
lines changed

7 files changed

+90
-14
lines changed

docs/agents.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -904,17 +904,15 @@ You should use:
904904

905905
In general, we recommend using `instructions` instead of `system_prompt` unless you have a specific reason to use `system_prompt`.
906906

907-
Instructions, like system prompts, fall into two categories:
907+
Instructions, like system prompts, can be specified at different times:
908908

909909
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.
914912

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.
916914

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:
918916

919917
```python {title="instructions.py"}
920918
from datetime import date

pydantic_ai_slim/pydantic_ai/agent/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ async def main():
530530
message_history: History of the conversation so far.
531531
deferred_tool_results: Optional results for deferred tool calls in the message history.
532532
model: Optional model to use for this run, required if `model` was not set when creating the agent.
533-
instructions: Optional instructions to append to the instructions provided at the initialization of the agent and only to be used for this run.
533+
instructions: Optional additional instructions to use for this run.
534534
deps: Optional dependencies to use for this run.
535535
model_settings: Optional settings to use for this model's request.
536536
usage_limits: Optional limits on model request count or token usage.

pydantic_ai_slim/pydantic_ai/agent/abstract.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ async def main():
204204
message_history: History of the conversation so far.
205205
deferred_tool_results: Optional results for deferred tool calls in the message history.
206206
model: Optional model to use for this run, required if `model` was not set when creating the agent.
207-
instructions: Optional instructions to append to the instructions provided at the initialization of the agent and only to be used for this run.
207+
instructions: Optional additional instructions to use for this run.
208208
deps: Optional dependencies to use for this run.
209209
model_settings: Optional settings to use for this model's request.
210210
usage_limits: Optional limits on model request count or token usage.
@@ -327,7 +327,7 @@ def run_sync(
327327
message_history: History of the conversation so far.
328328
deferred_tool_results: Optional results for deferred tool calls in the message history.
329329
model: Optional model to use for this run, required if `model` was not set when creating the agent.
330-
instructions: Optional instructions to append to the instructions provided at the initialization of the agent and only to be used for this run.
330+
instructions: Optional additional instructions to use for this run.
331331
deps: Optional dependencies to use for this run.
332332
model_settings: Optional settings to use for this model's request.
333333
usage_limits: Optional limits on model request count or token usage.
@@ -452,7 +452,7 @@ async def main():
452452
message_history: History of the conversation so far.
453453
deferred_tool_results: Optional results for deferred tool calls in the message history.
454454
model: Optional model to use for this run, required if `model` was not set when creating the agent.
455-
instructions: Optional instructions to append to the instructions provided at the initialization of the agent and only to be used for this run.
455+
instructions: Optional additional instructions to use for this run.
456456
deps: Optional dependencies to use for this run.
457457
model_settings: Optional settings to use for this model's request.
458458
usage_limits: Optional limits on model request count or token usage.
@@ -818,7 +818,7 @@ async def main():
818818
message_history: History of the conversation so far.
819819
deferred_tool_results: Optional results for deferred tool calls in the message history.
820820
model: Optional model to use for this run, required if `model` was not set when creating the agent.
821-
instructions: Optional instructions to append to the instructions provided at the initialization of the agent and only to be used for this run.
821+
instructions: Optional additional instructions to use for this run.
822822
deps: Optional dependencies to use for this run.
823823
model_settings: Optional settings to use for this model's request.
824824
usage_limits: Optional limits on model request count or token usage.
@@ -1028,7 +1028,7 @@ async def main():
10281028
message_history: History of the conversation so far.
10291029
deferred_tool_results: Optional results for deferred tool calls in the message history.
10301030
model: Optional model to use for this run, required if `model` was not set when creating the agent.
1031-
instructions: Optional instructions to append to the instructions provided at the initialization of the agent and only to be used for this run.
1031+
instructions: Optional additional instructions to use for this run.
10321032
deps: Optional dependencies to use for this run.
10331033
model_settings: Optional settings to use for this model's request.
10341034
usage_limits: Optional limits on model request count or token usage.

pydantic_ai_slim/pydantic_ai/agent/wrapper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async def main():
188188
message_history: History of the conversation so far.
189189
deferred_tool_results: Optional results for deferred tool calls in the message history.
190190
model: Optional model to use for this run, required if `model` was not set when creating the agent.
191-
instructions: Optional instructions to append to the instructions provided at the initialization of the agent and only to be used for this run.
191+
instructions: Optional additional instructions to use for this run.
192192
deps: Optional dependencies to use for this run.
193193
model_settings: Optional settings to use for this model's request.
194194
usage_limits: Optional limits on model request count or token usage.

0 commit comments

Comments
 (0)