Metadata-Version: 2.4
Name: ory-pydantic-ai
Version: 0.12.1
Summary: Ory Agent Security for Pydantic AI — per-tool authorization, tracing, and identity propagation via a WrapperToolset. Built on ory-argus.
Author: Ory
License-Expression: Apache-2.0
Keywords: agent,ai,authorization,ory,permissions,pydantic-ai
Requires-Python: >=3.10
Requires-Dist: ory-argus<1,>=0.8
Requires-Dist: pydantic-ai-slim>=0.0.40
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# ory-pydantic-ai

Ory Agent Security for [Pydantic AI](https://ai.pydantic.dev).

Wraps any toolset in an Ory-gating `WrapperToolset` so every tool call is authorized
against Ory Permissions, traced, and tied to the user → agent identity — built on
[`ory-argus`](https://pypi.org/project/ory-argus/).

```bash
pip install ory-pydantic-ai
```

```python
from pydantic_ai import Agent
from ory_pydantic_ai import wrap_toolset

agent = Agent(model, toolsets=[wrap_toolset(my_toolset)])
```

In **enforce** mode (`ORY_PERMISSION_MODE=enforce`) a denied tool raises `ModelRetry` with
the denial, so the model is told the call was refused and the tool never runs. In **observe**
mode (default) the tool runs and a `permission.observe_deny` span is recorded.

Credentials come from the shared `~/.config/ory-agent-plugins/config.json`.
