Agents

An agent is a conversational assistant you define alongside your ontology. It calls a language model, selected worker tools, sandboxed read and bash, and an authorized Sixb API.

You define an agent declaratively and export it from agents/; createSixb() discovers it. A worker runs it, and clients drive it over HTTP and a websocket.

Define an agent

Put each definition in agents/ and export it.

TS
// agents/business-analyst.ts
import { defineAgent } from "@sixb/core"
import { gateway } from "ai"

export const businessAnalyst = defineAgent("business-analyst", {
  name: "Business Analyst",
  description: "Investigates customers, invoices, projects, and follow-ups.",
  model: gateway("deepseek/deepseek-v4-flash"),
  instructions: [
    "You are the business operations analyst for this project.",
    "Ground answers in the data available through Sixb, and say when data is insufficient.",
    "Prefer concise summaries with clear next actions.",
  ].join("\n"),
})

See Defining agents for every config field.

Core concepts

ConceptWhat it is
DefinitionThe agent you write with defineAgent — model, instructions, groups, selected tools, and loop limits.
ThreadOne conversation with an agent, owned by a principal.
RunOne turn. Posting a user message triggers a run.
MessageA system, user, or assistant message made of text, reasoning, step-start, and tool-call parts.
ToolsExplicitly selected worker tools plus built-in read and bash in a sandbox.

Run an agent

Defining an agent needs nothing extra. Running one needs two things:

  • The agent-worker process. bun sixb dev runs it for you; in production run it like the other workers.
  • A sandbox factorycreateSixb({ sandboxes }). The worker won't start without one, because the read and bash tools run in a sandbox.
TS
import { createSixb } from "@sixb/core"
import { SmolvmSandboxFactory } from "@sixb/sandboxes-smolvm"

export const sixb = createSixb({
  id: "acme-corp",
  // ...storage, broker, queues
  sandboxes: new SmolvmSandboxFactory(),
})

For each turn, the worker offers that agent's selected tools plus read and bash, executes them in their respective boundaries, and persists the reply. See Running and streaming.

Search docs

Search the documentation