Docs

Defining agents

defineAgent(id, config) creates an agent. The id is its stable identifier (used in routes and threads) and must be unique across all agents. The call validates the config and returns an AgentDefinition you export from agents/.

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

export const invoiceAssistant = defineAgent("invoice-assistant", {
  name: "Invoice Assistant",
  description: "Tracks outstanding invoices, overdue accounts, and payment follow-ups.",
  model: gateway("openai/gpt-5.5"),
  reasoning: "medium",
  instructions: [
    "You are this project's invoicing assistant.",
    "Focus on invoices, balances, due dates, and reminder status.",
    "Never claim a reminder was sent unless the data shows it.",
  ].join("\n"),
  providerOptions: {
    openai: { reasoningSummary: "detailed" },
  },
})

Config

FieldTypeRequiredDescription
namestringYesDisplay name shown in catalogs and pickers.
modelLanguageModelV4YesAn AI SDK model instance (see below).
instructionsstringYesThe system prompt.
descriptionstringNoShort summary for catalogs.
reasoningreasoning levelNoprovider-default, none, minimal, low, medium, high, or xhigh.
providerOptionsprovider-keyed objectNoPer-provider passthrough, e.g. { openai: { ... } }.
groupsGroupDefinition[]NoGate who can use the agent and what it can reach. See Authorization.
loop{ stopWhen?: { maxSteps?: number } }NoStep cap per turn. Defaults to 25.

The model

model is an AI SDK LanguageModelV4 instance, not a string. The simplest source is the ai gateway; any provider that returns a LanguageModelV4 works.

TS
import { gateway } from "ai"

model: gateway("deepseek/deepseek-v4-flash")
model: gateway("openai/gpt-5.5")

Instructions vs Agent Skills

Keep instructions short and always relevant: the agent role, hard behavioral rules, and domain boundaries. Put larger company standards, examples, templates, and repeatable procedures in Agent Skills instead:

TXT
skills/acme-writing-style/SKILL.md
skills/acme-writing-style/references/examples.md

Project skills are installed into each run sandbox under $SIXB_SKILLS_DIR. The worker advertises only each skill's name and description up front, and the agent reads the full SKILL.md when the skill is relevant.

Loop

An agent runs a tool-calling loop: the model produces output, may call tools, sees the results, and continues until it stops or hits loop.stopWhen.maxSteps (default 25).

TS
loop: { stopWhen: { maxSteps: 12 } }

Discovery

createSixb() discovers exported agents from agents/ automatically. To register one explicitly, pass it as well — the lists merge, and duplicate ids are rejected:

TS
import { createSixb } from "@sixb/core"
import { businessAnalyst } from "./agents/business-analyst"

export const sixb = createSixb({
  id: "acme-corp",
  agents: [businessAnalyst], // merged with discovered agents/ exports
  // ...
})

Search docs

Search the documentation