Skip to main content

Python SDK for ATI (Agent Tools Interface) — token utilities and orchestrator provisioning

Project description

ati-client

Python SDK for ATI (Agent Tools Interface) — orchestrator provisioning and JWT token utilities.

Install

pip install ati-client

Quick Start

Orchestrator Provisioning

from ati import AtiOrchestrator

orch = AtiOrchestrator(
    proxy_url="https://ati-proxy.example.com",
    secret="17332cf135d362f79a2ed700b13e1215978be1d6ae6e133d25b6b3f21fa10299",
)

# Generate env vars to inject into a sandboxed agent
env_vars = orch.provision_sandbox(
    agent_id=f"sandbox:{sandbox_id}",
    tools=["finnhub_quote", "web_search", "github__*"],
    skills=["financial-analysis"],
    ttl_seconds=7200,
    rate={"tool:github__*": "10/hour"},
)

# env_vars = {
#     "ATI_PROXY_URL": "https://ati-proxy.example.com",
#     "ATI_SESSION_TOKEN": "eyJ...",
# }

Token Utilities

from ati import issue_token, validate_token, inspect_token

# Issue a token
token = issue_token(
    secret="17332cf135d362f79a...",
    sub="agent-7",
    scope="tool:web_search tool:finnhub_quote",
    ttl_seconds=3600,
)

# Validate (checks signature, expiry, audience)
claims = validate_token(token, secret="17332cf135d362f79a...")
print(claims.sub)      # "agent-7"
print(claims.scopes()) # ["tool:web_search", "tool:finnhub_quote"]

# Inspect without validation (debugging)
claims = inspect_token(token)

Scope Utilities

from ati import build_scope_string, check_scope, matches_wildcard

# Build scope strings
scope = build_scope_string(
    tools=["web_search", "github__*"],
    skills=["research-*"],
    extra=["help"],
)
# "tool:web_search tool:github__* skill:research-* help"

# Check if a tool is allowed
check_scope("tool:github__search_repos", ["tool:github__*"])  # True
check_scope("tool:secret_api", ["tool:web_search"])            # False

# Wildcard matching
matches_wildcard("tool:github__search", "tool:github__*")  # True
matches_wildcard("anything", "*")                           # True

JWT Format

Tokens are HS256-signed JWTs compatible with the ATI Rust proxy. The secret must be a hex-encoded 32-byte key (64 hex characters).

Claims payload:

{
  "sub": "agent-7",
  "aud": "ati-proxy",
  "iat": 1700000000,
  "exp": 1700003600,
  "jti": "550e8400-e29b-41d4-a716-446655440000",
  "iss": "ati-orchestrator",
  "scope": "tool:web_search tool:github__*",
  "ati": {
    "v": 1,
    "rate": {
      "tool:github__*": "10/hour"
    }
  }
}

Development

cd ati-client
pip install -e ".[dev]"
pytest

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

ati_client-0.1.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

ati_client-0.1.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file ati_client-0.1.0.tar.gz.

File metadata

  • Download URL: ati_client-0.1.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ati_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e360d9f07aeea1721813739de2a2818630743b901418c68b1eff73bfc5aaf022
MD5 ad25c5a9a8dbb03e808bc85a98f326aa
BLAKE2b-256 ba7b7d26eb9a52ba4684dc553f8f82bacab118e94767d893721e89370e570582

See more details on using hashes here.

File details

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

File metadata

  • Download URL: ati_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for ati_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ff959005b543fda56aa76ba45ccfcf1701ab30be2412eb2c3fb623c39bf62cc
MD5 a752a1fec78cad22b0fdce747d98f05c
BLAKE2b-256 23c82f2a5d46dd602de5635cd981f673abb8d5825064104accf2619d39a8bf6c

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