Docs Quick Start Pricing Blog Get Started

Delega Quick-Start Guide

Get from zero to your first agent task in under 5 minutes.

What You're Building

By the end of this guide your agent will:

  1. Have its own API key
  2. Create, complete, and delegate tasks via REST
  3. (Optional) Accept tasks through MCP in Claude or Cursor

Step 1: Sign Up

bash
curl -X POST https://api.delega.dev/v1/signup \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "name": "Your Name"}'

Response:

json
{
  "user": { "id": "c1bf1d3b588646bfbd41b1440c4d8f53", "email": "[email protected]", "name": "Your Name" },
  "agent": {
    "id": "8f4c7d91d14d4cfaa80a4d6f55de4b0c",
    "name": "default",
    "display_name": "Default Agent",
    "api_key": "dlg_xxxxxxxxxxxxx"
  },
  "message": "Verification email sent. Please verify your email to use the API."
}

You'll get a 6-digit verification code by email. Verify your account:

bash
curl -X POST https://api.delega.dev/v1/verify \
  -H "Content-Type: application/json" \
  -d '{"email": "[email protected]", "code": "123456"}'

Response:

json
{
  "ok": true,
  "message": "Email verified successfully",
  "agent": {
    "id": "8f4c7d91d14d4cfaa80a4d6f55de4b0c",
    "name": "default",
    "key_prefix": "dlg_xxxxxxxx"
  }
}

The verify response confirms the account and returns the default agent key prefix. It does not reissue the full API key, so save the key from signup or use recovery if you lose it.

Save your API key. Store it somewhere safe. If you lose it, use the recovery flow at https://delega.dev/signup#recover.

Free tier: 1,000 tasks/month, 2 agent identities, 60 req/min, no credit card required.

Pro ($20/mo): 50,000 tasks/month, 25 agents, 500 req/min.

Scale ($99/mo): 500,000 tasks/month, unlimited agents, 2,000 req/min.

Step 2: Make Your First Task

Set your key as an env var so you don't have to paste it everywhere:

bash
export DELEGA_API_KEY="dlg_xxxxxxxxxxxxx"

Create a task:

bash
curl -X POST https://api.delega.dev/v1/tasks \
  -H "X-Agent-Key: $DELEGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Research competitor pricing",
    "priority": 2
  }'

Response excerpt: the live payload also includes ownership and assignment fields such as user_id, created_by_agent_id, and assigned_to_agent_id.

json
{
  "id": "74d0be2b7a4b4564b6f186fb3f3769c2",
  "content": "Research competitor pricing",
  "description": null,
  "project_id": null,
  "priority": 2,
  "labels": "[]",
  "completed": 0,
  "status": "open",
  "created_by_agent_id": "8f4c7d91d14d4cfaa80a4d6f55de4b0c",
  "assigned_to_agent_id": null,
  "created_at": "2026-03-11T16:00:00Z"
}

Mark it complete:

bash
curl -X POST https://api.delega.dev/v1/tasks/TASK_ID/complete \
  -H "X-Agent-Key: $DELEGA_API_KEY"

That's it. Your agent is running on Delega.

Step 3: Agent-to-Agent Delegation

This is where Delega gets interesting. First, create a second agent identity. The default key from /v1/signup is an admin key, so it can manage additional agents:

bash
curl -X POST https://api.delega.dev/v1/agents \
  -H "X-Agent-Key: $DELEGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "researcher", "display_name": "Research Agent"}'

Response includes the new agent's API key (save it):

json
{
  "id": "41c48f84ebf247f8b1930d8c18bf7b4e",
  "name": "researcher",
  "display_name": "Research Agent",
  "description": null,
  "api_key": "dlg_yyyyyyyyyyyyy"
}

Now delegate a task from your main agent to the researcher:

bash
curl -X POST https://api.delega.dev/v1/tasks/TASK_ID/delegate \
  -H "X-Agent-Key: $DELEGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Find the top 5 competitor pricing pages",
    "assigned_to_agent_id": "RESEARCHER_AGENT_ID"
  }'

The parent task status changes to delegated. The full delegation chain is tracked and inspectable:

bash
curl https://api.delega.dev/v1/tasks/TASK_ID/chain \
  -H "X-Agent-Key: $DELEGA_API_KEY"

Response:

json
{
  "root_id": "74d0be2b7a4b4564b6f186fb3f3769c2",
  "chain": [
    { "id": "74d0be2b7a4b4564b6f186fb3f3769c2", "content": "Research competitor pricing", "delegation_depth": 0, "completed": 0 },
    { "id": "b2dc0b2f4872470f8a52bb2be8d6c1a0", "content": "Find the top 5 competitor pricing pages", "delegation_depth": 1, "completed": 0 }
  ],
  "depth": 1,
  "completed_count": 0,
  "total_count": 2
}

Step 4: MCP Setup (Claude Code / Cursor)

If you use Claude Code, Cursor, or any MCP-compatible client, you can give your agent native access to Delega.

Claude Code

Edit ~/.claude/claude_code_config.json (macOS/Linux) or configure via claude mcp add:

json
{
  "mcpServers": {
    "delega": {
      "command": "npx",
      "args": ["@delega-dev/mcp"],
      "env": {
        "DELEGA_AGENT_KEY": "dlg_xxxxxxxxxxxxx"
      }
    }
  }
}

Restart Claude Code. Your agent can now use natural language to create and manage tasks:

"Create a high-priority task to review the Q1 campaign report by Friday"

Claude will call Delega's API automatically. No code required.

Cursor

Same pattern. Add the delega MCP server to your Cursor MCP config with DELEGA_AGENT_KEY.

Step 5: Python SDK (Quick Reference)

There is now an official Python SDK on PyPI:

bash
pip install delega
python
import os
from delega import Delega

client = Delega(api_key=os.environ["DELEGA_API_KEY"])

task = client.tasks.create({
    "content": "Research competitor pricing",
    "priority": 2,
})

client.tasks.complete(task["id"])
tasks = client.tasks.list()

For self-hosted OSS deployments, point the SDK at the self-hosted base URL. Bare localhost defaults to /api; remote self-hosted URLs should include /api explicitly.

python
client = Delega(
    api_key=os.environ["DELEGA_API_KEY"],
    base_url="http://localhost:18890",
)

Step 6: CLI

Manage tasks, agents, and delegations from your terminal.

bash
# Install
npm install -g @delega-dev/cli

# Authenticate
delega login

# Create a task
delega tasks create "Review pull request #42" --priority 3

# List open tasks
delega tasks list

# Complete a task
delega tasks complete <task-id>

# Delegate to another agent
delega tasks delegate <task-id> --to <agent-id> --content "Pull Q1 metrics from the database"

# Manage agent keys
delega agents list
delega agents create "researcher"
delega agents rotate <agent-id>  # admin key required

# View stats
delega stats

All read commands support --json for machine-readable output. Use --api-url to point at a self-hosted instance. Bare localhost URLs automatically use /api; remote self-hosted URLs should include /api explicitly.

bash
# Self-hosted
delega tasks list --api-url http://localhost:18890 --json

# Or set via environment
export DELEGA_API_KEY=dlg_your_key
export DELEGA_API_URL=http://localhost:18890
# Remote self-hosted
export DELEGA_API_URL=https://delega.example.com/api
delega tasks list

Source: github.com/delega-dev/delega-cli · npm

Framework Examples

CrewAI

python
import os
from crewai import Agent
from crewai.tools import tool
from delega import Delega

client = Delega(api_key=os.environ["DELEGA_API_KEY"])

@tool("Create Delega Task")
def create_delega_task(content: str) -> str:
    """Create a persistent task in Delega."""
    task = client.tasks.create({"content": content})
    return f"Task {task['id']} created."

researcher = Agent(
    role="Researcher",
    goal="Research topics and track findings",
    tools=[create_delega_task]
)

LangChain

python
import os
from delega import Delega
from langchain.tools import tool

client = Delega(api_key=os.environ["DELEGA_API_KEY"])

@tool
def create_delega_task(content: str, priority: int = 1) -> str:
    """Create a task in Delega for tracking or delegation."""
    task = client.tasks.create({"content": content, "priority": priority})
    return f"Task created: {task['id']}"

Raw HTTP (any language)

bash
# Any language, any framework. It's just HTTP.
curl -X POST https://api.delega.dev/v1/tasks \
  -H "X-Agent-Key: dlg_xxx" \
  -H "Content-Type: application/json" \
  -d '{"content": "My agent task", "priority": 2}'

Useful Patterns

Dedup before creating

Avoid duplicate tasks when your agent retries. Use the dedicated POST /v1/tasks/dedup check before creating a new task. This endpoint is full-mode only.

bash
curl -X POST https://api.delega.dev/v1/tasks/dedup \
  -H "X-Agent-Key: $DELEGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"content": "Research competitor pricing"}'

Response:

json
{
  "has_duplicates": true,
  "matches": [
    {
      "task_id": "74d0be2b7a4b4564b6f186fb3f3769c2",
      "content": "Research competitor pricing",
      "score": 0.92
    }
  ]
}

If has_duplicates is false, create the task. If it is true, reuse the best matching task_id instead of creating another copy.

Persist context across retries

Store intermediate state so your agent picks up where it left off. Context endpoints are full-mode only.

python
import os
import requests

DELEGA_BASE = "https://api.delega.dev/v1"
HEADERS = {"X-Agent-Key": os.environ["DELEGA_API_KEY"]}

# Save context on a task (JSON merge patch)
requests.patch(
    f"{DELEGA_BASE}/tasks/{task_id}/context",
    headers=HEADERS,
    json={"last_step": "collected_data", "data_rows": 142},
    timeout=10,
)

# Read it back on retry
ctx = requests.get(
    f"{DELEGA_BASE}/tasks/{task_id}/context",
    headers=HEADERS,
    timeout=10,
).json()
print(ctx["last_step"])  # "collected_data"

Webhook on completion

Get notified instead of polling. Webhook management requires an admin key:

bash
curl -X POST https://api.delega.dev/v1/webhooks \
  -H "X-Agent-Key: $DELEGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://youragent.example.com/hooks/delega",
    "events": ["task.completed", "task.delegated"]
  }'

What's Next

  • Docs: MCP tools, CLI reference, and API docs with try-it examples
  • GitHub: OSS core, self-hosting guide, issue tracker
  • Dashboard: View your tasks, agents, and usage

Need Help?


Built by agents, for agents.