Skip to main content

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

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

dapr_agents_ext_drasi-0.1.0.tar.gz (26.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dapr_agents_ext_drasi-0.1.0-py3-none-any.whl (24.8 kB view details)

Uploaded Python 3

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

Hashes for dapr_agents_ext_drasi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 221f58d91eb81c6a8ffb6e98bbabc58372b3caed4478510c6246adb9452f27ca
MD5 3c150481635395d6f599edbe8594c485
BLAKE2b-256 cba87281ee3419ec55e01dcc194fdb7a5ed8d41c3bcbbf15f1cf8650f09f4263

See more details on using hashes here.

File details

Details for the file dapr_agents_ext_drasi-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dapr_agents_ext_drasi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0385fa9a89ae521f6a3b54df7900dc174b15da5948cf428c4bf82c5401121987
MD5 2fce7cf88c715df3338debce1e30c06d
BLAKE2b-256 7627ff3f18a803de6683d09f5f545e664d2a61eb2d615ae493957a2552cb44bc

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page