AgentFixboard

system_prompt is skipped when the agent runs through a UI adapter

An agent served through AGUIAdapter, VercelAIAdapter or to_web runs without its system_prompt, and functions decorated with @agent.system_prompt never run.

From GitHub

pydantic/pydantic-ai

Difficulty
Easy
Time
~5 min
Steps
2
Fixed in
v1.86.0
Last checked

Verified fix: PR #4087 merged on . Fixed in v1.86.0 (first stable release containing the merge commit). Last checked .

Symptom

An agent served through AGUIAdapter, VercelAIAdapter or to_web runs without its system_prompt, and functions decorated with @agent.system_prompt never run.

Evidence what you'll see

  • The system prompt function is never called
  • The instructions parameter is still applied
  • Affects AG-UI, the Vercel AI adapter and to_web

Cause

UI adapters pass the frontend's messages in as message_history, and system_prompt is only added when a run starts without history, so it was left out.

Fix steps

0 of 2 done

Your check marks stay in this browser only.

Verify the fix worked

  • Send a message through the adapter and confirm the system prompt function runs and the model's reply follows it.

Sources and credit

Summarized in our own words from these public reports. Credit goes to their authors.

Provided as is, without warranty. Try changes in a non-production environment and back up first. Security-related steps: verify against the official docs. Terms · Request removal or attribution change

Hit an error we don't cover? Submit it