POST /api/agents: choosing an adapter type, setting the agent's role name, writing the initial system prompt, and navigating the human approval gate that guards agent creation.
Create an agent record, understand every field in the agents table, and connect the agent to an adapter so the heartbeat can invoke it.
An agent in Paperclip AI is a persistent row in the database that represents one autonomous worker. It stores:
- What the agent is supposed to do (role, system prompt)
- Which adapter to use to invoke it (Claude Code, OpenAI, HTTP…)
- Its cost limits and current status
- Its position in the org chart (reports_to)
Agents don't run continuously. They are invoked by the heartbeat on each tick when there is unclaimed work.
ResearcherResearch Analystclaude-code for local dev$5.00curl -X POST http://localhost:3100/api/companies/${COMPANY_ID}/agents \
-H "Content-Type: application/json" \
-d '{
"name": "Researcher",
"role": "Research Analyst",
"system_prompt": "You are a research analyst. When given a topic, produce a concise 3-paragraph summary with key facts and sources.",
"adapter_type": "claude-code",
"monthly_budget_usd": 5.00
}'
INSERT INTO public.agents (
company_id, name, role, system_prompt, adapter_type, monthly_budget_usd, status
)
VALUES (
'01929f3a-...', -- your company id
'Researcher',
'Research Analyst',
'You are a research analyst. When given a topic, produce a concise 3-paragraph summary.',
'claude-code',
5.00,
'active'
)
ON CONFLICT (company_id, name) DO UPDATE SET
role = EXCLUDED.role,
system_prompt = EXCLUDED.system_prompt;
agents Table Reference| Column | Type | Notes |
|---|---|---|
id |
uuid | PK |
company_id |
uuid | FK → companies |
name |
text | Display name, unique per company |
role |
text | Job title shown in org chart |
system_prompt |
text | Standing instruction |
adapter_type |
text | claude-code, openai, http, shell |
adapter_config |
jsonb | Adapter-specific config (model, url, etc.) |
monthly_budget_usd |
numeric | Per-agent spend cap |
status |
text | active, paused, terminated |
reports_to |
uuid | FK → agents (manager), nullable |
created_at |
timestamptz |
Once an agent exists it will be picked up by the heartbeat on the next tick — but only if there are open issues assigned to it. In the next lesson you'll create your first task to give the agent something to do.
adapter_type and adapter_config