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.

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:

Terminal
npm install -g @agentforge/cli
agentforge init my-agent
cd my-agent
agentforge dev

Prerequisites

💡 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)

Terminal
npm install -g @agentforge/cli

Docker

Terminal
docker pull agentforge/cli:latest
docker run -it agentforge/cli init

From Source

Terminal
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.

agentforge.yaml
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: initconfigureruncleanup. Each phase has hooks for custom behavior.

JavaScript
const agent = new Agent({
  name: 'research-assistant',
  systemPrompt: 'You are a research assistant.',
  model: 'gpt-4o',
  tools: ['web-search', 'file-io']
});

Agent Patterns

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.

REST API
# 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"}'