Skip to main content
Tools often need access to external services (databases, API clients) or runtime context (the current user, session state). Definable provides several injection mechanisms to keep tools clean and testable.

Dependency Injection

Define dependencies on the agent config and receive them in any tool:
The _dependencies parameter is injected automatically and never sent to the model. The leading underscore signals it as an internal parameter.

Available Injections

Definable recognizes these special parameter names: These parameters are:
  • Stripped from the JSON Schema (the model never sees them)
  • Injected at call time by the agent runtime
  • Optional — only include the ones you need

RunContext Access

Access the full run context for tracing, correlation, or conditional logic:

Session State

Use session state to share mutable data between tools within a single run:
Initialize default session state in the config:

Practical Example

Combining dependencies and context for a production tool:

Testing with Dependencies

Inject mock dependencies in tests: