Skip to main content

Agents API

Create, configure and run agents from your own software. Every agent lives in a workspace and a team, so its policies, budgets and permissions follow the same rules as an agent created in the dashboard.

Base path: /api/v1/agents. Permissions: agents:read to read, agents:write to change, agents:execute to run, agents:delete to delete.

List agents​

GET /api/v1/agents
ParameterTypeDescription
pageintegerPage number (default 1)
limitintegerResults per page (default 100)
appIdstringOnly agents in this workspace
teamIdstringOnly agents in this team
skillstringOnly agents that have this skill (by slug)
{
"agents": [
{
"id": "agent_abc123",
"name": "Lead Qualifier",
"model": "claude-sonnet-latest",
"status": "active",
"appId": "app_456",
"teamId": "team_789"
}
],
"meta": { "total": 12, "page": 1, "limit": 100, "hasMore": false }
}

You only see agents in workspaces you can access.

Create an agent​

POST /api/v1/agents
FieldTypeRequiredDescription
appIdstringYesWorkspace the agent belongs to
teamIdstringOne of the twoExisting team to add the agent to
createTeambooleanOne of the twotrue creates a new team for this agent
newTeamNamestringNoName of that new team (defaults to the agent's name)
namestringYes2-100 characters
descriptionstringNoUp to 1,000 characters
modelstringNoModel id or alias. Default: claude-sonnet-latest
systemPromptstringNoRole, personality and method, up to 10,000 characters
contextPromptstringNoCompany or customer context, up to 10,000 characters
parentAgentIdstringNoThe agent this one reports to
templateIdstringNoStart from an agent template

Pass exactly one of teamId or createTeam. Without either, the API answers 400 with "code": "TEAM_REQUIRED". A retired model is refused with "error": "model_retired" and the recommended replacement; a model being phased out is accepted with an X-Model-Warning header.

curl -X POST https://api.meetloyd.com/api/v1/agents \
-H "Authorization: Bearer $MEETLOYD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"appId": "app_456",
"teamId": "team_789",
"name": "FAQ Assistant",
"systemPrompt": "You answer questions about our return policy."
}'

The response (201) is the new agent.

Read, update, delete​

GET    /api/v1/agents/:id
PATCH /api/v1/agents/:id
DELETE /api/v1/agents/:id

PATCH changes only the fields you send: name, description, model, systemPrompt, contextPrompt, status (active or paused) and more. Every change to an agent's behaviour is recorded in its change history, so it can be compared and rolled back from the dashboard.

Run an agent​

POST /api/v1/agents/:id/execute
FieldTypeRequiredDescription
messagestringYesWhat you ask the agent, up to 100,000 characters
conversationIdstringNoContinue an existing conversation
options.maxTokensintegerNoCap the length of the answer
options.temperaturenumberNo0-2
options.toolsstring[]NoRestrict the tools the agent may use for this run

The call waits for the agent to finish and returns the run:

{
"id": "run_789",
"agentId": "agent_abc123",
"status": "completed",
"output": "Our return window is 30 days from delivery…",
"toolCalls": [],
"tokenUsage": { "input": 1250, "output": 340, "total": 1590 },
"cost": 0.0034,
"duration": 2340
}

A failed run answers 500 with the run and its error. 402 means your organisation's model key ran out of credit; 423 means an administrator halted the agent or its team.

For a streamed, token-by-token answer, start a conversation and send messages to it.

Pause and resume​

POST /api/v1/agents/:id/pause
POST /api/v1/agents/:id/resume

A paused agent refuses new runs (400, "error": "agentInactive") until it is resumed. Its conversations and history are kept.

Run history​

GET /api/v1/agents/:id/runs?page=1&limit=50

Each run carries its input, output, tool calls, token usage, cost, duration and status.

Duplicate an agent​

POST /api/v1/agents/:id/duplicate

Optional body: { "name": "…" }. The copy keeps the prompts, model and configuration under a new id.

Just ask Loyd​

In the dashboard you can ask Loyd to "pause the outreach agent" or "give the support agent the ticket-triage skill". To add agents, ask Loyd to design the team you need: it drafts a team blueprint and deploys it with you.