Skip to content
Packages

AI Runtime & Agent Substrate

AI 运行时与智能体底座

A production AI domain with agent loops, tool protocols, RAG, local execution, provider metadata, and multimodal pipelines kept out of app code.

42 packages, 319 source files and 162 test files in packages/ai. · Source ↗ · Docs ↗

Agent workbench topology

One core loop coordinates model calls, context, tools, memory, execution, and media production.

  • @nebutra/agent-runtimedurable turns, tools, commands, hooks, subagents
  • @nebutra/knowledge-ragretrieval, chunking, local embeddings, content-store
  • @nebutra/mcptool catalog and protocol bridge
  • @nebutra/reeltyped media graph and storyboard execution
  • @nebutra/sandbox-runtimeexecution providers behind one router
  • @nebutra/ai-providersmetadata only; runtime remains in agents

What it owns

  • @nebutra/agents as the canonical model execution surface
  • RAG, code indexing, knowledge graph, content store, and tool registry
  • Image, video, audio, voice, sandbox, and browser automation pipelines

Where it stops

  • Apps consume stable package APIs; they do not own provider routing.
  • Media workflows depend on injected adapters instead of hardcoded vendors.

How we know it works

  • package-local tests for agents, knowledge-rag, reel, and agent-runtime
  • architecture tests for AI primitive ownership and runtime dependencies

In code

agents.ts
1import { generateText, streamText, embed } from "@nebutra/agents";
2
3// One unified surface — providers swap via env / config.
4const { text } = await generateText({
5  model: "anthropic/claude-sonnet-5",
6  prompt: "Summarize this support ticket in 3 bullets.",
7  system: "You are a senior support engineer.",
8});
9
10const { embedding } = await embed({
11  model: "openai/text-embedding-3-large",
12  value: ticket.body,
13});

Packages

42 packages in packages/ai.

Three.js · GLTF 2.0
Mesh ingest
.obj.fbx.usd
Decimate
18k → 4k tris
x
Pack GLB
2.4 MB
cinema · atelier-canvas pipeline
3d-pipeline

3D asset generation + render — text-to-mesh + USD export + Three.js preview, with GPU-pool routing on the backend.

agent-runtime

Lower-level agent execution — message reducer, tool invocation, streaming state machine. The kernel @nebutra/agents wraps.

@nebutra/agents · unified surface
  • generateText({ model, prompt }) → { text }
  • streamText({ model, prompt }) → AsyncIterable
  • embed({ model, value }) → { embedding }
OpenAIAnthropicGoogleDeepSeek
provider-agnostic
agents

Multi-step agent runtime — Vercel AI SDK foundation, tool registry, streaming UI, MCP integration. The skeleton for every Sailor agentic feature.

5 primitives · 0 deps
Message={ role, content[] }
Tool={ name, params, execute }
StreamEvent="delta" | "tool_call" | ...
Actor={ id, type, tenantId }
consumed by @nebutra/agents
ai-primitives

Shared helpers used across all AI packages — token counting, prompt templating, stream-parser, retry-with-backoff. No provider dependency.

Provider Matrix
47 providers · live catalog
ModelContext$/1M tok
claude-sonnet-5.51M$2
gpt-5.6-luna1.1M$0.2
gemini-3.1-pro-preview1M$2
deepseek-flash1M$0.15
metadata only · runtime via @nebutra/agents
ai-providers

Provider metadata — pricing per million tokens, context windows, modalities. Drives model selection and cost estimates.

ai-brushes
canvas
·background
·brushwork
·effects
layers · masks · ai-brushes
atelier-canvas

Infinite design canvas — multiplayer cursors, layer panel, frame export. The drawing surface every atelier play renders into.

audio pipeline
transcribe
denoise
master
Whisper · RNNoise · FFmpeg
audio-pipeline

Audio processing chain — voice clone, denoise, transcribe, summarize. Streams through one async iterator per stage.

brand-genesis · aigenerated · 12s
  • p1
  • p2
  • p3
  • p4
  • p5
Aria Display+Inter Sans
  • Make work flow
  • Calm power

AI brand kit · 5 variations

brand-genesis

Brand creation flow — pick palette, type pair, motion preset; ships a synced @nebutra/brand override and a Figma preview link.

browser-control

Headless browser drive for agents — Vercel Agent Browser primary, Playwright fallback. Screenshot, click, type, evaluate.

intro ·b-roll ·interview ·cuts ·titles ·outro
2:14 / 4:32
Remotion · 4K · HDR
48 transitions · grading LUT
cinema

Atelier cinema mode — distraction-free fullscreen with timed scene playback, perfect for demoing a play or rehearsing a pitch.

sandbox.runCommand
Node22 · isolate · egress-blocked
const total = orders
  .filter(o => o.status === 'paid')
  .reduce((s, o) => s + o.amount, 0)
→ 12,840
executed in 47ms
Vercel Sandbox · safe untrusted
code-execution

Sandboxed code execution for agents — JS / Python / shell — short-lived containers, network-isolated, capability-gated by @nebutra/permissions.

  • packages/iam/auth/src/handler.ts:420.91
    export async function handler(req: Request)
    x
  • packages/iam/auth/src/middleware.ts:180.84
    const auth = await handler.verify(token)
    x
  • backends/gateway/src/auth.ts:70.78
    import { handler } from "@nebutra/auth"
    x
12,401 symbols · tree-sitter · 84ms
code-index

Repository code index for agents — symbol graph, embedding, file watcher. Lets the agent answer "where is X defined" without grep'ing.

cofounder match2,401 candidates
92% compatibility match
x
EngineeringSalesNYCYC alum
mutual interest · double-opt-in
cofounder-match

Skill-and-stage cofounder matching — answers a small intake, surfaces ranked candidates with shared interest and warm intros.

content_store·12,401 chunks
pricing-2025.md48 chunks
embedded
eu-gdpr.pdf127 chunks
embedded
q4-revenue.csv12 chunks
embedded
1,536-dim embeddings·tenant-scoped
content-store

Headless CMS adapter — Sanity / Strapi / Notion behind one ContentEntry'<T>' read API. Drives marketing pages and product copy.

document pipeline
PDF· upload
OCR· 47p
chunk· 248
embed
unstructured.io · multi-format
document-pipeline

Ingestion for PDF / docx / markdown — chunk, table-aware extract, embed, route to @nebutra/knowledge-base. OCR fallback for image-only pages.

Guardrails active
4 layers
Content moderation
0 blocked today
PII redaction
12 redacted today
Prompt injection detect
2 caught today
Rate limit per actor
normal
OpenAI Moderation · regex + LLM gate
ecosystem-safety

Pre-flight safety check — license sweep, dep-vuln audit, prohibited-content scan. Surfaces blockers before a play ships to marketplace.

event-log

General-purpose event log primitive — append, query, time-window aggregate. Sits below audit, analytics, and trace-store as their record.

policy.execution · 4 rules
task.kind === "render"Vercel Sandbox
task.duration > 5minAWS Lambda
task.tenant === "internal"local-runner
defaultVercel Sandbox
evaluated per-task · 3ms p50
execution-policy

Policy rules that route agent tasks to compute backends — render → Vercel Sandbox, long → Lambda, internal → local-runner.

Lessons archive · 12 projects
  • idea·"Acme SaaS"2024-08no PMF
  • idea·"VR Yoga"2024-12pivot needed
  • idea·"AI Chef"2025-02competitor moved fast
private journal · postmortem template
founder-cemetery

Failed-startup memorial — anonymized post-mortems with cause tags. Read-only catalog, source of the recurring failure pattern dashboard.

247,401 / 1,000,000 tokens· 24.7%
claude-sonnet-5
system4%
history6%
rag-context3%
prompt1%
buffer1%
truncation via reciprocal rank
12ms
generation-context

Token-budgeted context window manager — system prompt, RAG, user history, scratchpad. Picks what to drop when the window fills.

idea-plaza·1,247 ideas
+12 today
AI-native dataroom
8412
LLM observability
428
Edge embeddings store
284
public·double-opt-in collab
idea-plaza

Public idea board — submit, upvote, comment; the seed pool atelier plays draw from when a founder asks "what should I build".

Original
1024px
4.8 MB
Optimized
1024px WebP
240 KB
ResizeUpscaleCompress
Sharp · Vercel Image · WebP/AVIF
image-pipeline

Image generation + transform pipeline — provider-routed, watermark + safety filter, cached output, per-tenant quota.

knowledge-base

Document store + indexer for RAG. Watches sources (S3, Notion, GitHub), schedules re-embed, surfaces freshness in the agent answer.

graph
247 entities · 1,847 edges
Acme Corp
Project Atlas
OpenAI
Mira
owns
depends_on
employs
Cypher-compatible · typed edges
knowledge-graph

Entity + relationship store on top of @nebutra/graph-model. Lets agents traverse "customer → invoice → product" without a SQL detour.

knowledge-rag

Retrieval-augmented generation pipeline — chunk, embed, store, retrieve, rerank — pluggable per vector store.

landing-builder

Block-based landing page builder — drag pre-styled sections, edit copy in place, publish to a subdomain with one click.

offline
local · sentence-transformers/all-MiniLM-L6-v2
12ms per chunk·CPU only
zero egress·privacy preserved
local-embedding

On-device embedding via ONNX / WebGPU. Avoids the round-trip when the embed is short, private, or rate-limited at the provider.

mcp.tool_catalog · 47 tools
  • search_docs · query corpus247ms
  • read_file · fs.read at path12ms
  • run_query · SQL on tenant DB84ms
  • fetch_url · HTTP get URL412ms
MCP 1.0 · stdio · streamable
mcp

Model Context Protocol server primitives — register tools, expose resources, stream subscriptions. Run inside Sailor or stand-alone.

Q4 enterprise outbound
Active · 47 prospects
Day 1: intro
Day 3: case study
Day 7: demo offer
Day 14: bump
Sent · 247/Opens · 38%/Replies · 12%
Apollo · LinkedIn · email
outreach-engine

Cold-outreach orchestrator — list dedupe, persona-aware drafting, send via SES/Resend, reply detection. Routes hot replies back into @nebutra/agents.

playbook·onboarding-saas-v2·v1.4.2
setup-database·12s
import-team·4s
seed-content·8s (running)
notify-adminpending
hot-reload·sandbox-safelive
x
play-loader

Hot-reload loader for atelier plays — sandboxed iframe, message bridge, persistence on save.

marketplace · 1,247 playbooks
  • Creem Onboarding
    2.4k★ 4.8
  • Slack Recap
    1.2k★ 4.7
  • Notion Sync
    847★ 4.6
  • Linear Triage
    412★ 4.5
community-curated · MIT licensed
play-marketplace

Marketplace shell for shareable atelier plays — discovery, ratings, install, attribution.

Imagehero3s · fade
VOaria voice8s
Captionskineticauto-sync
Remotion9:1660fps
reel

Short-form vertical video primitive — captures atelier moments, auto-captions via TTS pipeline, publishes to social channels.

sandbox.create
isolate
sandbox · node22 · 256MB · isolated
· network: egress-only· filesystem: tmpfs· timeout: 30s
Run
Last exec87ms
exit 0
Vercel Sandbox · safe untrusted
sandbox-runtime

Vercel Sandbox + Lambda + local runner adapter under one execute() call. Picks the runner from a policy rule list.

support-deflector

Inline AI support layer — answers from your docs + past tickets before a human is needed. Hands off cleanly with full transcript.

time-machine·247 versions·replay any
5m
18m
1h
4h
1d
3d
1w
2w
active · 4h ago
point-in-time recovery · CRDT-safe
time-machine

Project history scrubber — snapshot every save, branch a play from any past frame, diff two snapshots side by side.

tool-registry·247 tools·12 categories
search_docsv1.4.2retrieval
send_emailv2.1.0comms
query_dbv1.8.1data
run_shellv0.9.4system
versioned · audited · per-tenant ACL
tool-registry

Runtime tool catalog — schemas, descriptions, safety levels. Hot-swap tools between agents without re-deploying.

~3 min processing · GPU
Source
1080p.mp4
Transcode
H.264 + AV1
Thumbnails
12 frames
HLS
240p..1080p
FFmpeg · CDN-ready · multi-bitrate
video-pipeline

Long-form video pipeline — split, caption, b-roll, render. Distributes the long stages to backends/python via queue.

LIVE · 0:42
connected
Aria voice<120ms latency
OpenAI Realtime · WebRTC · push-to-talk
voice-realtime

Realtime voice loop — input ASR, model stream, output TTS — sub-300ms end-to-end. Bridges OpenAI Realtime + Deepgram + ElevenLabs.