Astreus

Avvio rapido

Costruisci il tuo primo agente AI con Astreus in meno di 2 minuti Scopri i pattern di configurazione, le API e gli esempi pratici necessari per creare...

Costruisci il tuo primo agente AI con Astreus in meno di 2 minuti

Creiamo un semplice agente in grado di eseguire task e rispondere in modo intelligente.

Prima di procedere, assicurati di avere Astreus installato. Se non l'hai ancora installato, segui la guida all'installazione.

Costruisci il tuo primo agente

1

Crea il file di ambiente

Crea un file .env nella root del tuo progetto e aggiungi la tua chiave API OpenAI:

touch .env

Aggiungi la tua chiave API al file .env:

OPENAI_API_KEY=sk-your-openai-api-key-here
2

Crea il tuo primo agente

Crea un agente con memoria e 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.'
});
3

Crea ed esegui un task

Crea un task ed eseguilo con il tuo agente:

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);
4

Costruisci un workflow a grafo

Crea un grafo di workflow con più task:

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]);

Congratulazioni! Hai creato il tuo primo agente AI con Astreus.

Ultimo aggiornamento: 6 luglio 2026