Adapter library to make Dapr Agents compatible with Open Agent Spec
Project description
dapr-agents-oas-adapter
Bidirectional conversion between Open Agent Spec (OAS) and Dapr Agents.
Overview
dapr-agents-oas-adapter enables seamless interoperability between Open Agent Spec (OAS) specifications and Dapr Agents. Import OAS specifications to create executable Dapr Agents and workflows, or export existing Dapr Agents to portable OAS format.
Key Features
- Bidirectional conversion -- Import OAS specs into Dapr Agents and export back to OAS
- Schema validation -- Validate OAS specifications before conversion with detailed error reports
- Caching -- In-memory cache with configurable TTL for repeated operations
- Async support -- Non-blocking loader for high-throughput applications
- Structured logging -- Built-in
structlogintegration for observability
Installation
pip install dapr-agents-oas-adapter
Or with uv:
uv add dapr-agents-oas-adapter
Quick Start
Load an OAS spec and create a Dapr Agent
from dapr_agents_oas_adapter import DaprAgentSpecLoader
loader = DaprAgentSpecLoader()
config = loader.load_yaml(oas_yaml)
agent = loader.create_agent(config)
Export a Dapr Agent to OAS format
from dapr_agents_oas_adapter import DaprAgentSpecExporter
exporter = DaprAgentSpecExporter()
oas_dict = exporter.to_dict(config)
Validate before conversion
from dapr_agents_oas_adapter import StrictLoader
loader = StrictLoader()
try:
config = loader.load_dict(oas_dict)
except OASSchemaValidationError as e:
print(f"Validation failed: {e.issues}")
Component Mapping
| OAS Component | Dapr Agents |
|---|---|
| Agent | AssistantAgent / ReActAgent |
| Flow | @workflow decorated function |
| LlmNode | @task with LLM call |
| ToolNode | @task with tool call |
| FlowNode | ctx.call_child_workflow() |
| MapNode | Fan-out with wf.when_all() |
| ControlFlowEdge | Branch routing via from_branch |
Running the Examples
Prerequisites
- Dapr CLI installed and initialized
- An OpenAI API key in
examples/_shared/dapr/components/secrets/
Run an example
cd examples/from_oas/04-agent-based-workflows
dapr run -f dapr.yaml -- python app.py
Examples are organized in two directions:
examples/from_oas/-- Import OAS specs to create Dapr Agentsexamples/to_oas/-- Export Dapr Agents to OAS format
Development
git clone https://github.com/heltondoria/dapr-agents-oas-adapter.git
cd dapr-agents-oas-adapter
uv sync --all-groups
uv run pytest # Run tests
uv run ruff check . # Lint
uv run ruff format --check . # Check formatting
uv run ty check # Type check
uv run codespell . # Spell check
uv run vulture . # Dead code detection
Tests require 90% coverage:
uv run pytest --cov=src/dapr_agents_oas_adapter --cov-fail-under=90
Documentation
Full documentation is available at heltondoria.github.io/dapr-agents-oas-adapter.
To serve locally:
uv run mkdocs serve
License
Apache License 2.0 -- see LICENSE for details.
Project details
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_oas_adapter-0.8.0.tar.gz.
File metadata
- Download URL: dapr_agents_oas_adapter-0.8.0.tar.gz
- Upload date:
- Size: 54.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cfc61433272587a5cf45ed5677bfc6d97a18c6e424c7a77319927a207ea9b76
|
|
| MD5 |
20014ee3348dae422e5a7b43805b4107
|
|
| BLAKE2b-256 |
176bdc121bdbd7f1bb9f1d5a3458898915b01ac0daa72427f045145755b69707
|
Provenance
The following attestation bundles were made for dapr_agents_oas_adapter-0.8.0.tar.gz:
Publisher:
publish.yml on heltondoria/dapr-agents-oas-adapter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dapr_agents_oas_adapter-0.8.0.tar.gz -
Subject digest:
6cfc61433272587a5cf45ed5677bfc6d97a18c6e424c7a77319927a207ea9b76 - Sigstore transparency entry: 970641189
- Sigstore integration time:
-
Permalink:
heltondoria/dapr-agents-oas-adapter@8957ae4d8f292bf6f6f245b9891af6befefd494e -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/heltondoria
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8957ae4d8f292bf6f6f245b9891af6befefd494e -
Trigger Event:
push
-
Statement type:
File details
Details for the file dapr_agents_oas_adapter-0.8.0-py3-none-any.whl.
File metadata
- Download URL: dapr_agents_oas_adapter-0.8.0-py3-none-any.whl
- Upload date:
- Size: 65.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1160f5dda430a51fa4d9533efc9fc73615c0e7c9bc137d961cb4575c8d79f23
|
|
| MD5 |
24c64bc1c27b53250d73b38851df9418
|
|
| BLAKE2b-256 |
b5fcfcb4f8efa317495e113fdf772b9755279124345ce7c93920265fc6a23e5d
|
Provenance
The following attestation bundles were made for dapr_agents_oas_adapter-0.8.0-py3-none-any.whl:
Publisher:
publish.yml on heltondoria/dapr-agents-oas-adapter
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dapr_agents_oas_adapter-0.8.0-py3-none-any.whl -
Subject digest:
b1160f5dda430a51fa4d9533efc9fc73615c0e7c9bc137d961cb4575c8d79f23 - Sigstore transparency entry: 970641242
- Sigstore integration time:
-
Permalink:
heltondoria/dapr-agents-oas-adapter@8957ae4d8f292bf6f6f245b9891af6befefd494e -
Branch / Tag:
refs/tags/v0.8.0 - Owner: https://github.com/heltondoria
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8957ae4d8f292bf6f6f245b9891af6befefd494e -
Trigger Event:
push
-
Statement type: