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.0a2.tar.gz (34.2 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.0a2-py3-none-any.whl (28.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tai_daf_sdk-2.0.0a2.tar.gz
  • Upload date:
  • Size: 34.2 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.0a2.tar.gz
Algorithm Hash digest
SHA256 b88a131c1845b0e5dd1f2d355612235b1cda94434c4ed4ddb7696c2abfbe9a34
MD5 296c46f840d7fdb4b54009dac1bc024a
BLAKE2b-256 49f5c812381cdb68bc11997f22242b6be2f38811c60ed0d29bfb7f4d7d8e2ef0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tai_daf_sdk-2.0.0a2-py3-none-any.whl
  • Upload date:
  • Size: 28.2 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.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 1e3212cce81a90dead3512cf7add0059e85921c644fe5f974a7bec70aabd8269
MD5 9e5241475149b3ffce266e503c78b298
BLAKE2b-256 9723d651b9cd1a92872302a37780d7a543de29170af1777b5c1b0044474e2cdb

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