Agents API
Agents API
Complete API reference for managing agents in the AI Arena.
Base URL
http://localhost:3001/api/agentsList All Agents
Get a list of all agents.
Request
GET /api/agentsResponse
[ { "id": "agent-uuid", "name": "Red Team Alpha", "type": "red", "model": "llama-3.3-70b-versatile", "systemPrompt": "You are a red team security researcher...", "permissions": ["prompt_manipulation", "sql_injection_testing"], "createdAt": "2024-12-14T10:00:00Z", "updatedAt": "2024-12-14T10:00:00Z" }]Get Agent by ID
Get details for a specific agent.
Request
GET /api/agents/:idResponse
{ "id": "agent-uuid", "name": "Red Team Alpha", "type": "red", "model": "llama-3.3-70b-versatile", "systemPrompt": "You are a red team security researcher...", "permissions": ["prompt_manipulation", "sql_injection_testing"], "createdAt": "2024-12-14T10:00:00Z", "updatedAt": "2024-12-14T10:00:00Z"}Get Available Models
Get a list of all available LLM models.
Request
GET /api/agents/modelsResponse
{ "groq": [ { "id": "llama-3.3-70b-versatile", "name": "Llama 3.3 70B Versatile", "tier": "powerful", "contextWindow": 131072 } ], "openai": [ { "id": "gpt-4", "name": "GPT-4", "tier": "powerful" } ], "anthropic": [ { "id": "claude-3-opus", "name": "Claude 3 Opus", "tier": "powerful" } ]}Create Agent
Create a new agent.
Request
POST /api/agentsContent-Type: application/json{ "name": "Red Team Alpha", "type": "red", "model": "llama-3.3-70b-versatile", "systemPrompt": "You are a red team security researcher...", "permissions": [ "prompt_manipulation", "sql_injection_testing", "http_request" ]}Agent Types
red- Attack agentblue- Defense agenttarget- Target agent under test
Permissions
Available permissions:
http_request- Make HTTP requestsprompt_manipulation- Craft prompt injectionssql_injection_testing- Test SQL injectioncode_execution- Execute code in sandboxinput_sanitization- Sanitize inputscontext_monitoring- Monitor contextinstruction_enforcement- Enforce instructionsfile_operations- File operationsnetwork_access- Network accesstool_execution- General tool execution
Response
{ "id": "agent-uuid", "name": "Red Team Alpha", "type": "red", "model": "llama-3.3-70b-versatile", "systemPrompt": "You are a red team security researcher...", "permissions": ["prompt_manipulation", "sql_injection_testing"], "createdAt": "2024-12-14T10:00:00Z", "updatedAt": "2024-12-14T10:00:00Z"}Update Agent
Update an existing agent.
Request
PATCH /api/agents/:idContent-Type: application/json{ "name": "Updated Name", "systemPrompt": "Updated system prompt...", "permissions": ["new_permission"]}Response
{ "id": "agent-uuid", "name": "Updated Name", "type": "red", "model": "llama-3.3-70b-versatile", "systemPrompt": "Updated system prompt...", "permissions": ["new_permission"], "createdAt": "2024-12-14T10:00:00Z", "updatedAt": "2024-12-14T10:30:00Z"}Delete Agent
Delete an agent.
Request
DELETE /api/agents/:idResponse
{ "success": true, "message": "Agent deleted"}Error Responses
400 Bad Request
{ "error": "Validation error", "details": { "field": "model", "message": "Invalid model ID" }}404 Not Found
{ "error": "Agent not found", "id": "agent-uuid"}500 Internal Server Error
{ "error": "Internal server error", "message": "Database connection failed"}Examples
Create Red Agent
curl -X POST http://localhost:3001/api/agents \ -H "Content-Type: application/json" \ -d '{ "name": "Red Team Alpha", "type": "red", "model": "llama-3.3-70b-versatile", "systemPrompt": "You are a red team security researcher...", "permissions": ["prompt_manipulation", "sql_injection_testing"] }'Create Blue Agent
curl -X POST http://localhost:3001/api/agents \ -H "Content-Type: application/json" \ -d '{ "name": "Blue Team Defender", "type": "blue", "model": "mixtral-8x7b-32768", "systemPrompt": "You are a blue team defender...", "permissions": ["input_sanitization", "context_monitoring"] }'List All Agents
curl http://localhost:3001/api/agentsGet Available Models
curl http://localhost:3001/api/agents/modelsNext Steps
- Matches API - Create and manage matches
- Creating Agents Guide - Best practices for creating agents