- Agent prompts via custom Jinja2 templates
- Custom tools via
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
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 promptcodeact_system- CodeAct agent system promptcodeact_user- CodeAct agent user promptscripter_system- Scripter agent system prompt
Accessing Variables in Custom Tools
Custom tools can directly access variables via theshared_state keyword argument:
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
shared_state.custom_variablesvia keyword argument - Available to all agents - Manager, Executor, CodeAct, Scripter all receive variables
- Jinja2 templates - Use
{% if variables %}blocks in custom prompts - Auto-injection -
toolsandshared_stateare injected automatically by Droidrun
Related Documentation
- Custom Prompts - How to customize agent prompts
- Custom Tools - Creating custom tool functions
- DroidAgent SDK - Complete API reference

