Agents
Agents are autonomous AI workflows made of composable steps, skills, and tools. Build multi-step pipelines that plan, research, execute, and review — then call them with a single API request via the OpenAI-compatible endpoint.
One API call, multi-step execution
Set model: "agent:your-agent-id" in any OpenAI-compatible request. Agentlify orchestrates every step, tool call, and skill lookup server-side, then returns a single response — or streams it token-by-token.
Quick Example
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.AGENTLIFY_API_KEY, // mp_xxx key
baseURL: 'https://agentlify.co/api/agents',
});
const completion = await client.chat.completions.create({
model: 'my-research-agent', // agent ID = the slug
messages: [{ role: 'user', content: 'Compare React and Vue in 2025' }],
});
console.log(completion.choices[0].message.content);With Streaming
const stream = await client.chat.completions.create({
model: 'my-research-agent',
messages: [{ role: 'user', content: 'Compare React and Vue in 2025' }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content || '');
}How Agents Work
Every agent is a pipeline of steps executed in order. Each step can call an LLM with a prompt template, invoke a built-in tool, or trigger a webhook. Steps pass context forward via variables like {{previous_output}} and {{input}}.
User sends a message
Via API (model: "agent:slug") or the Dashboard Playground.
Orchestrator runs each step
LLM prompts are sent to your router. Tool steps execute server-side. Each step's output feeds into the next.
Final response returned
Standard OpenAI completion format with additional metadata containing cost, latency, and step details.
Core Concepts
Anatomy of an Agent
{
"model": "my-research-agent", // Slug — also the Firestore doc ID
"displayName": "Research Agent", // Human-readable name (editable)
"description": "Researches topics and produces structured summaries",
"isActive": true,
"steps": [ // Executed in order
{
"id": "step-1",
"name": "research",
"displayName": "Research Phase",
"runtime": "llm", // "llm" or "tool"
"phase": "research", // UI label: research | plan | execute | review
"prompt": "Research the following topic: {{input}}",
"order": 0,
"enabled": true
},
{
"id": "step-2",
"name": "summarize",
"displayName": "Summarize",
"runtime": "llm",
"phase": "execute",
"prompt": "Summarize: {{previous_output}}",
"order": 1,
"enabled": true
}
],
"skills": ["code-review-guidelines"], // Instructional skills (via get_skill)
"builtinTools": ["builtin_web_search"], // Executable tools
"tools": [], // Custom webhook tools
"settings": {
"planningMode": "initial_plan", // off | initial_plan | per_step_plan
"timeout": 120, // seconds
"streamFinalOnly": true,
"defaultToolBackend": "client" // client | webhook
}
}