-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Let additional instructions be provided at agent.run time.
#3309
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let additional instructions be provided at agent.run time.
#3309
Conversation
55ee9f9 to
37a899b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sabman Thanks for working on this! A few comments you'll want to address, and please also update the iter/run methods on TemporalAgent, DBOSAgent, and PrefectAgent to get the tests to pass.
docs/agents.md
Outdated
| 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 | ||
| single run and *permanent* dynamic instructions, which are used for all runs. | ||
| - **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 | ||
| - **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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand why you updated the docs in this particular way, but I'd prefer to keep "dynamic" to mean "depends on RunContext/deps", as it is with dynamic system prompts, dynamic toolsets, etc.
So I'd prefer to mention "Runtime instructions" as a third bullet after "Static" and "Dynamic", indicating a new type rather than subtype.
"Instructions, like system prompts, fall into two categories:" could then become something like "Instructions, like system prompts, can be specified at different times:"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done, please see my second commit: https://github.com/pydantic/pydantic-ai/pull/3309/commits
256a964 to
d599924
Compare
d599924 to
5d5a9aa
Compare
@DouweM : Thanks for the hints, I missed those classes. Just adjusted all of them. PR is ready from my side. :) |
instructions be provided at agent.run time.
Implements #3290