Skip to content

Conversation

@Kludex
Copy link
Member

@Kludex Kludex commented Mar 20, 2025

No description provided.

@github-actions
Copy link

Docs Preview

commit: 374e6b9
Preview URL: https://ab9f7f78-pydantic-ai-previews.pydantic.workers.dev

)
else:
# If the part is not dynamic, we replace it with the new system prompt.
msg.parts[i] = _messages.SystemPromptPart(self.system_prompts[0])
Copy link
Contributor

Choose a reason for hiding this comment

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

We should probably only replace the first system prompt we encounter, not all

Copy link
Contributor

Choose a reason for hiding this comment

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

probably this file should be turned into a test

@dmontagu
Copy link
Contributor

dmontagu commented Mar 20, 2025

I think we should rework this a bit to expose a hook for modifying message history, and the hook should have access to the agent state (things like its system prompts, etc.). That way we can make a change to the behavior but also make it easier for users to change it themselves if necessary.

In particular, it's reasonable to NOT want the history updated, OR to want just the first system prompt updated. But it may also be desirable to want to change it in a more interesting way. I think exposing a hook for this is the easiest way to put it in users' hands if they want to do something more sophisticated. (Asking them to override the AgentGraph is ... not a good idea.)

@Kludex Kludex closed this Apr 3, 2025
@Kludex Kludex deleted the system-prompt-updated branch April 3, 2025 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants