Skip to content

Full Small Agent App

Combine tools, material binding, durable facts, attached streams, ops, and deployment into one small app shape.

A reference architecture for a weather chatbot that can answer synchronously, stream long answers, cancel background work, expose ops views, and deploy as a Cloudflare Worker.

  1. Keep the app graph small:

    Worker fetch
    -> AgentDO facade
    -> tools: lookup_weather
    -> llms.default: openAIChat(endpointRef, credentialRef)
    -> streams: tutorial.streaming_chatbot
    -> triggers: tutorial.cancelable
  2. Keep each data kind on its own substrate:

    ledger event durable truth
    projection derived read model
    attached frame live transport
    material ref symbolic provider handle
    ops response read-only projection
    deploy ref symbolic deploy proof
  3. Wire HTTP routes:

    POST /turn -> AgentDO.submit
    GET /events -> AgentDO.streamEvents
    WS /chat -> AgentDO.attachStream(mode: bidi)
    GET /__ops/api/* -> mountOpsApi
  4. Run local proof gates before any live provider smoke:

    Terminal window
    bunx tsc -p tsconfig.json
    bun test
    bun build src/worker.ts --target=browser --outdir dist --external cloudflare:workers
  5. Add one live smoke at a time. First prove provider material is set, then LLM, then deploy. Never print secret values.

The app has no source workspace dependency and no hidden state table:

@agent-os/* imports are package entrypoints
provider material appears only as refs in ledger-visible payloads
stream frames are not ledger facts
ops views are read-only
deployment facts are symbolic

Review the whole ladder with tutorial IA / consistency reviewer.