Skip to content

confused-aiBuild agents, teams, and workflows in TypeScript

Start with one useful agent. Add tools, sessions, retrieval, orchestration, serving, and production controls without changing frameworks.

One quick example โ€‹

ts
import { agent, tool } from 'confused-ai';
import { z } from 'zod/v3';

const getQuote = tool({
  name: 'get_quote',
  description: 'Return a stock quote for a ticker symbol.',
  parameters: z.object({ symbol: z.string() }),
  execute: async ({ symbol }) => ({ symbol, price: 927.5, changePct: 1.4 }),
});

const financeAgent = agent({
  name: 'finance-agent',
  model: 'gpt-4o-mini',
  instructions: 'Use the tool to answer market questions in one sentence.',
  tools: [getQuote],
});

const result = await financeAgent.run("What's NVDA trading at today?");
console.log(result.text);

Single install

One package, clear public subpaths, no consumer-facing monorepo imports

Layered growth

Start small and add runtime features in the order real systems need them

Runtime ready

Serve, schedule, observe, and harden agents without leaving the framework

Coordination built in

Move from one agent to workflows, supervisors, and teams when the task demands it

Build in layers

The framework is designed around the order teams actually adopt it.

The cleanest path is to prove one agent first, then add only the missing layer: tools for live access, sessions for continuity, retrieval for grounded answers, serving for delivery, orchestration for coordination, and production controls for safe operation.

AuthorDefine the agent, its instructions, its model, and the minimum capabilities it needs.
ConnectAdd tools, sessions, retrieval, memory, and storage when the system needs real context or continuity.
OperateServe over HTTP, run scheduled jobs, observe behavior, and harden the runtime when the agent becomes a real system.

What the package gives you

author agents and typed contractsadd tools and MCP-based integrationspersist sessions, memory, and application stateretrieve context from indexed documentsserve agents over HTTP or schedule them as jobscoordinate specialists with teams and supervisorstrace runs, evaluate quality, and apply runtime controls

Three primitives

Agent

The smallest useful unit. Use it when one model-backed worker can solve the task with clear instructions and explicit capabilities.

Team

Use teams when the work benefits from specialists, routing, delegation, handoffs, or explicit supervisory control.

Workflow

Use workflows when the sequence, branching, or structure of execution matters as much as the text the model returns.

Start here

How to use the docs โ€‹

Read the docs in this order if you are new to the framework:

  1. guide/introduction for the mental model.
  2. guide/getting-started for the first implementation path.
  3. examples/ for runnable patterns.
  4. topic guides when a specific capability becomes necessary.
  5. api/ when you want a compact map of the public surfaces.

Why confused-ai โ€‹

  • One package and clear public subpaths instead of consumer-facing monorepo imports.
  • Plain TypeScript authoring instead of a separate configuration DSL.
  • A clean path from one agent to served, observable, orchestrated systems.
  • Sessions, retrieval, evaluation, reasoning, approvals, and runtime controls available when you need them.

Core capabilities โ€‹

CapabilityWhat it gives you
Agentsmodel, instructions, tools, and runtime behavior in one unit
Teams and workflowsspecialists, supervisors, routing, and structured execution
Toolsexplicit system boundaries for live data and side effects
Sessions and memorycontinuity and retained facts
Knowledge and storagesource-backed answers and durable state
Serve and scheduleHTTP delivery and timed execution
Observe and evaluatetraces, metrics, and regression checks
Guard and approvevalidation, policies, and human checkpoints

Public package rule โ€‹

All public docs should describe the framework as one package: confused-ai, plus focused public subpaths when a capability has its own runtime surface. Internal workspace packages are not the consumer-facing API story.

Released under the MIT License.