Skip to content
Night Owls.dev
Jump to a page
Documentation

Night Owls reference

A TypeScript framework for building multi-agent swarms. Dependencies flow one way, core to adapters to UI to apps, and the engine stays wrapped behind a stable public API. Below: the long-form guides, then the full module index.

01

Guides

Long-form walkthroughs for the concepts that span more than one package.

Getting started

Install the framework, define your first agent, and run it locally on just a model key. Then wire model, storage, and runner adapters.

Read the guide →

Choosing an engine: native full-governance vs. adapter, and where durability comes from

The run loop is swappable, and the choice is about WHERE the loop runs, not a feature checklist. A native engine runs in your process and reuses the full governance plane; an adapter fronts a remote runtime you don't own, so cost caps, the tool gate, and the pre-generation veto can't reach it — by architecture, not maturity. Durability is a separate axis: the first-class governed-AND-durable path is @nightowlsdev/runner-background with a native engine, not a remote adapter.

Read the guide →

Adopt a pre-built agent

Pull a researcher, marketer, designer, writer, or agent-builder into your swarm: curated skill import, runtime injection, tier config, and approvals, the full journey once.

Read the guide →

The SEO crew: read-only analyst, metered researcher

Wire the pre-built SEO crew over the Google Search Console + GA4 connectors: why the read-only analyst and the researcher are two agents, the fail-closed data-tool admission, the five curated skills, metered paid providers, and the three measurement-honesty invariants (anonymised-query incompleteness, quota-as-stop, free-first).

Read the guide →

Capability bundles

Package agents, their rules, workflows, and connector grants into one reusable, versioned unit. Compose, publish, apply, and upgrade without clobbering local tuning.

Read the guide →

The Agent Studio (experimental)

Mount the experimental <AgentStudio> to manage agent config from the database: roster, full editor, tool and skill grants, audiences, and version history with CAS-safe publish and rollback. Authorization stays server-side; the component is untrusted UI.

Read the guide →

The AI Studio

Compose agents, skills, knowledge, tools, and the graph workbench into one operator console with a section registry. A section you don't wire never appears, a section nobody opens costs nothing, and readOnly can only ever narrow what the server already permits.

Read the guide →

Ship a studio section with your package

A capability package can bring its own AI Studio section: client, discovery, copy, and UI in one object a host registers in a line. Declare the tier your routes enforce, gate them on the same admin plane the console uses, and keep the plugin's identity stable so the section never remounts under the operator.

Read the guide →

The skill store

Browse skill providers behind a policy floor, check for updates without installing them, and import third-party instruction text through a server-issued preview token rather than caller assertions.

Read the guide →

Knowledge and tools

Enumerate and delete knowledge sources, ask who holds a capability before revoking it, manage integration connections, and register outbound MCP servers over an HTTP-only table.

Read the guide →

Audience-scoped agents

Scope which agents each caller can see and address. AuthContext.audiences is intersected with each agent's audiences, fail-closed across the roster, addressing, resume, and delegation.

Read the guide →

Host-facing agent-config surface

List grantable capabilities, read and validate an agent, and apply rules, workflow, memory, and grants per agent over default-deny admin routes with CAS-safe publish. The server-side surface behind the Agent Studio.

Read the guide →

Approval modes and the tool risk vector

Annotate a tool with six tri-state risk axes, get one computed danger level, and let the deployment pick manual, auto, or permissive. Composition narrows only, unknown stays unsafe, and a deployment that sets nothing behaves byte-identically.

Read the guide →

Model providers and model discovery

Register model providers, list what each one actually exposes, write provider-qualified allow-list entries, and price every run at the provider that ran it. Wire no registry and everything degrades to the shipped free-text field.

Read the guide →

Per-conversation task lists

A persisted checklist every agent in a conversation reads as the shared plan and the user can edit at the same time. Compare-and-swap under a lock, server-assigned ids, a restore only a human can reach, and a deterministic nudge when items are still open.

Read the guide →

The document ingestion pipeline

Chunk, admit, and embed a whole document into the knowledge plane: a host extraction contract that refuses an empty parse, per-batch commits behind an atomic finalize so a partial ingest is never searchable, and a chunk-plan fingerprint that makes resume safe rather than optimistic. Builds on the FR-055 scope axis and FR-051 admission.

Read the guide →

Attachments: let an agent see the file

A user attaches a screenshot or a PDF and the agent actually reads it. Refs cross the wire, never bytes or URLs; you own the bucket and the resolver. Includes what each engine can carry, and the v1 trades — approval and attachments are mutually exclusive within one turn on two of the three engines.

Read the guide →

Sub-org scopes: departments inside one org

orgScope partitions knowledge, skills, runs and threads by department inside a single org, without touching the hard org_id boundary. Host-resolved, never a tool argument; reads see their own scope and its ancestors, writes land at exactly one scope, and undefined stays unrestricted so an existing deployment sees no change.

Read the guide →

Issue intake: user-reported and agent-filed

One report row filed from two ends: a signed-in user through the embeddable <IssueIntake> form, and an agent through report_issue. Intake is authenticated-only — every report carries a real principal. Attribution is derived from an identity the request body cannot reach, free text is redacted on the way in, and a scrub-before-hash fingerprint groups repeats.

Read the guide →

The durable background runner

Run a swarm turn in durable infrastructure so an ask-suspended run parks with ZERO compute, survives process death, and resumes later. One vendor-agnostic DurableBackend seam (enqueueRun / createWaitpoint / completeWaitpoint) over three backends — Trigger.dev v4 (GA, durable tasks + wait tokens, not chat.agent), Vercel Workflow (the in-package swarmWorkflow subpath), and in-memory (dev, not durable across a restart). Plus the stuck-run reaper that reports the count REAPED not selected, and per-suspension waitpoint integrity so a re-suspended followup can't resume with a stale token.

Read the guide →

The recurrence plane

Register a schedule and the plane fans it out across tenants and enqueues an agent run at-most-once per occurrence, from one authenticated cron route. The claim is a row in an append-only ledger (schedule_occurrences, migration 0031), the staleness deadline is persisted, and a suspended HITL run still blocks its own successor. Wire no schedules and the deployment is byte-identical.

Read the guide →

Client tools: let an agent act in the browser

Client tools are tools the model calls but your browser runs: frame a camera, read the selection, upload a file, apply to the live scene. The FR-002 seam (defineClientTool, useClientTools, swarm.client_action) shipped earlier; as of @nightowlsdev/react@2.8.0 you register them with one prop on <SwarmChat>, no raw-hook rebuild.

Read the guide →

The metric series store

A separate, opt-in observation plane — (orgId, orgScope, metric, at, dims) → value — with calendar bucketing and a fully-pinned period-over-period compare(). Its own package, its own pg Pool, its own metrics_000N migration, server-only; deliberately not a StorageAdapter field, so a swarm that never installs it is byte-identical.

Read the guide →

Audit every LLM call: what the framework measures, and how to record it (opt-in)

Every generation a native engine runs emits a per-call swarm.usage event (agent slug, model id, token breakdown, priced cost, a stable generationId) and every segment seals one swarm.turn_usage. You wire nothing and pay nothing; add an onEvent observer, a persisted events table, the ready-made supabaseUsageSink, the metric-series store, or a telemetry exporter, and you have an on-demand audit trail of what every agent did, when, and at what cost — down to the individual model call. Includes the honest gaps: adapter remote loops, metered-vs-billed cost, unpriced models.

Read the guide →

The task-manager plane

A separate, opt-in plane for WORK — human- and agent-assigned tasks — and for running an agent against a task unattended: a resume-safe cumulative cost ceiling (the turn_usage observer, not RunInput.budget), a single-winner atomic start, and a prompt-injection fence for mirrored tasks. Its own package, its own tasks_000N migration, server-only RLS; plus mergeQueue and the admin board whose AgentExecutionPolicy editor is admin-only, enforced server-side.

Read the guide →

The pipeline plane

A separate, opt-in plane for data-driven, fan-out-capable structured extraction — a DAG stored as data whose stages can be run by a NAMED, GOVERNED swarm agent (cost cap + tool gate + rules + metering), not just a raw LLM prompt. Publish-time validation of referent existence AND acyclicity (the gap defineWorkflow's validator lacks), a real cross-stage budget ceiling, its own pipeline_0001_* migration, server-only; plus the admin routes behind adminRouteGate("pipelines") and the pipelinesPlugin Studio section.

Read the guide →
02

Every package, documented

Grouped by category. Each page has its install command, key exports, and a usage snippet.

Engine

8 modules

@nightowlsdev/core

Mastra

The engine core: define agents, skills, tools and swarms, then run them, the @mastra-backed brain behind every Night Owls host.

pnpm add @nightowlsdev/core

@nightowlsdev/hooks

The @mastra-free decision-hook substrate: the plain types and dispatcher the platform's billing, approval, and mutation gates hang off.

pnpm add @nightowlsdev/hooks

@nightowlsdev/engine-mastra

The default engine as a named package, a mastraEngine() factory + MastraEngine re-export; installing it changes imports, not behavior.

pnpm add @nightowlsdev/engine-mastra

@nightowlsdev/engine-ai-sdk

The second native engine, a governed ai@^7 streamText loop. Single-agent v1 (no delegation/workflows/semantic recall yet), full HITL + governance, tier-3 events.

pnpm add @nightowlsdev/engine-ai-sdk

@nightowlsdev/engine-a2a

The A2A (Agent2Agent) protocol adapter engine, renders any A2A v0.3-wire endpoint (Bedrock AgentCore, Azure AI Foundry/Copilot Studio, Google ADK/Vertex Agent Engine) as a single Night Owls agent. Adapter tier: reduced governance, tier-1 events (opaque remote, no tool visibility).

pnpm add @nightowlsdev/engine-a2a

@nightowlsdev/engine-openai-agents

The third native engine, a governed @openai/agents run() loop with full governance (fail-closed tool gate, cost caps, secrets), native handoffs/guardrails. Single-agent v1 (multi-agent handoffs planned v1.1).

pnpm add @nightowlsdev/engine-openai-agents

@nightowlsdev/engine-trigger-chat

An adapter for ONE specific case: you already run a Trigger.dev `chat.agent` Session on your own account and want to front it as a Night Owls agent. It's an adapter (reduced governance, tier-2 events), and experimental (Trigger's `chat.agent` surface only just GA'd — verify it's reachable in your account first). For the usual durable + governed run, use `@nightowlsdev/runner-background` with a native engine instead — that's the first-class durable path.

pnpm add @nightowlsdev/engine-trigger-chat

@nightowlsdev/engine-eve

The Vercel Eve protocol adapter engine, renders a running Eve app's NDJSON session as a single Night Owls agent. Adapter tier: reduced governance, tier-2 events (tool calls + usage visible, no delegation); durable park/resume on Vercel Workflows.

pnpm add @nightowlsdev/engine-eve

Adapter/Storage

7 modules

@nightowlsdev/storage-local

Mastra

A local LibSQL-backed Mastra snapshot store for the CLI bootstrap runtime, run a swarm on just a model key, before Supabase.

pnpm add @nightowlsdev/storage-local

@nightowlsdev/storage-supabase

Mastra

A Supabase/Postgres-backed StorageAdapter for Night Owls, agents, runs, events, messages, a Realtime event bus, a versioned agent repo, and a durable Mastra store.

pnpm add @nightowlsdev/storage-supabase

@nightowlsdev/knowledge

An optional pgvector document knowledge base, RAG over arbitrary documents (guides, brand voice, reference docs), plus a ready tenant-scoped `search_knowledge` tool.

pnpm add @nightowlsdev/knowledge

@nightowlsdev/graph

A bi-temporal, provenance-anchored knowledge graph plane, push any source in and get resolved entities and relations that remember when a fact was true, when you believed it, and who told you.

pnpm add @nightowlsdev/graph

@nightowlsdev/metrics

A dimensionless, org-scoped metric-series store, `(orgId, orgScope, metric, at, dims) → value` with calendar bucketing and a fully-pinned period-over-period `compare()`, the honest home for numbers that change over time.

pnpm add @nightowlsdev/metrics

@nightowlsdev/tasks

A separate, opt-in task-manager plane — an org- and scope-scoped board of human- and agent-assigned WORK — plus the guardrails to run an agent against a task unattended: a resume-safe cumulative cost ceiling, a single-winner start, and a prompt-injection fence.

pnpm add @nightowlsdev/tasks

@nightowlsdev/pipeline

A separate, opt-in pipeline plane — a data-driven, fan-out-capable structured-extraction DAG whose stages can be executed by a NAMED, GOVERNED swarm agent (cost cap + tool gate + rules + metering), not just a raw LLM prompt.

pnpm add @nightowlsdev/pipeline

Pre-built agents

8 modules

@nightowlsdev/agent-kit

The shared foundation for the pre-built agent family: curated skills.sh manifests + governed batch import, fail-loud tool contracts, progressive-disclosure skill-library tools, and persisted-store lifecycle helpers.

pnpm add @nightowlsdev/agent-kit

@nightowlsdev/agent-builder

The meta-agent that knows the nightowls agent anatomy end to end: researches external skills, drafts + validates agents/bundles, and, behind a rule-enforced human-approval floor, imports skills and publishes definitions.

pnpm add @nightowlsdev/agent-builder

@nightowlsdev/agent-researcher

Deep research with a fail-loud tool contract: plans sub-questions with stop criteria, searches broad-then-narrow, triages sources primary-first, gap-checks, and delivers a cited synthesis.

pnpm add @nightowlsdev/agent-researcher

@nightowlsdev/agent-marketer

Product-in-market analysis, positioning + ICP, evidence-based competitor profiling, channels as prioritized bets, that asks for what it lacks instead of inventing it.

pnpm add @nightowlsdev/agent-marketer

@nightowlsdev/agent-designer

Design directions you choose from: proposes 2-3 named approaches via the ask tool, then applies the chosen one from an 18-skill curated design library read on demand, impeccable, ui-ux-pro-max, the taste-skill family.

pnpm add @nightowlsdev/agent-designer

@nightowlsdev/agent-writer

Content + copy craft, tool-less by design: brief-first, on-voice, channel-native, and fabrication-free (a missing fact becomes a [placeholder: …] the human fills, never a plausible invention).

pnpm add @nightowlsdev/agent-writer

@nightowlsdev/agent-seo

The pre-built SEO crew: a read-only, fail-closed `seo-analyst` and a competitor/SERP `seo-researcher` over the Google Search Console + GA4 connectors, with measurement honesty encoded, not just documented.

pnpm add @nightowlsdev/agent-seo

@nightowlsdev/agent-diagnostics

The pre-built diagnostics crew: a read-only run `inspector` and an approval-gated `bug-reporter`, so a stalled lane and a vague apology become which call failed, whether it recovered, and a report a developer can act on.

pnpm add @nightowlsdev/agent-diagnostics