Metadata-Version: 2.5
Name: pytrat-agents
Version: 0.1.0
Summary: Experimental AI-agent profile for Transaction Tokens (draft-araut-oauth-transaction-tokens-for-agents-03).
Project-URL: Homepage, https://github.com/roshanlam/pytrat
Project-URL: Documentation, https://github.com/roshanlam/pytrat/tree/main/docs
Project-URL: Source, https://github.com/roshanlam/pytrat
Project-URL: Issues, https://github.com/roshanlam/pytrat/issues
Project-URL: Changelog, https://github.com/roshanlam/pytrat/blob/main/CHANGELOG.md
Author-email: Roshan Lamichhane <roshanlamichhanenepali@gmail.com>
License-Expression: Apache-2.0
License-File: LICENSE
Keywords: ai-agents,authorization,jwt,microservices,oauth,transaction-tokens,txn-token,zero-trust
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Security
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: pytrat-core<0.2,>=0.1.0
Requires-Dist: pyyaml>=6.0.2
Description-Content-Type: text/markdown

# pytrat-agents

**Experimental.** The AI-agent profile of Transaction Tokens for PyTraT,
implementing `draft-araut-oauth-transaction-tokens-for-agents-03`, an individual Internet-Draft not
adopted by the OAuth working group. The API may change with every draft revision.

* `agentic_ctx` computation with **monotonic attenuation**: the originator never changes,
  `hop_count` only rises, the chain's minimum assurance only falls.
* The trusted **Agent Attribute Store** (`YamlAgentStore`, `SqliteAgentStore`, `InMemoryAgentStore`).
* Resource-side agent-chain requirements.
* `ToolRuntime`, a trusted tool runtime that keeps tokens and exchange capabilities away from the
  model, validates tool arguments strictly and blocks token-shaped tool results.

```bash
pip install pytrat-agents
```

```python
from pytrat.agents import AgentRecord, InMemoryAgentStore, ToolRuntime

agent = AgentRecord(id="report-agent", name="Report agent", owner="finance", assurance_level="high",
                    version="2.4.1", provenance="sha256:...")
runtime = ToolRuntime(agent=agent, token_provider=provider, store=InMemoryAgentStore([agent]),
                      audit=sink)


@runtime.protected_tool(scope="reports.read", resource="reports-api")
def get_report(report_id: str) -> dict[str, str]:
    """Fetch one report."""  # never receives the token
    ...
```

> **An in-process decorator is not an isolation boundary.** If the model can execute code in the
> same process, it can reach the token provider. Run the runtime in a separate process or sidecar.

## Documentation

PyTraT documentation: *Agents (experimental)* and the `pytrat.agents` API reference (sources in
`docs/` of the repository).

Apache-2.0.
