Apiary provides both REST and gRPC APIs for managing resources. All APIs follow a consistent structure and use the same authentication and authorization mechanisms.
http://localhost:8080/api/v1localhost:8080 (default port)Currently, Apiary uses header-based authentication (MVP implementation). Set the following headers:
X-User-ID: <user-id>
X-User-Name: <user-name>
Note: This is an MVP implementation. Production should use JWT tokens or OAuth2/OIDC.
Cells provide namespace isolation. They are not namespaced themselves.
/api/v1/cells
List all cells
/api/v1/cells/:name
Get a specific cell
/api/v1/cells
Create a new cell
{
"apiVersion": "apiary.io/v1",
"kind": "Cell",
"metadata": {
"name": "my-cell"
},
"spec": {
"resourceQuota": {
"maxAgentSpecs": 100,
"maxHives": 50
}
}
}
AgentSpecs define how to run an agent. They are namespaced to a Cell.
/api/v1/cells/:namespace/agentspecs
List all AgentSpecs in a cell
/api/v1/cells/:namespace/agentspecs/:name
Get a specific AgentSpec
/api/v1/cells/:namespace/agentspecs
Create a new AgentSpec
{
"apiVersion": "apiary.io/v1",
"kind": "AgentSpec",
"metadata": {
"name": "my-agent",
"namespace": "default"
},
"spec": {
"runtime": {
"command": ["python", "agent.py"]
},
"interface": {
"type": "stdin"
},
"resources": {
"requests": {
"cpu": 1000,
"memory": 512000000
}
}
}
}
/api/v1/cells/:namespace/agentspecs/:name/scale
Scale an AgentSpec
Hives are collections of agents that work together.
/api/v1/cells/:namespace/hives
List all hives
/api/v1/cells/:namespace/hives
Create a new hive
Sessions manage stateful contexts for agent interactions.
/api/v1/cells/:namespace/sessions
List all sessions
/api/v1/cells/:namespace/sessions
Create a new session
Drones are running instances of agents.
/api/v1/cells/:namespace/drones
List all drones
The gRPC API mirrors all REST endpoints with the same functionality. Key RPCs include:
ListCells, GetCell, CreateCell, UpdateCell, DeleteCellListAgentSpecs, GetAgentSpec, CreateAgentSpec, UpdateAgentSpec, DeleteAgentSpecListHives, GetHive, CreateHive, UpdateHive, DeleteHiveListSessions, GetSession, CreateSession, UpdateSession, DeleteSessionListDrones, GetDrone, GetDroneLogs (streaming), ExecDrone (bidirectional streaming)Common error codes:
NOT_FOUND: Resource does not existALREADY_EXISTS: Resource already existsINVALID_INPUT: Invalid request dataUNAUTHORIZED: Authentication requiredFORBIDDEN: Insufficient permissionsINTERNAL_ERROR: Internal server errorRate limiting is enforced per Cell and per user. Default limits:
List endpoints support pagination:
GET /api/v1/cells/:namespace/hives?limit=100&offset=0
Query Parameters:
limit: Maximum number of items to return (default: 100)offset: Number of items to skip (default: 0)