RAG
Retrieval-augmented chat with inline source citations.
'use client'import { useMemo } from 'react'import type { Retriever, RetrievedDocument } from '@agentskit/core'import { useChat, ChatContainer, InputBar } from '@agentskit/react'import '@/styles/agentskit-theme.css'import { createMockAdapter, initialAssistant } from './_shared/mock-adapter'import { MdRenderer } from './_shared/md-renderer'const CORPUS: RetrievedDocument[] = [ { id: 'doc-1', content: 'AgentsKit `useChat` returns a ChatReturn with messages, status, input, error, usage and imperative handlers (send, stop, retry, edit, regenerate).', metadata: { source: 'guide/useChat.md' }, score: 0.92, }, { id: 'doc-2', content: 'Retrievers implement `retrieve(request)` and return an array of RetrievedDocument. AgentsKit injects them into the context as structured citations.', metadata: { source: 'guide/retrievers.md' }, score: 0.87, }, { id: 'doc-3', content: 'Memory is swappable — in-memory (dev), file, SQLite, Redis, vector stores. Every backend implements the same contract.', metadata: { source: 'guide/memory.md' }, score: 0.81, },]const staticRetriever: Retriever = { async retrieve() { return CORPUS },}export function RAGChat() { const adapter = useMemo( () => createMockAdapter([ { text: 'Based on the docs, `useChat` returns a full ChatReturn with imperative handlers plus state. See *guide/useChat.md* and *guide/retrievers.md* for the citation flow.', }, { text: 'Memory is pluggable — dev, file, SQLite, Redis, or vector. Each shares the same contract per *guide/memory.md*.', }, ]), [], ) const chat = useChat({ adapter, retriever: staticRetriever, initialMessages: [ initialAssistant('Ask me about AgentsKit — I cite the relevant doc chunks inline.'), ], }) return ( <div data-ak-example className="flex h-[440px] flex-col overflow-hidden rounded-lg border border-ak-border bg-ak-surface" > <ChatContainer className="flex-1 space-y-3 p-4"> {chat.messages.map((m) => ( <div key={m.id} data-ak-message data-ak-role={m.role} className="rounded-lg bg-ak-midnight/40 p-3"> <MdRenderer content={m.content} /> </div> ))} </ChatContainer> <InputBar chat={chat} /> </div> )}Basic chat
Streaming chat with a mock adapter. Zero config, runs in-browser.
streamingchatTool use
Tool-calling agent that browses a mocked product catalog.
toolschatCode assistant
Code-aware chat with syntax-highlighted output.
codechatMarkdown chat
Rich Markdown rendering in assistant responses.
markdownchatSupport bot
Chat with escalation, memory, and confirmation gates.
supportmemorytoolsMulti-agent
Planner + worker + reviewer topology.
multi-agentMulti-model
Switch providers on the fly in a single conversation.
multi-modelchatAgent actions
Streaming UI with live tool-call visualization.
toolsstreamingshadcn/ui chat
AgentsKit styled with shadcn/ui tokens.
chatdesign-systemMaterial UI chat
AgentsKit styled with MUI components.
chatdesign-systemSandbox runner
Agent-emitted code runs isolated in E2B / WebContainer.
sandboxtoolscodeObservability trace
Live span tree with tokens, latency, cost. Exports to LangSmith / OTEL.
observabilityproductionPersistent memory
Cross-session recall with sqlite, redis, or lancedb backends.
memorypersistenceEval suite
Run regression tests, track accuracy / latency / cost in CI.
evalproductionciSlack integration
Agent posts to Slack via @agentskit/tools.
integrationstoolsInk terminal
Same controller, rendered in your terminal via Ink.
inkcliterminalSkill swap
Hot-swap personas mid-conversation: researcher, critic, planner.
skillspromptsRuntime ReAct
Standalone agent runtime — no UI required. ReAct loop with tools + memory.
runtimemulti-agentProvider fanout
Same prompt across openai, anthropic, gemini, ollama. Compare quality + cost.
adaptersmulti-modelRAG with citations
Retrieve top-k chunks with scores and inline cite refs.
ragcitations