<!-- SPDX-License-Identifier: Apache-2.0 -->
**Status:** stable · **Owner:** Developer Relations · **License:** Apache-2.0

# `llamaindex` — KYE adapter for LlamaIndex

A thin LlamaIndex callback handler that seals each query / retrieval as a KYE
tool-call inside the §0.3 evidence chain. Register it on your existing
`CallbackManager` — the query engine is unchanged.

```python
from llama_index.core.callbacks import CallbackManager
from adapter import KyeLlamaIndexHandler

callback_manager = CallbackManager([KyeLlamaIndexHandler()])
# pass callback_manager into your Settings / index / query engine
```

- query start → `kye.agent.governance.v1` (the §52 task-start binding).
- each retrieval event → `kye.evidence.tool_call.v1` (source nodes pinned).
- query end → `kye.agent.completion.v1` (the task-end ledger).

## Non-competition lock (§0 / §0.30 / §32 — permanent)

KYE **governs** the LlamaIndex retrieval as a first-class principal; it does
**NOT** run, replace, or vendor LlamaIndex, and it is **not** a parallel RAG /
vector engine (see §71 for KYE's document-intelligence boundary —
PageIndex is allow-listed, never reimplemented). `llama-index` is a peer
dependency, referenced as an integration point only. The non-competition lock is
permanent.

## Reuses the canonical envelope

Same three envelopes as
[`governed-agent`](../../agent-dev-kit-templates/governed-agent/README.md) (§32)
— no new envelope is invented. Reference shapes:
[`public/examples/agent-governance/`](../../../examples/agent-governance/).

## Files

- `src/adapter.py` — the `KyeLlamaIndexHandler`.
