Overview
The LlamaIndexAgent connects AG-Kit to the LlamaIndex TS workflow system. It can:- Build a simple single-agent workflow from llm, tools, and systemPrompt
- Or accept a custom workflow via workflowFactory
- Stream AG-UI compatible events (text chunks, tool calls/results)
- Maintain per-thread conversation memory via memoryFactory
Installation
Exports
All exports are available from@ag-kit/adapter-llamaindex:
Exports:
- LlamaIndexAgent - Main agent class for LlamaIndex integration
- AguiLlamaIndexWorkflow - Utility to construct runnable workflows (single or multi-agent)
Quick start (single agent)
Custom workflow (multi-agent or advanced)
Server integration
API
class LlamaIndexAgent
Unique identifier for the agent. Defaults to
“Agent” if omitted.Human-readable description of the agent.
LlamaIndex LLM instance. Used when building the default single-agent workflow.
Array of LlamaIndex tools. These are called by the agent during execution.
Optional system prompt injected before user messages.
Provide a custom workflow. When present, it overrides the default single-agent workflow.
Factory for per-thread conversation memory.
Methods
run()
- input - RunAgentInput containing messages, runId, threadId, tools, etc.
- returns -
Observable<BaseEvent>
Note: Event types follow the same semantics as LanggraphAgent (RUN_STARTED, TEXT_MESSAGE_CONTENT, TOOL_CALL_START, TOOL_CALL_ARGS, TOOL_CALL_RESULT, RUN_FINISHED, etc.).
See also
- Multi-agent example (TS): project path typescript-sdk/packages/examples/agents/llamaindex-ts/multi-agent
- Core agent reference: /reference/agents/agents
- Server integration: /reference/server/overview