Agents that delegate, remember, and finish the job.
Astreus is an open-source TypeScript framework for autonomous AI agents: sub-agents, graph workflows, persistent memory and MCP tools behind one typed API.
npm install @astreus-ai/astreusIt reads the dashboard you would read at 3 a.m.
One agent takes the alert and the Grafana screenshot and tells the incident channel what broke.
import { Agent, Graph } from '@astreus-ai/astreus';const oncall = await Agent.create({ name: 'OnCall', model: 'gpt-6-astra', systemPrompt: 'On-call engineer for the payments API', vision: true, memory: true});await oncall.ask('Checkout p95 alert. What broke?', { attachments: [ { type: 'image', path: './grafana-checkout.png' } ], stream: true, onChunk: (chunk) => process.stdout.write(chunk)});Agent docsThen it checks what you would check.
GitHub for the last deploy, Sentry for the errors, Postgres for the load. Each is an MCP server the model calls on its own.
await oncall.addMCPServers([ { name: 'github', command: 'npx', args: ['-y', '@modelcontextprotocol/server-github'] }, { name: 'postgres', command: 'npx', args: [ '-y', '@modelcontextprotocol/server-postgres', 'postgresql://replica.internal/payments' ] }, { name: 'sentry', url: process.env.SENTRY_MCP_URL }]);await oncall.ask( 'What shipped in the last hour, and what broke after?');MCP docsThree investigations at once.
A triage agent hands logs, deploys and the database to three specialists and merges what they find.
const logs = await Agent.create({ name: 'LogAnalyst', model: 'llama3.3', systemPrompt: 'Find the first error in the logs.'});const deploys = await Agent.create({ name: 'DeployAuditor', model: 'gpt-6-astra', systemPrompt: 'Audit what shipped in the last hour.'});const database = await Agent.create({ name: 'DbInspector', model: 'gpt-6-astra', systemPrompt: 'Find slow queries and lock waits.'});const triage = await Agent.create({ name: 'Triage', model: 'claude-fable-5-1', systemPrompt: 'Split the work, merge the findings.', subAgents: [logs, deploys, database]});const cause = await triage.ask('Why is checkout slow?', { useSubAgents: true, delegation: 'auto', coordination: 'parallel'});Sub-agent docsThe whole incident, as a graph.
Diagnose while the status page is updated, roll back only after the diagnosis, verify, then write the postmortem.
const incident = new Graph({ name: 'Incident response', maxConcurrency: 3, retryAttempts: 2, subAgentAware: true}, triage);const diagnose = incident.addTaskNode({ prompt: 'Find the root cause', useSubAgents: true});const status = incident.addTaskNode({ prompt: 'Post an update to the status page'});const rollback = incident.addTaskNode({ prompt: 'Roll back the deploy', dependencies: [diagnose]});const verify = incident.addTaskNode({ prompt: 'Confirm p95 < 400 ms', dependencies: [rollback]});incident.addTaskNode({ prompt: 'Write the postmortem', dependencies: [verify, status]});await incident.run();Graph docsIt has seen this incident before.
Runbooks are its knowledge, past incidents are its memory, and a four-hour thread compresses instead of overflowing.
const oncall = await Agent.create({ name: 'OnCall', model: 'gpt-6-astra', systemPrompt: 'On-call engineer for the payments API', embeddingModel: 'text-embedding-3-small', memory: true, knowledge: true, autoContextCompression: true, preserveLastN: 5});await oncall.addKnowledgeFromDirectory('./runbooks');await oncall.addMemory( 'Incident 214: checkout latency, pool exhausted.');const seen = await oncall.searchMemoriesBySimilarity( 'checkout latency spike', { similarityThreshold: 0.7, limit: 3 });Memory docsThe right model for each job.
A local model scrubs the logs so nothing leaves your network, a larger one diagnoses, another writes the report.
const rawLogs = await readFile('./checkout.log', 'utf8');// Scrub raw logs locally. Nothing leaves your network.const scrubbed = await oncall.ask(rawLogs, { model: 'llama3.3'});// A larger model finds the causeconst cause = await oncall.ask(scrubbed, { model: 'claude-fable-5-1'});// Another one writes it upconst report = await oncall.ask('Write the postmortem', { model: 'gpt-6-astra'});Provider docsCustomer data stays locked.
One setting encrypts every transcript, prompt and runbook chunk in your database with AES-256-GCM.
// .env// ENCRYPTION_ENABLED=true// ENCRYPTION_MASTER_KEY=<openssl rand -hex 32>// DB_URL=postgresql://...// KNOWLEDGE_DB_URL=postgresql://...const oncall = await Agent.create({ name: 'OnCall', model: 'gpt-6-astra', systemPrompt: 'On-call engineer for the payments API', memory: true, knowledge: true});// Stored encrypted: the prompt, the incident thread,// every memory and every runbook chunkawait oncall.ask('Which customers were affected?');Security docsBefore you install.
Node.js 22 or later, a database and a model. Astreus stores agents and memories in SQLite or PostgreSQL, and talks to OpenAI, Claude, Gemini or a local Ollama model. Install it with npm install @astreus-ai/astreus.
Yes. Point an agent at an Ollama model such as llama3.3 and it runs on your own machine. The agent code stays the same.
Yes. A sub-agent is an ordinary agent, created with its own model, prompt and capabilities, then passed to the coordinator in subAgents. Delegation can be automatic, manual or sequential.
A node starts as soon as every node it depends on has finished. Set maxConcurrency on the graph to let independent nodes run at the same time. By default they run one by one.
Any server you can start with a command and arguments, or reach over a URL. Add them to an agent with addMCPServers and their tools become available to the model.
Yes. Astreus is MIT licensed, so you can use it, change it and ship it in commercial projects.
© 2026 pzzaworks