API Reference

Complete API documentation for programmatic access to Agentwise's orchestration system.

🚀 API Overview

3
Core APIs
8+
REST Endpoints
6
WebSocket Events
61+
MCP Servers

🔧 Core APIs

Primary interfaces for interacting with the Agentwise system.

Project Management API

Create, manage, and monitor projects

Available Methods:

createProject()
getProject()
listProjects()
deleteProject()

Interface Definition:

typescript
interface ProjectManager {
  createProject(name: string, spec: ProjectSpec): Promise<Project>
  getProject(id: string): Promise<Project>
  listProjects(): Promise<Project[]>
  deleteProject(id: string): Promise<void>
}

Agent Orchestration API

Control and monitor AI agents

Available Methods:

launchAgents()
monitorProgress()
getAgentStatus()
terminateAgent()

Interface Definition:

typescript
interface AgentOrchestrator {
  launchAgents(agents: Agent[], task: Task): Promise<void>
  monitorProgress(): Observable<Progress>
  getAgentStatus(agentId: string): AgentStatus
  terminateAgent(agentId: string): Promise<void>
}

Task Distribution API

Distribute and manage tasks across agents

Available Methods:

distributeTask()
getTaskStatus()
cancelTask()
prioritizeTask()

Interface Definition:

typescript
interface TaskDistributor {
  distributeTask(task: Task, agents: Agent[]): Promise<void>
  getTaskStatus(taskId: string): TaskStatus
  cancelTask(taskId: string): Promise<void>
  prioritizeTask(taskId: string, priority: number): Promise<void>
}

🎯 REST Endpoints

HTTP endpoints for RESTful API access.

GET
/api/status
System status and health check
None
GET
/api/agents
List all active agents
API Key
GET
/api/projects
List all projects
API Key
GET
/api/metrics
Performance metrics
API Key
POST
/api/agents/launch
Launch new agents
API Key
POST
/api/tasks/create
Create new task
API Key
DELETE
/api/projects/:id
Delete project
API Key
PATCH
/api/tasks/:id
Update task status
API Key

🔌 WebSocket API

Real-time event streaming for live updates.

Connection Example

javascript
const ws = new WebSocket('ws://localhost:3001')

ws.on('connect', () => {
  console.log('Connected to Agentwise')
})

ws.on('message', (data) => {
  const event = JSON.parse(data)
  console.log('Event:', event.type, event.payload)
})

ws.on('error', (error) => {
  console.error('WebSocket error:', error)
})

Event Types

agent:start

Agent begins execution

{ agentId, taskId, timestamp }
agent:progress

Progress update from agent

{ agentId, progress, message }
agent:complete

Agent completes task

{ agentId, taskId, result }
agent:error

Error during execution

{ agentId, error, stack }
task:created

New task created

{ taskId, type, priority }
task:completed

Task fully completed

{ taskId, duration, status }

🔌 MCP Integration

Model Context Protocol

Interface for 61+ MCP servers providing extended functionality

typescript
interface MCPServer {
  name: string
  version: string
  tools: Tool[]
  resources: Resource[]
  
  // Connection management
  connect(config: MCPConfig): Promise<void>
  disconnect(): Promise<void>
  
  // Tool execution
  execute(tool: string, params: any): Promise<any>
  
  // Resource access
  getResource(uri: string): Promise<Resource>
  listResources(): Promise<Resource[]>
}

⚠️ Error Handling

Standardized error codes and handling strategies.

E001
Agent initialization failed
HTTP 500
Retryable
E002
Task distribution error
HTTP 500
Retryable
E003
Token limit exceeded
HTTP 429
E004
Project not found
HTTP 404
E005
Invalid configuration
HTTP 400
E006
Authentication failed
HTTP 401

Rate Limits

Project creation

Rate Limit:
10 per hour
Burst Limit:
3 per minute

Agent launches

Rate Limit:
100 per hour
Burst Limit:
10 per minute

Task creation

Rate Limit:
1000 per hour
Burst Limit:
50 per minute

WebSocket connections

Rate Limit:
10 concurrent
Burst Limit:
N/A