Project: Launch a Mini AI Company

Full end-to-end: create a company, hire one agent, seed 5 issues, trigger 3 heartbeats, and review the activity log. The first complete Paperclip workflow from blank slate to running agent.

Mini-Project: Your First Functioning AI Company

What you'll build

A small but complete AI company with two agents, ten seeded tasks, and a working heartbeat — all running in local sandbox mode. By the end you will have watched end-to-end autonomous task completion.

Company Spec

Company: Demo Corp
Monthly budget: $15.00

Agent 1: Researcher
  Role: Research Analyst
  Adapter: claude-code
  Budget: $8.00
  Prompt: See below

Agent 2: Summariser
  Role: Executive Summariser
  Adapter: claude-code
  Budget: $5.00
  Prompt: See below

Step 1 — Create the Company

INSERT INTO public.companies (name, slug, monthly_budget_usd)
VALUES ('Demo Corp', 'demo-corp', 15.00)
ON CONFLICT (slug) DO NOTHING;

Step 2 — Hire the Agents

DO $$
DECLARE
  cid uuid;
  a1  uuid;
  a2  uuid;
BEGIN
  SELECT id INTO cid FROM companies WHERE slug = 'demo-corp';

  INSERT INTO agents (company_id, name, role, system_prompt, adapter_type, monthly_budget_usd, status)
  VALUES (cid, 'Researcher', 'Research Analyst',
    'You are a Research Analyst. When given a topic, produce a clear 2-paragraph summary with 3 key facts.',
    'claude-code', 8.00, 'active')
  ON CONFLICT (company_id, name) DO NOTHING
  RETURNING id INTO a1;
  IF a1 IS NULL THEN SELECT id INTO a1 FROM agents WHERE company_id = cid AND name = 'Researcher'; END IF;

  INSERT INTO agents (company_id, name, role, system_prompt, adapter_type, monthly_budget_usd, status)
  VALUES (cid, 'Summariser', 'Executive Summariser',
    'You are an Executive Summariser. Given a research note, distill it to exactly 3 bullet points for a busy executive.',
    'claude-code', 5.00, 'active')
  ON CONFLICT (company_id, name) DO NOTHING;
END $$;

Step 3 — Seed Ten Issues

DO $$
DECLARE
  cid uuid;
  a1  uuid;
BEGIN
  SELECT id INTO cid FROM companies WHERE slug = 'demo-corp';
  SELECT id INTO a1  FROM agents WHERE company_id = cid AND name = 'Researcher';

  INSERT INTO issues (company_id, title, description, assigned_agent_id, priority, status)
  SELECT cid, t.title, t.desc, a1, 'medium', 'open'
  FROM (VALUES
    ('What is LangGraph?',     'Research the LangGraph library and its use cases.'),
    ('What is CrewAI?',        'Research CrewAI and compare it to LangGraph.'),
    ('What is AutoGen?',       'Research Microsoft AutoGen framework.'),
    ('What is Agency Swarm?',  'Research Agency Swarm and its agent role model.'),
    ('What is Llama Index?',   'Research LlamaIndex for RAG applications.'),
    ('What is Haystack?',      'Research deepset Haystack pipeline framework.'),
    ('What is LangSmith?',     'Research LangSmith for LLM observability.'),
    ('What is Weights & Biases?', 'Research W&B for ML experiment tracking.'),
    ('What is Helicone?',      'Research Helicone for LLM usage analytics.'),
    ('What is PromptLayer?',   'Research PromptLayer for prompt versioning.')
  ) AS t(title, desc)
  ON CONFLICT DO NOTHING;
END $$;

Step 4 — Run the Heartbeat Five Times

for i in 1 2 3 4 5; do
  curl -s -X POST http://localhost:3100/api/heartbeat/run \
    -H "Content-Type: application/json" \
    -d '{"company_id": "'${COMPANY_ID}'"}' | jq '.issues_resolved'
  sleep 2
done

Step 5 — Review Results

SELECT
  i.title,
  i.status,
  LEFT(i.result, 120) AS preview
FROM issues i
JOIN companies c ON c.id = i.company_id
WHERE c.slug = 'demo-corp'
ORDER BY i.resolved_at DESC;

What to Observe

Stretch Goal

Modify the seed so the Summariser picks up resolved Researcher issues and produces executive bullets. You'll need to add a second pass that creates a new issue for each resolved Researcher result.

Checkpoint ✓

Sign in for progress tracking & Q&A →