Skip to main content

Agentic Data Protocol (ADP) Python SDK

Project description

ADP Python SDK

Python SDK for the Agentic Data Protocol (ADP) — a deterministic, policy-aware protocol that allows AI agents to access heterogeneous data systems safely and reproducibly via a unified intent interface.

This SDK provides a client-side API for connecting to any ADP-compliant server (such as adp-hypervisor) over stdio transport.

Installation

# Using uv (recommended)
uv add adp-sdk

# Using pip
pip install adp-sdk

Quick Start

import asyncio
from adp_sdk import stdio_client, basic_auth, QueryIntent, PredicateGroup

async def main():
    async with stdio_client(
        "python", ["-m", "adp_hypervisor", "--config", "config.yaml"],
        authorization=basic_auth("alice", "secret"),
    ) as session:
        # 1. Discover available resources
        discovery = await session.discover()
        for resource in discovery.resources:
            print(f"  {resource.resource_id}: {resource.description}")

        # 2. Describe a resource to get its usage contract
        contract = await session.describe("com.example:users", "QUERY")
        print(f"Fields: {[f.field_id for f in contract.usage_contract.fields]}")

        # 3. Execute an intent
        intent = QueryIntent(
            intentClass="QUERY",
            resourceId="com.example:users",
            predicates=PredicateGroup(op="AND", predicates=[]),
        )
        result = await session.execute(intent)
        print(f"Got {len(result.results)} rows")

asyncio.run(main())

API Overview

stdio_client (convenience)

async with stdio_client(command, authorization=basic_auth("user", "secret")) as session:
    ...

Launches an ADP server as a subprocess and returns an initialized ClientSession.

ClientSession

Method Description
discover(filter?, cursor?) List available resources
describe(resource_id, intent_class, version?, cursor?) Get a resource's usage contract
validate(intent) Check if an intent is valid
execute(intent, cursor?) Run an intent against a resource
ping() Check server liveness

Error Handling

All server errors are mapped to typed exceptions:

from adp_sdk import ResourceNotFoundError, ValidationFailedError

try:
    result = await session.execute(intent)
except ResourceNotFoundError as e:
    print(f"Resource not found: {e}")
except ValidationFailedError as e:
    print(f"Invalid intent: {e}")

Development

# Install dependencies
uv sync --all-extras

# Run tests
uv run python -m unittest discover -s tests -v

# Type checking
uv run pyright

# Linting
uv run ruff check .

License

Apache-2.0

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

adp_sdk-0.1.0.dev0.tar.gz (71.3 kB view details)

Uploaded Source

Built Distribution

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

adp_sdk-0.1.0.dev0-py3-none-any.whl (31.3 kB view details)

Uploaded Python 3

File details

Details for the file adp_sdk-0.1.0.dev0.tar.gz.

File metadata

  • Download URL: adp_sdk-0.1.0.dev0.tar.gz
  • Upload date:
  • Size: 71.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for adp_sdk-0.1.0.dev0.tar.gz
Algorithm Hash digest
SHA256 a464813fe20acd53abdfa4f25bdcc864fa41aa80d9ec71c293211d61d81e4fb1
MD5 ad5de4d67bfdedc7eee2a310061c8791
BLAKE2b-256 c981ecc8b308d90650293d8d178412d63454669de0517ca11e5ad8346850e626

See more details on using hashes here.

File details

Details for the file adp_sdk-0.1.0.dev0-py3-none-any.whl.

File metadata

  • Download URL: adp_sdk-0.1.0.dev0-py3-none-any.whl
  • Upload date:
  • Size: 31.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for adp_sdk-0.1.0.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e57d201b670e049c54cc034e2d6bfc6cc89205b14a71a518fdf702157c7b4fe
MD5 c7cb0c692f1560a0e772958bc7314cae
BLAKE2b-256 c2a1dcd6be76217771879ac937dbd45d6b06a913ff64b461cb3e879f662e6d8c

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