Metadata-Version: 2.4
Name: ory-llamaindex
Version: 0.11.1
Summary: Ory Agent Security for LlamaIndex — per-tool authorization, tracing, and identity propagation by wrapping FunctionTools. Built on ory-argus.
Author: Ory
License-Expression: Apache-2.0
Keywords: agent,ai,authorization,llamaindex,ory,permissions
Requires-Python: >=3.10
Requires-Dist: llama-index-core>=0.11
Requires-Dist: ory-argus<1,>=0.8
Provides-Extra: dev
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Description-Content-Type: text/markdown

# ory-llamaindex

Ory Agent Security for [LlamaIndex](https://docs.llamaindex.ai).

Wraps your LlamaIndex tools so every 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-llamaindex
```

```python
from llama_index.core.agent.workflow import FunctionAgent
from ory_llamaindex import guard_tools

agent = FunctionAgent(tools=guard_tools([search_tool, email_tool]), llm=llm)
```

In **enforce** mode (`ORY_PERMISSION_MODE=enforce`) a denied tool raises an error surfaced to
the agent; the tool never runs. In **observe** mode (default) it runs and a
`permission.observe_deny` span is recorded.

For tracing across paths that bypass the wrapped tools, register the instrumentation handler:

```python
from llama_index.core.instrumentation import get_dispatcher
from ory_llamaindex import ory_event_handler
get_dispatcher().add_event_handler(ory_event_handler())
```

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