- Agent prompts via custom Jinja2 templates
- Custom tools via
ctx.shared_state.custom_variables
Quick Start
prompts parameter.
How Variables Work
When you passvariables to DroidAgent:
- Stored in
DroidAgentState.custom_variables - Passed to prompt templates as
variablesdict - Rendered in Jinja2 templates via
{% if variables %}blocks - Available to all child agents throughout the workflow
- ✅ Agent prompts (via custom Jinja2 templates)
- ✅ Agents can read and pass to tools as arguments
- ✅ Custom tools (via
ctx.shared_state.custom_variables)
Basic Usage
Available Prompt Keys
Customize these prompts to render variables:manager_system- Manager agent system promptexecutor_system- Executor agent system promptfast_agent_system- FastAgent system promptfast_agent_user- FastAgent user promptscripter_system- Scripter agent system prompt
Accessing Variables in Custom Tools
Custom tools can access variables via thectx keyword argument (an ActionContext instance injected automatically):
Use Cases
Parameterized Workflows
Configuration Data
Key Points
- Custom prompts required - Default prompts don’t render variables in agent context
- Direct access in tools - Custom tools access
ctx.shared_state.custom_variablesvia theActionContext - Available to all agents - Manager, Executor, FastAgent, Scripter all receive variables
- Jinja2 templates - Use
{% if variables %}blocks in custom prompts - Auto-injection -
ctx(ActionContext) is injected automatically by the tool registry
Related Documentation
- Custom Prompts - How to customize agent prompts
- Custom Tools - Creating custom tool functions
- DroidAgent SDK - Complete API reference

