Skip to main content

Agent-specific identity and access management for AI agents.

License PyPI Docs Follow @CohorteAI


What does it do?

When AI agents operate in your enterprise, the authorization question changes from "Can this user do X?" to:

"Can this agent, acting on behalf of this user, do X, right now, on this resource?"

agent-auth answers that question. It is a lightweight, YAML-driven authorization engine purpose-built for AI agent systems. No cloud dependency. No vendor lock-in. Just a Python library and a CLI.


Features

  • Resolution with provenance (0.2) — what an agent may do for a given user, and why: baseline, grants per user role, delegations, denials, and limits set in code that no config can widen. preview it, explain any decision. See Resolution
  • One identity per request (0.2) — an agent acts for a user or as a service, never a silent mix of both
  • Sub-agents and tokens (0.2) — delegation by attenuation (a sub-agent never gets more than its parent) and short-lived, audience-bound tokens for tool servers
  • Separation of duties (0.2) — the same user cannot create and approve the same payment
  • LangChain 1.x / Deep Agents middleware (0.3) — every tool call authorized for the run's user, sub-agents never above their parent, hand-offs checked; denials don't abort the run. See LangChain agents
  • Roles with inheritance — define hierarchical permission sets via extends
  • Agent profiles — assign roles, allow/deny specific actions, scope to resource patterns
  • Three-tier approval — autonomous / soft / strong
  • Sessions — time-limited, scope-bound authorization contexts (UUID4 IDs)
  • Delegation — temporary permission grants from a user to an agent, for that user's requests only
  • Agent-to-agent (A2A) — control which agents can invoke which
  • Audit logging — every decision recorded in JSONL
  • Safe expression language — custom DSL for policy conditions (no eval())
  • CLI — validate, check, manage sessions and delegations from the terminal

Quick Start

Install

pip install theaios-agent-auth

Define your policy (agent_auth.yaml)

version: "1.0"

roles:
  viewer:
    actions: [read]
  editor:
    extends: viewer
    actions: [write]

profiles:
  assistant:
    role: editor
    scopes: []

approval_policies:
  - name: destructive
    condition: 'action == "delete"'
    tier: strong

Use in Python

from theaios.agent_auth.config import load_config
from theaios.agent_auth.engine import AuthEngine
from theaios.agent_auth.types import AuthRequest

config = load_config("agent_auth.yaml")
engine = AuthEngine(config)

decision = engine.authorize(AuthRequest(
    agent="assistant",
    user="alice",
    action="read",
))

print(decision.allowed)        # True
print(decision.is_autonomous)  # True
print(decision.is_denied)      # False

Gate execution on is_autonomous, not on allowed. An action that needs approval is allowed=True with requires_approval=True and a tier of soft or strong: the agent may do it once a human approves, not before.

if decision.is_autonomous:
    run(action)
elif decision.requires_approval:
    ask_human(decision.tier, decision.reason)
else:
    refuse(decision.reason)

Use the CLI

# Validate your config
agent-auth -c agent_auth.yaml validate

# Check a permission
agent-auth -c agent_auth.yaml check --agent assistant --user alice --action read

# Create a session
agent-auth -c agent_auth.yaml sessions --create --agent assistant --user alice --scope "project:*"

# Delegate permissions
agent-auth -c agent_auth.yaml delegate --from-user alice --to-agent assistant --actions deploy --duration 3600

Why this library?

Approach Limitation
Okta / Azure AD Built for human users, not AI agents. No concept of approval tiers, agent scopes, or A2A authorization.
OPA / Cedar General-purpose policy engines. Powerful but require significant effort to model agent-specific patterns (sessions, delegation, A2A).
Custom code Every team reinvents the same patterns. No standard, no audit trail, no CLI tooling.
agent-auth Purpose-built for AI agents. YAML config, three-tier approval, sessions, delegation, A2A, audit — all out of the box. Safe expression language — no eval().

Documentation

Full documentation: cohorte-ai.github.io/agent-auth

Topic Link
Concepts concepts
Resolution (0.2) resolution
Delegation delegation
Config syntax config-syntax
CLI reference cli
API reference api-reference
Integration integration

Ecosystem

agent-auth is part of the theaios platform — modular tech bricks for enterprise AI systems:

Package Purpose
theaios-guardrails Policy guardrails for agent inputs, actions and outputs
theaios-context-router Intelligent context routing
theaios-agent-monitor Runtime observability
theaios-agent-auth Identity and access management

License

Apache 2.0 — see LICENSE.

Metadata

Release files for theaios-agent-auth 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for theaios-agent-auth 0.3.0
File Size Uploaded Provenance Actions
theaios_agent_auth-0.3.0.tar.gz 137.8 kB Without provenance Details for theaios_agent_auth-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for theaios-agent-auth 0.3.0
File Interpreter ABI Platform Actions
theaios_agent_auth-0.3.0-py3-none-any.whl Python 3 none any Details for theaios_agent_auth-0.3.0-py3-none-any.whl

Total release size: 204.0 kB

Release files / theaios_agent_auth-0.3.0.tar.gz

Download URL theaios_agent_auth-0.3.0.tar.gz
Size 137.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c109c3a22737248b563fdca3b8200386583f6576881e33512b0927011e0127bb
BLAKE2b-256 checksum
How to use checksums
f8eda267812774e2a2ad9c5f79021d1cfa441ad57fc3b1cccc18b465c7a98d16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / theaios_agent_auth-0.3.0-py3-none-any.whl

Download URL theaios_agent_auth-0.3.0-py3-none-any.whl
Size 66.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fba33f17776f5a28fd5d8bf1ed9f81945d5c0747c1cd2695fa15cf927c49e444
BLAKE2b-256 checksum
How to use checksums
952bfc07e28614ffd7302c7acdd970164e1704ba447cf2ac778ada1cd2469b1f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for theaios-agent-auth 0.3.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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