dependencies is a dictionary that contains a set of functions (or static variables) that are resolved before the agent runs.
You can use dependencies to inject memories, dynamic few-shot examples, “retrieved” documents, etc.
Basic usage
You can reference the dependencies in your agent instructions or user message.dependencies.py
Using functions as dependencies
You can specify a callable function as a dependency. The dependency will be automatically resolved by the agent at runtime.dependencies.py
Dependencies are automatically resolved when the agent is run.
Adding dependencies to context
Setadd_dependencies_to_context=True to add the entire list of dependencies to the user message. This way you don’t have to manually add the dependencies to the instructions.
dependencies_instructions.py
This adds the entire dependencies dictionary to the user message between
<additional context> tags.
The new user message looks like this:Access dependencies in tool calls and hooks
You can access the dependencies in tool calls and hooks by using theRunContext object.
Developer Resources
- View the Agent schema
- View Cookbook