Metadata-Version: 2.4
Name: nomos-sdk
Version: 0.1.0
Summary: Nomos Python SDK — capability layer for AI agents (scoped, time-bound, revocable, delegable permissions for MCP / LangGraph / CrewAI / AutoGen)
Author-email: Nomos <hello@auto-nomos.com>
License: MIT
Project-URL: Homepage, https://auto-nomos.com
Project-URL: Documentation, https://github.com/varendra007/nomos/blob/main/docs/SELF_HOSTING.md
Project-URL: Repository, https://github.com/varendra007/nomos
Project-URL: Issues, https://github.com/varendra007/nomos/issues
Project-URL: Changelog, https://github.com/varendra007/nomos/blob/main/packages/sdk-python/CHANGELOG.md
Keywords: ai,agents,mcp,ucan,cedar,authorization,policy,capability,langgraph,crewai,autogen
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.27.0
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"

# auto-nomos-sdk (Python)

Python SDK for Nomos — multi-agent orchestration security.

Mirrors the TS SDK so LangGraph / CrewAI / AutoGen orchestrators get the
same chain-aware authorize / proxy story.

## Install

```bash
pip install auto-nomos-sdk
```

You also need the `nomos-ucan` CLI on PATH for UCAN minting:

```bash
npm install -g @auto-nomos/ucan-cli
```

## Use — root agent

```python
from nomos import AuthGuard

guard = AuthGuard(api_key="nomos_<id>_<secret>", pdp_url="https://pdp.example.com")
decision = guard.authorize(
    ucan="<jwt>",
    command="github:repo:read",
    resource={"repo": "org/test-repo"},
)
if decision.allow:
    ...
```

## Use — fork a child agent (LangGraph / CrewAI / AutoGen)

```python
import subprocess, os, json
from nomos import fork_child, read_parent_chain_from_env

# Inside the parent agent (already authorized once and got a child UCAN
# minted via nomos-ucan or via the control-plane mint endpoint):
chain, env = fork_child(
    parent_chain=read_parent_chain_from_env().chain,
    child_ucan_jwt=child_jwt,
    parent_receipt_id=last_receipt_id,
    swarm_id=swarm_id,
)
subprocess.Popen(["python", "child_agent.py"], env={**os.environ, **env})
```

The child process's `AuthGuard()` automatically picks up
`NOMOS_PARENT_UCAN_CHAIN` and includes the full root → leaf chain on
every authorize / proxy call.

## Env vars (orchestrator-agnostic wire format)

| Var | Purpose |
| --- | --- |
| `NOMOS_PARENT_UCAN_CHAIN` | JSON UCAN array (root-first). |
| `NOMOS_PARENT_UCAN_CHAIN_FILE` | Fallback file path when env exceeds OS limits. |
| `NOMOS_PARENT_RECEIPT_ID` | Causation back-link to parent's last receipt. |
| `NOMOS_SWARM_ID` | Explicit swarm id; PDP otherwise derives. |
| `NOMOS_MAX_CHAIN_DEPTH` | Override depth cap; default 8. |
| `NOMOS_UCAN_BIN` | Path to `nomos-ucan` binary; default `nomos-ucan` on PATH. |
