Skip to main content
An agent’s system prompt is set through the instruction parameter, which governs the model’s behavior, tone, and how it answers.

Set instruction

The simplest form is a plain string:

Dynamic prompts

When the prompt needs to vary with runtime context, there are two options. Placeholders: use {variable_name} in the string; at runtime it is filled from the matching value in session state.
InstructionProvider: pass a function that receives the runtime context and returns the prompt string, letting you read session state to build the prompt yourself. The function can also be an async function.
ctx also exposes user_id, user_content, and session; session state is written by the session and tools during a run.

instruction vs. description

  • instruction: the system prompt that guides how the model reasons and answers.
  • description: a short summary of the agent’s capabilities, used mainly for routing and selection in multi-agent scenarios — it does not act as the system prompt.
Last modified on September 19, 2026