add_dependencies_to_context=True makes the dependencies visible in the system prompt. The agent can refer to them directly:
“Is dark mode enabled?” → reads feature_flags.dark_mode from dependencies, answers “Yes.”
Tools can also access dependencies via RunContext:
RunContext parameter is auto-injected. Tools that take it get the full request scope: dependencies, user_id, session_id, metadata, messages, even the parent agent.
Static vs per-request dependencies
The Injector example uses static dependencies (defined at agent construction). For per-request dependencies, set them on the run:What belongs in dependencies vs memory vs knowledge
| Lives in | When |
|---|---|
dependencies | Per-request runtime values: feature flags, tenant config, request scope |
| Memory | User-level facts that should survive sessions |
| Knowledge | Content the agent should be able to retrieve and cite |
session_state | Mutable state for one session only (see Taskboard) |
See it in action
agents/injector/agent.py