Closed
Description
Initial Checks
- I confirm that I'm using the latest version of Pydantic AI
- I confirm that I searched for my issue in https://github.com/pydantic/pydantic-ai/issues before opening this issue
Description
Hello team,
So I've played around with the new instructions feature and from my tests and from reading the code, it seems to me that the instruction is only applied to the first LLM call. Even within a single .run
, if there is a tool call, upon returning back from the tool call, the instruction will no longer be applied. Is this intented behavior? I think this is because instructions are extracted by looping the messages in reverse, and since there is a new request made by the tool, it no longer finds the instruction.
Example Code
Python, Pydantic AI & LLM client version
Python 3.12
Pydantic 0.1
OpenAI completions API