API Reference
Build with Agentfield using Python, Go, REST, Real-time APIs, or CLI.
API Reference
Build intelligent agents with the language and interface that fits your stack
Agentfield provides five ways to build and deploy AI agents—from full-featured SDKs to language-agnostic HTTP endpoints. Choose the interface that matches your deployment model and team expertise.
Choose Your Interface
Full-featured framework for building intelligent agents with decorator-based APIs, automatic workflow tracking, and distributed memory.
Python SDK Documentation →
Type-safe SDK for Node.js and edge runtimes. Full TypeScript support with decorator-based APIs, automatic workflow tracking, and distributed memory.
TypeScript SDK Documentation →
Lightweight SDK for containerized deployments and binary distributions. Ideal for infrastructure teams and Kubernetes environments.
Feature parity in progress—some Python SDK features not yet available
Go SDK Documentation →
Language-agnostic HTTP endpoints for executing agents and managing distributed memory. Automatically generated from your agent definitions.
REST API Documentation →
WebSocket and Server-Sent Events for streaming responses, real-time updates, and interactive AI experiences.
Real-Time API Documentation →
Command-line interface for initializing projects, running agents locally, and managing Agentfield infrastructure.
Scaffold new agent projects with
af-init
CLI Documentation →
Decision Guide
When to Use Python SDK
Choose Python when you need the full power of Agentfield's AI infrastructure and want rapid development with maximum flexibility.
Best for:
- Building multi-agent systems with complex coordination
- Rapid prototyping and iterative development
- Teams comfortable with Python's async ecosystem
- Projects requiring all Agentfield features (structured outputs, memory, DAG tracking)
Developer Experience:
from agentfield import Agent
app = Agent(node_id="support_agent")
@app.reasoner
async def analyze_ticket(ticket: str) -> dict:
"""AI-powered ticket analysis with automatic API generation."""
return await app.ai(
system="Analyze support tickets",
user=ticket,
schema={"priority": "str", "category": "str"}
)The Python SDK provides decorator-based APIs, automatic REST endpoint generation, and seamless FastAPI integration. Every reasoner and skill becomes a production API endpoint without manual route definition.
When to Use Go SDK
Choose Go when you need binary deployability, containerized deployments, or infrastructure-first architecture.
Best for:
- Kubernetes and cloud-native deployments
- Single-binary distributions with no runtime dependencies
- Infrastructure teams preferring compiled languages
- Environments requiring minimal resource footprint
Current Status: The Go SDK is production-ready for core agent operations but feature parity with Python is in progress. Memory management and streaming responses are being actively developed.
The Go SDK supports essential operations—execution with structured outputs, cross-agent calls—and works seamlessly with Agentfield's control plane. Memory management and streaming capabilities coming soon.
Developer Experience:
package main
import "github.com/Agent-Field/agentfield/sdk/go/agent"
func main() {
app := agent.New("support_agent")
app.Reasoner("analyze_ticket", func(ticket string) (map[string]any, error) {
// AI-powered reasoning
return app.AI(agent.AIRequest{
System: "Analyze support tickets",
User: ticket,
})
})
app.Serve(":8001")
}When to Use REST API
Choose REST when integrating Agentfield agents into existing applications, working with non-Python/Go languages, or building serverless functions.
Best for:
- Integrating agents into JavaScript, Ruby, Java, .NET applications
- Frontend applications calling agents directly
- Serverless functions (Lambda, Cloud Functions)
- Microservices written in any language
Developer Experience: All agents automatically expose REST endpoints. No configuration needed—execute any reasoner or skill via HTTP:
const response = await fetch(
'http://localhost:8080/api/v1/execute/support-agent.analyze_ticket',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
input: { ticket: "Order #1234 never arrived" }
})
}
);
const result = await response.json();curl -X POST http://localhost:8080/api/v1/execute/support-agent.analyze_ticket \
-H "Content-Type: application/json" \
-d '{"input": {"ticket": "Order #1234 never arrived"}}'require 'net/http'
require 'json'
response = Net::HTTP.post(
URI('http://localhost:8080/api/v1/execute/support-agent.analyze_ticket'),
{ input: { ticket: "Order #1234 never arrived" } }.to_json,
'Content-Type' => 'application/json'
)
result = JSON.parse(response.body)When to Use Real-Time APIs
Choose real-time APIs when building interactive experiences that require streaming responses or live updates.
Best for:
- Chat interfaces with streaming LLM responses
- Real-time dashboards showing workflow progress
- Interactive debugging tools
- Applications requiring immediate feedback
Developer Experience:
const ws = new WebSocket('ws://localhost:8080/api/v1/stream/support-agent.analyze_ticket');
ws.send(JSON.stringify({
input: { ticket: "Order #1234 never arrived" }
}));
ws.onmessage = (event) => {
const { type, data } = JSON.parse(event.data);
if (type === 'token') {
// Stream tokens as AI generates response
renderToken(data.token);
} else if (type === 'complete') {
// Final result
console.log('Result:', data.result);
}
};When to Use CLI
The CLI is essential for development and deployment workflows. Use it alongside any SDK or API.
Development:
af-init my-agent # Scaffold new project
cd my-agent
af-dev # Start dev server with hot reload
af-add skill analytics # Add new skill scaffoldingDeployment:
af-run --production # Production deployment
agentfield workflow visualize # View execution DAGs
agentfield config validate # Verify configurationQuick Comparison
| Feature | Python SDK | Go SDK | REST API | Real-Time API | CLI |
|---|---|---|---|---|---|
| Agent Development | ✓ Full | ✓ Core | – | – | ✓ Scaffolding |
| Language | Python | Go | Any | Any | Any |
| Deployment | FastAPI Server | Binary | – | – | Local/Prod |
| Structured Outputs | ✓ | ✓ | ✓ | ✓ | – |
| Memory Management | ✓ | In Progress | ✓ | ✓ | – |
| Cross-Agent Calls | ✓ | ✓ | ✓ | ✓ | – |
| Streaming Responses | ✓ | In Progress | – | ✓ | – |
| Auto API Generation | ✓ | ✓ | – | – | – |
| Runtime Dependencies | Python 3.9+ | None | None | None | Python/Go |
Getting Started
Build Your First Agent
Start with Python SDK for the fastest path to production. Complete tutorial in under 10 minutes.
Quick Start Guide →
Explore Examples
Production-ready examples showing multi-agent coordination, memory usage, and advanced patterns.
Browse Examples →
REST API Integration
Call agents from any language. See complete HTTP endpoint reference with examples.
REST API Documentation →
Architecture Deep Dive
Understand how Agentfield's control plane coordinates distributed AI agents at scale.
Architecture Guide →