Skip to main content

Python SDK for DAF (Declarative Agentic Framework) — thin MCP client

Project description

DAF SDK

Python SDK for DAF (Declarative Agentic Framework) — a platform for building, managing, and orchestrating AI agents and multi-agent teams.

SDK 2.0 (SDK-MCP-R1 + R2) is a thin MCP client with a codegen-typed surface: client.<resource>.<method>() maps to daf_<method>_<resource>, returns Pydantic models when the MCP tool has an output_schema, and stays in sync via catalog drift CI.

Features

  • Thin MCP dispatch — Any client.<resource>.<method>(**kwargs)daf_<method>_<resource> (no per-resource SDK modules)
  • Typed returns (R2) — Generated models.py / _tool_registry.py wrap tool results; unknown tools fail fast
  • IDE stubs — Generated types.py TypedDicts + client.pyi for kwargs autocomplete
  • Sync & AsyncDAF and AsyncDAF share the same public surface
  • Streamingclient.stream(tool_name, args) yields MCP notification/progress events
  • Catalog sync CI — Daily drift check opens a PR when the backend MCP catalog changes

Requirements

  • Python 3.10+
  • Running DAF backend with MCP endpoint ({base_url}/mcp)

Installation

pip install tai-daf-sdk

Or install from source:

git clone https://github.com/your-org/tai-daf-sdk.git
cd tai-daf-sdk
pip install -e ".[dev]"

Quick Start

from tai_daf_sdk import DAF
from tai_daf_sdk.models import ListAgentsResponse

with DAF(base_url="http://localhost:8012", api_key="daf_your_api_key") as client:
    # → MCP tool daf_list_agents; ListAgentsResponse when output_schema exists
    agents = client.agents.list()
    assert isinstance(agents, ListAgentsResponse)
    print(agents)

    # Stream a long-running tool (manual API — not codegen'd)
    for event in client.stream("daf_test_agent", {"name_or_id": "assistant", "sample_input": "Hi"}):
        print(event)

Async

from tai_daf_sdk import AsyncDAF

async with AsyncDAF(base_url="http://localhost:8012", api_key="daf_...") as client:
    agents = await client.agents.list()

Authentication

# Explicit API key
client = DAF(base_url="http://localhost:8012", api_key="daf_...")

# Or set DAF_API_KEY in the environment (resolved by MCP transport)

Optional advanced: set DAF_MCP_STDIO_COMMAND to use stdio MCP instead of HTTP.

Regenerating typed surface (do not hand-edit)

Generated files (tai_daf_sdk/models.py, types.py, _tool_registry.py, client.pyi) are codegen-only:

python -m tai_daf_sdk.codegen \
  --mcp-url https://tai-daf-sdk-backend-dev.azurewebsites.net/mcp \
  --api-key "$DAF_API_KEY" \
  --out tai_daf_sdk/

Offline / tests:

python -m tai_daf_sdk.codegen --catalog-json tests/fixtures/mcp_list_tools_golden.json --out tai_daf_sdk/

IDE autocomplete uses tai_daf_sdk/client.pyi + TypedDicts in tai_daf_sdk/types.py.

1.x → 2.0 note

1.x:  agents = client.agents.list()   # list[Agent]
2.0:  result = client.agents.list()   # ListAgentsResponse (or dict if no output_schema)

REST mode and hand-maintained resource modules are removed from 2.0 (see 1.x-maintenance branch). Full migration guide arrives in R3.

Development

pip install -e ".[dev]"
pytest tests -q
# Live MCP (optional):
# pytest -m mcp -v

License

MIT

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

tai_daf_sdk-2.0.0a1.tar.gz (33.8 kB view details)

Uploaded Source

Built Distribution

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

tai_daf_sdk-2.0.0a1-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file tai_daf_sdk-2.0.0a1.tar.gz.

File metadata

  • Download URL: tai_daf_sdk-2.0.0a1.tar.gz
  • Upload date:
  • Size: 33.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tai_daf_sdk-2.0.0a1.tar.gz
Algorithm Hash digest
SHA256 2243e6056dc8f5364e57d1a2884f89bca5780ee0ba1ab211b76bbad4e69a8488
MD5 c0384eb3e0b81101667bf87b8df6f1f9
BLAKE2b-256 4bcd9686ab1e8f4cccf0774cc3be459f63b6b439a106dae3211350c1cdaf62e3

See more details on using hashes here.

File details

Details for the file tai_daf_sdk-2.0.0a1-py3-none-any.whl.

File metadata

  • Download URL: tai_daf_sdk-2.0.0a1-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tai_daf_sdk-2.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 69044fbfde67236beea388296e0ab65e2616b93727610911f7aafa90ac8067f7
MD5 ae33182bfc76f5f4f27335aad4b99b00
BLAKE2b-256 f557ccfdbb98e3cc32f66ca1d1b57f5b9499a372742aea19c099986df980f14f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page