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

# KYE framework adapters

Thin, patent-safe adapters that let popular agent / RAG / data frameworks emit
the KYE governance + evidence envelopes, so any team already using one of them
gets KYE authority + replay-verifiable evidence for free.

Each adapter is a small callback / middleware / hook written in the host
framework's own idiom. When the framework runs an agent step, a retrieval, or a
tool call, the adapter emits the **same envelope shape** as the canonical
[`governed-agent`](../agent-dev-kit-templates/governed-agent/README.md)
template (§32): `kye.agent.governance.v1` at task-start, `kye.evidence.tool_call.v1`
per step, and `kye.agent.completion.v1` at task-end — plus the §52 binding.

## The §0 / §0.30 / §32 non-competition lock (permanent)

KYE **governs** agents / pipelines as first-class principals (§0.30); KYE does
**NOT** run them and does **NOT** become an agent / RAG / data framework. The
non-competition lock vs **LangChain, LlamaIndex, CrewAI, Firecrawl, CocoIndex,
OpenAI Agents SDK and Claude Agent SDK is permanent.** These adapters reference
those frameworks as peer dependencies / integration points only — they do not
vendor, fork, or re-implement them. This mirrors the §32 Agent Dev Kit lock and
the §0.25 "integrate, not compete" directive.

## Adapters

| Adapter | Framework kind | Integration point | Emits |
|---|---|---|---|
| [`langchain`](langchain/README.md) | agent / chain orchestration | `BaseCallbackHandler` | governance + tool-call + completion |
| [`llamaindex`](llamaindex/README.md) | RAG / retrieval | retrieval callback | governance + tool-call + completion |
| [`crewai`](crewai/README.md) | multi-agent crews | `step_callback` | governance + tool-call + completion |
| [`firecrawl`](firecrawl/README.md) | web data ingestion | scrape/crawl wrapper | governance + tool-call + completion |
| [`cocoindex`](cocoindex/README.md) | data / index pipelines | flow hook | governance + tool-call + completion |
| [`haystack`](haystack/README.md) | agent / RAG pipelines | authority components + `@component` gate | governance + tool-call + reliance-pin + refusal + completion + evidence-pack + drift |
| [`pgvector`](pgvector/README.md) | retrieval / vector store | query-front admissibility gate | data-use + reliance-pin + data-access + refusal |

## The shared envelope (reused, not reinvented)

Every adapter reuses the canonical KYE §0.3 evidence family. Reference shapes:
[`public/examples/agent-governance/`](../../examples/agent-governance/). The
adapter does **not** invent a new envelope — it maps the framework's native
lifecycle events onto the existing three.

| When | Envelope | Schema |
|---|---|---|
| task-start | binding | `kye.agent.governance.v1` |
| each step / retrieval / scrape | tool-call | `kye.evidence.tool_call.v1` |
| task-end | completion | `kye.agent.completion.v1` |

## What you write vs. what KYE emits

You keep writing your LangChain chain, your LlamaIndex query engine, your CrewAI
crew, your Firecrawl scrape, your CocoIndex flow — unchanged. You register one
KYE adapter object with the framework's callback / hook surface, and the
governance binding + evidence chain are emitted for you. Swap the demo emitter
for the real KYE Gateway client (`@kye/agent-dev-kit`) and nothing else changes.

## Files

- `<framework>/README.md` — the integration pattern + the non-competition lock.
- `<framework>/src/adapter.{ts,py}` — the thin callback / hook code sample.
