● pkg/bb — a Go library, not a service

An agent that disguises
itself as a model.

big-brain wraps LLMs behind standard OpenAI- and Anthropic-compatible APIs. From the outside it's just another model endpoint — every chat UI, IDE plugin, and SDK you already have is a free client. Inside, a request runs through a brain: a tree of flows and agents with memory, tools, routing, and durable execution.

main.go
package main

import (
    "context"
    "os"
    "os/signal"

    "github.com/force1267/big-brain/pkg/bb"
)

func main() {
    ctx, stop := signal.NotifyContext(context.Background(), os.Interrupt)
    defer stop()

    bb.WithModel(bb.NewModel().WithName("gpt-4o-mini")).WithTag("chat")

    // One agent, one flow: ask the model and reply.
    assistant := bb.NewAgent().
        WithModel(bb.NewModel("chat")).
        WithRole(bb.Role("You are Jarvis: warm, brief, lightly witty."))
    brain := bb.NewFlow().WithAgent(assistant)

    bb.Serve(ctx, brain) // OpenAI + Anthropic at :8080
}
$ curl localhost:8080/v1/chat/completions -d '{"messages":[...]}'
What makes it not just a model

A model call is one line. A brain is a system.

Hand-write the model calls, the prompt templates, the routing, and you get exactly what the reference brains do. The engine earns its place by owning the parts you'd get wrong or forget.

Memory

The brain remembers across turns and decides what to keep — a map, a KV (bb.MemStore/bb.FileStore), or a vector DB — woven into the persona, not bolted on as a transcript.

Initiative

A brain keeps acting past the reply. Chain flows after bb.Respond, fire on a cron with bb.Every, or react to a webhook — durably, so a crash resumes instead of restarting.

Hands

Tools are just Go. Bind a handler with bb.OnCall and let Resolve run the loop, or forward a caller's own tools through untouched — nothing is ever executed implicitly.

Character

Persona, tone, and routing logic live in your agents' roles and handlers — plain Go, not a prompt-template DSL you have to learn.

Composition & concurrency

Select routes to one capability; All/One/Group run several concurrently; Checkpoint/Wait coordinate agents. Typed Schema/Extract give you structured output for free.

Durable & observable

Opt a named flow into .Durable() and a crashed run resumes from its last checkpoint. Every flow start/end, select, and token spent is a trace event at /v1/diagnostics/trace — for free.

How it works

One endpoint. A tree underneath.

A flow runs one or more agents over a chat and hands the result to the next flow. Flows compose — a Select, an All/One/Group, or a Next chain — is itself a flow. There is no graph DSL and no node vocabulary to learn: if is if.

A client request hits big-brain's OpenAI/Anthropic-compatible endpoint, which runs a router flow that Selects a capability agent (talk, memory, or house/tools), then bb.Respond delivers the reply while further flows keep running as initiative, backed by a durable checkpoint store.
Why not just a proxy

Same wire protocol. A different thing behind it.

bb speaks the exact API your tools already expect — but the honesty stops at the wire. The usage block it reports is the real sum of every upstream call the brain made, not a mirror of your prompt.

CapabilityRaw model proxyAgent orchestration frameworkbig-brain
Drop-in for existing OpenAI/Anthropic clientsusually not
Memory across turns, author-controlled
Durable, resumable executionrare
Control flow is plain Go, no graph DSLn/ausually a DSL/YAML
Concurrency primitives (Select/All/One/Group)varies
Faithful passthrough of caller's own toolsoften reinterpreted
Zero-config observability of real spendbolt-on
Embeddable library you own, not a hosted serviceoften a platform
See it run

Two reference brains, both pkg/bb-only

Exactly as an external author would write them — no internal shortcuts.

cmd/jarvis-demo

jarvis-demo

A runnable smart-home assistant over a self-contained dummy world (sensors, devices, a notification sink). Runs with no API key.

  • Keyword router into talk / remember / recall / house / briefing
  • Memory kept across turns
  • Concurrent sensor reads via Group
  • A Notify flow that fires after the reply
  • Durable execution + a jsonl trace
cmd/marvis-demo

marvis-demo

The API "goal post" — the program the bb API was designed to make read well.

  • An intent router classifies each message with a model + typed schema
  • Select dispatches to the matching capability
  • Annotated line by line in the authoring guide

Read the docs, or hand them to your agent

A full authoring guide, organized by concept, generated statically — plus a single markdown file built for LLM agents that want to write a brain for you.