Quickstart
Build your first AI agent with Astreus in under 2 minutes Learn the setup patterns, APIs, and practical examples needed to build reliable Astreus agent systems.
Build your first AI agent with Astreus in under 2 minutes
Let's create a simple agent that can execute tasks and respond intelligently.
Before we proceed, make sure you have Astreus installed. If you haven't installed it yet, follow the installation guide.
Build your first agent
Create Environment File
Create a .env file in your project root and add your OpenAI API key:
touch .envAdd your API key to the .env file:
OPENAI_API_KEY=sk-your-openai-api-key-hereCreate your First Agent
Create an agent with memory and system prompt:
import { Agent } from '@astreus-ai/astreus';
// Create agent
const agent = await Agent.create({
name: 'ResearchAgent',
model: 'gpt-4o',
memory: true,
systemPrompt: 'You are an expert research assistant.'
});Create and Execute Task
Create a task and execute it with your agent:
import { Agent } from '@astreus-ai/astreus';
// Create agent
const agent = await Agent.create({
name: 'ResearchAgent',
model: 'gpt-4o',
memory: true,
systemPrompt: 'You are an expert research assistant.'
});
// Create a task
const task = await agent.createTask({
prompt: "Research latest news in Anthropic and OpenAI"
});
// Execute the task
const result = await agent.executeTask(task.id);
console.log(result.response);Build a Graph Workflow
Create a workflow graph with multiple tasks:
import { Agent, Graph } from '@astreus-ai/astreus';
// Create agent
const agent = await Agent.create({
name: 'ResearchAgent',
model: 'gpt-4o',
memory: true,
systemPrompt: 'You are an expert research assistant.'
});
// Create a graph for complex workflows
const graph = new Graph({
name: 'Research Pipeline',
defaultAgentId: agent.id
});
// Add task nodes
const researchNode = graph.addTaskNode({
prompt: 'Research the latest AI developments'
});
const analysisNode = graph.addTaskNode({
prompt: 'Analyze the research findings',
dependencies: [researchNode]
});
const summaryNode = graph.addTaskNode({
prompt: 'Create a summary report',
dependencies: [analysisNode]
});
// Run the graph
const graphResult = await graph.run();
console.log(graphResult.results[summaryNode]);Congratulations! You've created your first AI agent with Astreus.
Last updated: July 6, 2026
In this section
Intro
Open-source AI agent framework for building autonomous systems that solve real-world tasks effectively.
Sub-Agents
Intelligent task delegation with specialized agents working in coordination Learn the setup patterns, APIs, and practical examples needed to build reliable...
Memory
Persistent conversation memory with vector search and automatic context integration Learn the setup patterns, APIs, and practical examples needed to build...
Context
Smart context management for long conversations with automatic compression Learn the setup patterns, APIs, and practical examples needed to build reliable...