Open-source TypeScript runtime for autonomous AI agents with cognitive memory, HEXACO personality, and emergent tool forging.
AgentOS is a TypeScript runtime for building AI agents that remember, adapt, and create new tools at runtime. Each agent is a Generalized Mind Instance (GMI) with its own personality, memory lifecycle, and behavioral adaptation loop.
| vs. | AgentOS differentiator |
|---|---|
| LangChain / LangGraph | Cognitive memory (8 neuroscience-backed mechanisms), HEXACO personality, runtime tool forging |
| Vercel AI SDK | Multi-agent teams (6 strategies), full RAG pipeline (7 vector backends), guardrails, voice/telephony |
| CrewAI / Mastra | Unified orchestration (workflow DAGs + agent graphs + goal-driven missions), personality-driven routing |
Full comparison: AgentOS vs LangGraph vs CrewAI vs Mastra
Define any scenario as JSON. Run it with AI commanders that have different HEXACO personalities. Same starting conditions, different decisions, divergent civilizations. Built on AgentOS.
npm install paracosmLive Demo · GitHub · npm · Landing Page
npm install @framers/agentos# Environment variables (recommended for production)
export OPENAI_API_KEY=sk-...
export ANTHROPIC_API_KEY=sk-ant-...
export GEMINI_API_KEY=AIza...
# Key rotation — comma-separated keys auto-rotate with quota detection
export OPENAI_API_KEY=sk-key1,sk-key2,sk-key3// Or pass apiKey inline (multi-tenant apps, tests, dynamic config)
await generateText({ provider: 'openai', apiKey: 'sk-...', prompt: '...' });All high-level functions accept apiKey and baseUrl parameters.
import { generateText } from '@framers/agentos';
// Auto-detect provider from env vars
const { text } = await generateText({
prompt: 'Explain TCP handshakes in 3 bullets.',
});
// Pin a provider
const { text: claude } = await generateText({
provider: 'anthropic',
prompt: 'Compare TCP and UDP.',
});16 providers. Provider fallback is opt-in via fallbackProviders:
import { buildFallbackChain, generateText } from '@framers/agentos';
const { text } = await generateText({
provider: 'anthropic',
prompt: 'Compare TCP and UDP.',
fallbackProviders: buildFallbackChain('anthropic'),
});import { streamText } from '@framers/agentos';
const stream = streamText({ provider: 'openai', prompt: 'Write a haiku.' });
for await (const chunk of stream.textStream) process.stdout.write(chunk);import { generateObject } from '@framers/agentos';
import { z } from 'zod';
const { object } = await generateObject({
provider: 'gemini',
schema: z.object({
sentiment: z.enum(['positive', 'negative', 'neutral']),
topics: z.array(z.string()),
}),
prompt: 'Analyze: "Great camera but disappointing battery."',
});import { agent } from '@framers/agentos';
const bot = agent({ provider: 'anthropic', instructions: 'You are a helpful assistant.' });
const reply = await bot.session('demo').send('What is 2+2?');
console.log(reply.text);const tutor = agent({
provider: 'anthropic',
instructions: 'You are a patient CS tutor.',
personality: {
openness: 0.9,
conscientiousness: 0.95,
agreeableness: 0.85,
},
memory: {
types: ['episodic', 'semantic'],
working: { enabled: true, maxTokens: 1200 },
},
});
const session = tutor.session('student-1');
await session.send('Explain recursion with an analogy.');
await session.send('Can you expand on that?'); // remembers contextimport { agency } from '@framers/agentos';
const team = agency({
strategy: 'graph',
agents: {
researcher: { provider: 'anthropic', instructions: 'Find relevant facts.' },
writer: { provider: 'openai', instructions: 'Write a clear summary.', dependsOn: ['researcher'] },
reviewer: { provider: 'gemini', instructions: 'Check accuracy.', dependsOn: ['writer'] },
},
});
const result = await team.generate('Compare TCP vs UDP for game networking.');6 strategies: sequential · parallel · debate · review-loop · hierarchical · graph
import { generateImage, generateVideo, generateMusic, performOCR, embedText } from '@framers/agentos';
const image = await generateImage({ provider: 'openai', prompt: 'Neon cityscape at sunset' });
const video = await generateVideo({ prompt: 'Drone over misty forest' });
const music = await generateMusic({ prompt: 'Lo-fi hip hop beat' });
const ocr = await performOCR({ image: './receipt.png', strategy: 'progressive' });
const embed = await embedText({ provider: 'openai', input: ['hello', 'world'] });Three authoring APIs, one graph runtime:
import { workflow, AgentGraph, mission } from '@framers/agentos/orchestration';
// 1. workflow() — deterministic DAG
const pipe = workflow('content').step('research', { tool: 'web_search' }).then('draft', { gmi: { instructions: '...' } }).compile();
// 2. AgentGraph — cycles, subgraphs
const graph = new AgentGraph('review').addNode('draft', gmiNode({...})).addNode('review', judgeNode({...})).addEdge('draft','review').compile();
// 3. mission() — goal-driven, planner decides steps
const m = mission('research').goal('Research {topic}').planner({ strategy: 'adaptive' }).compile();AgentOS exposes related entry points at different depths. The shared config surface does not imply identical enforcement across them.
- The lightweight
agent()facade owns prompt assembly, sessions, personality shaping, hooks, tools, and usage-ledger forwarding. generateText()andstreamText()are the low-level generation helpers for provider control, native tool calling, and text-fallback tool loops.- The full
AgentOSruntime andagency()own emergent tooling, guardrails, discovery, RAG initialization, permissions/security tiers, HITL, channels/voice, and provenance-aware orchestration.
| Category | Highlights |
|---|---|
| LLM Providers | 16 providers: OpenAI, Anthropic, Gemini, Groq, Ollama, OpenRouter, Together, Mistral, xAI, Claude CLI, Gemini CLI, + 5 image/video |
| Cognitive Memory | 8 neuroscience-backed mechanisms (reconsolidation, RIF, involuntary recall, FOK, gist extraction, schema encoding, source decay, emotion regulation) |
| HEXACO Personality | 6 traits modulate memory, retrieval bias, response style — agents have consistent identity |
| RAG Pipeline | 7 vector backends (InMemory, SQL, HNSW, Qdrant, Neo4j, pgvector, Pinecone) · 4 retrieval strategies · GraphRAG |
| Multi-Agent Teams | 6 coordination strategies · shared memory · inter-agent messaging · HITL approval gates |
| Orchestration | workflow() DAGs · AgentGraph cycles/subgraphs · mission() goal-driven planning · persistent checkpointing |
| Guardrails | 5 security tiers · 6 packs (PII redaction, ML classifiers, topicality, code safety, grounding, content policy) |
| Emergent Capabilities | Runtime tool forging · 4 self-improvement tools · tiered promotion (session → agent → shared) · skill export |
| Capability Discovery | Semantic per-turn tool selection · ~90% token reduction · 3-tier context model · Neo4j graph backend |
| Skills | 88 curated skills · 3-tier architecture (engine, content, catalog SDK) · auto-update on install |
| Voice & Telephony | ElevenLabs, Deepgram, OpenAI Whisper · Twilio, Telnyx, Plivo |
| Channels | 37 platform adapters (Telegram, Discord, Slack, WhatsApp, webchat, and more) |
| Structured Output | Zod-validated JSON extraction with retry · provider-native structured output |
| Observability | OpenTelemetry traces/metrics · usage ledger · cost guard · circuit breaker |
| Provider | Text Model | Image Model | Env Var |
|---|---|---|---|
openai |
gpt-4o | gpt-image-1 | OPENAI_API_KEY |
anthropic |
claude-sonnet-4 | — | ANTHROPIC_API_KEY |
gemini |
gemini-2.5-flash | — | GEMINI_API_KEY |
groq |
llama-3.3-70b | — | GROQ_API_KEY |
ollama |
llama3.2 | stable-diffusion | OLLAMA_BASE_URL |
openrouter |
openai/gpt-4o | — | OPENROUTER_API_KEY |
together |
Llama-3.1-70B | — | TOGETHER_API_KEY |
mistral |
mistral-large | — | MISTRAL_API_KEY |
xai |
grok-2 | — | XAI_API_KEY |
stability |
— | stable-diffusion-xl | STABILITY_API_KEY |
replicate |
— | flux-1.1-pro | REPLICATE_API_TOKEN |
bfl |
— | flux-pro-1.1 | BFL_API_KEY |
fal |
— | fal-ai/flux/dev | FAL_API_KEY |
claude-code-cli |
claude-sonnet-4 | — | claude on PATH |
gemini-cli |
gemini-2.5-flash | — | gemini on PATH |
Auto-detection: OpenAI → Anthropic → OpenRouter → Gemini → Groq → Together → Mistral → xAI → CLI → Ollama
Three ways to specify a model:
// 1. Separate fields (recommended)
generateText({ provider: 'anthropic', model: 'claude-sonnet-4-20250514', prompt: '...' });
// 2. Colon format (canonical combined string)
generateText({ model: 'anthropic:claude-sonnet-4-20250514', prompt: '...' });
// 3. Slash format (also supported for known providers)
generateText({ model: 'anthropic/claude-sonnet-4-20250514', prompt: '...' });
// Auto-detect (omit both provider and model)
generateText({ prompt: '...' }); // uses first available providerThe slash format only splits on known provider prefixes (openai, anthropic, openrouter, etc.). Unknown prefixes like meta-llama/llama-3.1-8b pass through as a plain model name to the auto-detected provider.
| Function | Description |
|---|---|
generateText() |
Text generation with multi-step tool calling |
streamText() |
Streaming text with async iterables |
generateObject() |
Zod-validated structured output |
streamObject() |
Streaming structured output |
generateImage() |
Image generation (7 providers, character consistency) |
generateVideo() |
Video generation |
generateMusic() / generateSFX() |
Audio generation |
performOCR() |
Text extraction from images |
embedText() |
Embedding generation |
agent() |
Lightweight stateful agent for prompts, tools, memory, and sessions |
agency() |
Multi-agent teams plus full runtime-owned orchestration features |
| Builder | Description |
|---|---|
workflow(name) |
Deterministic DAG with typed steps |
AgentGraph |
Explicit graph with cycles, subgraphs |
mission(name) |
Goal-driven, planner decides steps |
Full API reference: docs.agentos.sh/api
| Package | Description |
|---|---|
@framers/agentos |
Core runtime — agents, providers, memory, RAG, orchestration, guardrails |
@framers/agentos-extensions |
100+ extensions and templates |
@framers/agentos-extensions-registry |
Curated manifest builder |
@framers/agentos-skills |
88 curated SKILL.md definitions |
@framers/agentos-skills-registry |
Skills catalog SDK |
@framers/sql-storage-adapter |
SQL persistence (SQLite, Postgres, IndexedDB) |
| Guide | Topic |
|---|---|
| Architecture | System design, data flow, layer breakdown |
| High-Level API | generateText, agent, agency reference |
| Orchestration | Workflows, graphs, missions |
| Cognitive Memory | 8 mechanisms, 30+ APA citations |
| RAG Configuration | Vector stores, embeddings, data sources |
| Guardrails | 5 tiers, 6 packs |
| Human-in-the-Loop | Approval workflows, escalation |
| Emergent Capabilities | Runtime tool forging |
| Channels & Platforms | 37 platform adapters |
| Voice Pipeline | TTS, STT, telephony |
Full documentation: docs.agentos.sh
git clone https://github.com/framersai/agentos.git && cd agentos
pnpm install && pnpm build && pnpm testWe use Conventional Commits. See the Contributing Guide.
- Discord: wilds.ai/discord
- GitHub Issues: github.com/framersai/agentos/issues
- Blog: docs.agentos.sh/blog
- Paracosm: paracosm.agentos.sh — AI agent swarm simulation engine built on AgentOS
- Wilds.ai: wilds.ai — AI game worlds powered by AgentOS