Skip to content

Conversation

@baek54321
Copy link
Contributor

@baek54321 baek54321 commented Nov 2, 2025

Implements #3290

@baek54321 baek54321 force-pushed the feature/temporary_instructions branch 2 times, most recently from 55ee9f9 to 37a899b Compare November 2, 2025 11:20
Copy link
Collaborator

@DouweM DouweM left a 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.
Copy link
Collaborator

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@baek54321 baek54321 force-pushed the feature/temporary_instructions branch 2 times, most recently from 256a964 to d599924 Compare November 4, 2025 08:17
@baek54321 baek54321 force-pushed the feature/temporary_instructions branch from d599924 to 5d5a9aa Compare November 4, 2025 08:28
@baek54321 baek54321 changed the title Add instructions argument to run methods of agent class. Feature: Add instructions argument to run methods of agent class. Nov 4, 2025
@baek54321
Copy link
Contributor Author

baek54321 commented Nov 4, 2025

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

@DouweM : Thanks for the hints, I missed those classes. Just adjusted all of them. PR is ready from my side. :)

@baek54321 baek54321 marked this pull request as ready for review November 4, 2025 08:29
@baek54321 baek54321 requested a review from DouweM November 4, 2025 08:32
@DouweM DouweM changed the title Feature: Add instructions argument to run methods of agent class. Let additional instructions be provided at agent.run time. Nov 4, 2025
@DouweM DouweM enabled auto-merge (squash) November 4, 2025 22:39
@DouweM DouweM merged commit d8c0526 into pydantic:main Nov 4, 2025
58 of 60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants