ContextProvider. The base class handles tool wrapping, name derivation, and error shaping.
Minimal Example
query_faq tool. Same shape as every built-in provider.
Required Methods
You must implement these four abstract methods:Answer
Answer is what query() returns:
Status
Status reports provider health:
Optional Methods
Override these to customize behavior:Adding Write Support
Overrideupdate(), aupdate(), and _default_tools() for writable providers:
query_notes and update_notes tools.
Async Lifecycle
For providers that need setup and teardown:Custom Instructions
Overrideinstructions() to provide source-specific guidance:
Using RunContext
Therun_context parameter carries caller state. Use it for per-user behavior:
run_context:
user_id— identifies the callersession_id— identifies the conversationmetadata— arbitrary dict passed through the call chaindependencies— values injected via agent’sdependenciesparameter
Wrapping External APIs
Pattern for wrapping a REST API:Next
Provider Catalog
Browse all built-in providers for inspiration
Runtime Guide
See providers in production context