> ## Documentation Index
> Fetch the complete documentation index at: https://docs.inviolet.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# LlamaIndex

> Wrap LlamaIndex query engines and tools so retrieval and tool-execution run through Inviolet.

Wrap LlamaIndex query engines and tools so retrieval + tool-execution both run
through Inviolet.

## Install

```bash theme={"dark"}
npm install @inviolet/agent-sdk-llamaindex @inviolet/agent-sdk-core
```

## Use

```ts theme={"dark"}
import { VectorStoreIndex } from 'llamaindex'
import { Inviolet } from '@inviolet/agent-sdk-core'
import { wrapQueryEngine } from '@inviolet/agent-sdk-llamaindex'

const inviolet = new Inviolet({ /* ... */ })

const index = await VectorStoreIndex.fromDocuments(docs)
const queryEngine = wrapQueryEngine(index.asQueryEngine(), {
  inviolet,
  intentId: 'intents:doc_search',
  actor: 'alice@example.com',
  audience: 'kb-internal',
})

const response = await queryEngine.query('Onboarding checklist')
```
