Skip to main content

Eniyan SDK (Python)

Govern your AI agents wherever they run. This SDK wraps the Eniyan API — agent identity verification, live scope decisions, JIT credential windows, short-lived OAuth tokens, and self-reported run telemetry — so any agent loop becomes Eniyan-governed in a few lines. Eniyan never hosts or observes your loop; your agent reports metadata-only telemetry (names, scopes, token counts, outcomes — never prompts, arguments, results, or model output).

pip install eniyan

Quickstart

import os
from eniyan import EniyanClient, governed_run, EniyanScopeRefused

client = EniyanClient(
    base_url="https://api.eniyantrust.com",
    api_key=os.environ["ENIYAN_API_KEY"],
    credential_token=os.environ["ENIYAN_CREDENTIAL_TOKEN"],
    agent_id=os.environ["ENIYAN_AGENT_ID"],
)

with governed_run(client, harness="my-loop", jit=True, scopes=["crm:read"]) as run:
    fetch = run.tool("fetch_accounts", scope="crm:read")(fetch_accounts)
    accounts = fetch()                      # refused under block mode BEFORE it runs
    run.model_call("claude-sonnet-5", input_tokens=1200, output_tokens=300)

On exit — success or crash — the run is finished, buffered steps are flushed, and the JIT window is completed and attested.

What each piece maps to

SDK call API
client.verify() / client.check_scope() POST /v1/credentials/verify
client.mint_token() / client.introspect() POST /v1/oauth/token / /introspect
client.validate_grant() POST /v1/agents/credentials/validate
client.create_task() / complete_task() / attest_task() JIT task lifecycle
client.start_run() / append_steps() / finish_run() POST /v1/runs

Advisory-mode scope violations do not raise — the call proceeds and the violation is flagged server-side (GovernanceDecision.advisory_flagged). Block mode raises EniyanScopeRefused before the tool executes.

MCP server

pip install "eniyan[mcp]" and run eniyan-mcp to expose the same governance operations as MCP tools for Claude Code or any MCP-capable harness. See the gated docs for configuration.

Development

pip install -e ".[dev]"
pytest

tests/integration_local.py runs the full flow against a local Eniyan stack (docker compose up from the repo root).

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eniyan-0.1.0.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

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

eniyan-0.1.0-py3-none-any.whl (12.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: eniyan-0.1.0.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for eniyan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1e13d2ab50b272844b0b47ba88737f443d9d32c4c0ef1801e7e06cde84899873
MD5 af9fb52d2635117acc8c6971ed61a0db
BLAKE2b-256 e0e6cb799a46d3b43417f2e850607db163f73bbf65d7063f4d823ad41c7f8c14

See more details on using hashes here.

File details

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

File metadata

  • Download URL: eniyan-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 12.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.14.3

File hashes

Hashes for eniyan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 642e40312915fa44494ae15f851a07cd7a0252a060190eb28fca0748104cfa03
MD5 23c5bd007d3361f6e05ebf06bbf04650
BLAKE2b-256 e37dfdb7e09442dd177064efaf992fcc1d7b5b58b22558da4a725b0a098b0feb

See more details on using hashes here.

Release history Release notifications | RSS feed

0.5.0

2 files

0.3.0

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page