Building AI Agents
A comprehensive guide to creating, configuring, and deploying autonomous AI agents with AgentForge. Covers agent architecture, tool integration, workflow orchestration, and production patterns.
On this page
Quick Start #
AgentForge is a framework for building, testing, and deploying autonomous AI agents. It provides a unified API across multiple LLM providers.
Install the CLI and create your first project:
npm install -g @agentforge/cli
agentforge init my-agent
cd my-agent
agentforge dev
Prerequisites
- Node.js 18+ — The runtime for running agents locally
- An API key — From OpenAI, Anthropic, or any supported provider
- Git — For version control and template management
💡 Tip: Use agentforge init --template react-agent for a pre-configured agent with React-based UI tools included.
Installation #
AgentForge supports multiple installation methods depending on your environment.
npm (Recommended)
npm install -g @agentforge/cli
Docker
docker pull agentforge/cli:latest
docker run -it agentforge/cli init
From Source
git clone https://github.com/agentforge/agentforge.git
cd agentforge
npm install
npm run build
npm link
Configuration #
AgentForge uses a YAML configuration file at the root of your project.
provider: openai
model: gpt-4o
temperature: 0.7
max_tokens: 4096
Agents #
An agent is an AI entity configured with a system prompt, a model, and a set of tools.
Agent Lifecycle
Agents follow a predictable lifecycle: init → configure → run → cleanup. Each phase has hooks for custom behavior.
const agent = new Agent({
name: 'research-assistant',
systemPrompt: 'You are a research assistant.',
model: 'gpt-4o',
tools: ['web-search', 'file-io']
});
Agent Patterns
- Single-pass agent — One prompt, one response. Best for Q&A and simple transformations
- Loop agent — Repeats until a condition is met. Best for research and data collection
- Chain agent — Passes output from one step to the next. Best for multi-stage processing
- Router agent — Delegates subtasks to specialist sub-agents. Best for complex workflows
Tools #
Tools are functions that agents can call during task execution. AgentForge includes built-in tools for web search, file I/O, code execution, and API integration. Custom tools can be created with a simple function interface.
Workflows #
Workflows chain multiple agents and tools into multi-step processes. Each step receives the output of the previous step as context, enabling complex automation pipelines.
API Reference #
AgentForge provides both REST and WebSocket APIs. All endpoints are versioned and return JSON responses.
# Create and run an agent
curl -X POST https://api.agentforge.dev/v1/agents/run \
-H "Authorization: Bearer $API_KEY" \
-d '{"agent": "research", "input": "Latest AI news"}'