Maniac Docs
Agents

Agents

Maniac app lifecycle, Agent spec fields, chat APIs, threads, budgets, and structured output.

Agents are the core unit of work in @maniac-ai/agents. Each agent is an Agent spec — instructions, model, tools, and optional middleware — executed by the runner via runAgent or registered on a Maniac app for persistent chat.

Topics

  • Maniac — app constructor, agent registration, shared defaults, memory stores
  • Agent spec — every field on Agent, from tools to step hooks
  • Running agentschat / chatStream, threads, budgets, structured output, pause/resume

Execution model

flowchart LR
  Spec["Agent spec"] --> Runner["Runner loop"]
  Model["Model.infer/stream"] --> Runner
  Tools["tools + toolsets"] --> Runner
  Runner --> Result["AgentResult"]

The runner alternates LM calls and tool execution until the model stops with text, a budget fires, a guardrail blocks, or an approval pauses the run. Every iteration emits trace events you can stream to UIs or export via OTelTracer.

On this page