agentskit.js

@agentskit/solid — for agents

SolidJS binding — `useChat` hook backed by createStore for fine-grained reactivity.

#Purpose

SolidJS binding for the ChatReturn contract from @agentskit/core. Same shape as React/Vue/Svelte hooks — store-backed, cleanup wired via onCleanup.

#Install

npm install @agentskit/solid
# peer:
npm install solid-js

#Primary exports

  • useChat(config): ChatReturn — Solid hook backed by createStore + onCleanup.

Headless components (full parity with @agentskit/react, data-ak-* attributes only):

  • ChatContainer — scroll wrapper, auto-scrolls on new content via a MutationObserver.
  • Message — renders a message; optional avatar / actions slots.
  • InputBar — textarea + Send button; Enter submits, Shift+Enter newlines, disabled when empty/streaming.
  • Markdown — content surface with a streaming flag.
  • CodeBlockcode + language, optional copyable copy button.
  • ToolCallView — collapsible tool-call view (name → args/result).
  • ThinkingIndicator — shown while visible, with a label.
  • ToolConfirmation — HITL approve/deny, renders only when status === 'requires_confirmation'.

#Minimal example

import { useChat } from '@agentskit/solid'
import { anthropic } from '@agentskit/adapters'

const adapter = anthropic({ apiKey: import.meta.env.VITE_ANTHROPIC_KEY, model: 'claude-sonnet-4-6' })

export function Chat() {
  const chat = useChat({ adapter })
  return (
    <div>
      <ul>{chat.messages.map(m => <li>{m.role}: {m.content}</li>)}</ul>
      <button onClick={() => chat.send('Hello')}>Send</button>
    </div>
  )
}

#Common patterns

  • Reactivity: Solid stores are fine-grained — access chat.messages directly inside JSX, not destructured.
  • SSR: useChat is client-only. Wrap in <ClientOnly> for SolidStart SSR.
  • Cleanup: subscriptions tear down via onCleanup; no manual unsubscribe needed.

#Source

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.