Dynamic Agents
Learn how to create agents with dynamic system prompts that update automatically using real time data.
Dynamic System Prompts
Agents support dynamic system prompts that can include live data through template functions. These functions are executed each time the agent runs, providing fresh context.
Use {module::function}
syntax to embed dynamic values:
The previous example used a built-in function (datetime). You can also create your own custom functions:
You can also pass dynamic parameters to these functions using RunContext
data that you previously set in the context.
The response will be in Catalan.
Benefits:
Real-time context
System prompts reflect current stateDynamic behavior
Agent adapts to changing conditionsAutomatic execution
Functions run on each conversationPerformance
Template resolution is fast and cached
Sync/Async
Handles both sync and async functions automatically.