dapr-agents-ext-drasi
Drasi extension for Dapr Agents, enabling resilient, scalable, and business event-driven AI agents through Drasi's change notification capabilities.
Features
- Directly trigger agents from Drasi change events via Dapr pub/sub
Getting Started
Prerequisites
This extension is installed as an optional dependency on the core dapr-agents package; see the Getting Started section in the root README for a list of prerequisites.
Installation
uv add dapr-agents[drasi]
Public API
from dapr_agents.ext.drasi import (
drasi_trigger, # Register Drasi query subscriptions for agents
DrasiChangeEvent, # Type for Drasi change events
DrasiOperation, # Operation type for Drasi change events
)
Usage
Register a Drasi query subscription on an agent before hosting:
agent = DurableAgent(...)
drasi_trigger(
agent,
query_id="<YOUR_DRASI_QUERY_ID>",
task_mapper=lambda event, ctx: TriggerAction(task="<AGENT_TASK_MESSAGE>")
)
runner = AgentRunner()
try:
runner.subscribe(agent)
await wait_for_shutdown()
finally:
runner.shutdown(agent)
Examples
- Drasi Change-Driven Agents on Kubernetes — demonstrates how to subscribe an agent to Drasi queries in a Kubernetes environment.
Development
Install extension in editable mode
From the project root:
uv venv
source .venv/bin/activate
uv sync --active --group dev --group test --extra drasi
Run extension tests
uv run --group test pytest ext/dapr-agents-ext-drasi -m "not integration" -v
Extension code quality
See the Code Quality section in the development README for code quality commands.
Regenerate Drasi models
See the provenance file for context.
./scripts/regen-drasi-models.sh
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dapr_agents_ext_drasi-0.1.0.tar.gz.
File metadata
- Download URL: dapr_agents_ext_drasi-0.1.0.tar.gz
- Upload date:
- Size: 26.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
221f58d91eb81c6a8ffb6e98bbabc58372b3caed4478510c6246adb9452f27ca
|
|
| MD5 |
3c150481635395d6f599edbe8594c485
|
|
| BLAKE2b-256 |
cba87281ee3419ec55e01dcc194fdb7a5ed8d41c3bcbbf15f1cf8650f09f4263
|
File details
Details for the file dapr_agents_ext_drasi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: dapr_agents_ext_drasi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 24.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0385fa9a89ae521f6a3b54df7900dc174b15da5948cf428c4bf82c5401121987
|
|
| MD5 |
2fce7cf88c715df3338debce1e30c06d
|
|
| BLAKE2b-256 |
7627ff3f18a803de6683d09f5f545e664d2a61eb2d615ae493957a2552cb44bc
|