agentskit.js
Getting Started

Quick start

Headless useChat binding hello-world in under 10 lines.

This page is the fastest UI binding hello-world (useChat + a framework package). It is not the product chat framework β€” for a versioned multi-surface chat application, use AgentsKit Chat.

If you want the full AgentsKit foundation story with runtime, tools, memory, and observability, jump to Build your first agent.

#Basic chat

app/chat.tsx
import { useChat, ChatContainer, Message, InputBar } from '@agentskit/react'
import { anthropic } from '@agentskit/adapters'
import '@agentskit/react/theme'

function App() {
  const chat = useChat({
    adapter: anthropic({ apiKey: 'your-key', model: 'claude-sonnet-4-6' }),
  })

  return (
    <ChatContainer>
      {chat.messages.map(msg => (
        <Message key={msg.id} message={msg} />
      ))}
      <InputBar chat={chat} />
    </ChatContainer>
  )
}

#What you got

ComponentRole
useChatA chat session bound to an adapter; manages messages, streaming, errors
ChatContainerAuto-scrolling layout
MessageRenders one message with streaming support
InputBarText input that sends on Enter

Out of the box: streaming, message history, default styling. No extra setup.

#What this page is not

This quickstart shows the headless UI binding only β€” a thin React (or other framework) shell over AgentsKit primitives.

For the foundation path, continue to Build your first agent.

#Swap providers

The adapter is the only thing that changes. Everything else stays the same.

import { openai } from '@agentskit/adapters'

const chat = useChat({
  adapter: openai({ apiKey: 'your-key', model: 'gpt-4o' }),
})

This is the plug-and-play principle in practice β€” no rewrites for a provider swap.

Not sure which to pick? See Choosing an adapter for a capability matrix and rules of thumb.

#Headless mode

Skip the theme import and style everything yourself β€” components render with data-ak-* attributes only:

import { useChat, ChatContainer, Message, InputBar } from '@agentskit/react'
// No theme import

function App() {
  const chat = useChat({ adapter: myAdapter })
  return (
    <ChatContainer className="my-chat">
      {chat.messages.map(msg => (
        <Message key={msg.id} message={msg} />
      ))}
      <InputBar chat={chat} />
    </ChatContainer>
  )
}

#Try the official examples

  • apps/example-react β€” full chat with tool calls and memory
  • apps/example-ink β€” same chat in your terminal
  • apps/example-runtime β€” autonomous agent (no UI)
  • apps/example-multi-agent β€” supervisor + workers

Explore nearby

✎ Edit this page on GitHubΒ·Found a problem? Open an issue β†’Β·How to contribute β†’

On this page

Ask the docs
Ask anything about AgentsKit. Answers come from the docs corpus and cite their sources.