Skip to main content

Worker Quick Start Guide

Get started with AnyTask workers in 5 minutes.

Prerequisites

Install AnyTask CLI

# Recommended: Install script
curl -fsSL https://anyt.dev/install.sh | sh
For other installation methods, see the Installation Guide.

Install Claude Code CLI

npm install -g @anthropic-ai/claude-code
claude --version

Setup

1. Configure Authentication

# Set your agent API key
export ANYT_API_KEY=anyt_agent_xxxxxxxxxxxxx

# Optional: Set API URL (defaults to https://api.anyt.dev)
export ANYT_API_URL=https://api.anyt.dev

2. Initialize Workspace

# Navigate to your project
cd /path/to/your/project

# Initialize workspace
anyt init --workspace-id 123 --identifier DEV

# Verify configuration
anyt health check

3. Create Test Tasks

# Create a few test tasks
anyt task add "Update README" --status todo --priority 0
anyt task add "Fix typo in config" --status todo --priority 1 --labels bug
anyt task add "Implement user login" --status todo --priority 1 --labels feature

# Verify tasks
anyt task list --status todo

Get Your Agent ID

  1. Visit https://anyt.dev/home/agents
  2. Create a new agent if needed
  3. Copy your agent identifier (e.g., agent-xxx)
Note: The agent ID is different from your API key. The API key authenticates requests, while the agent ID identifies which agent should process tasks.

Running the Worker

Start Worker with Built-in Workflows

The CLI includes built-in workflows for common development tasks:
# Start worker with all built-in workflows
anyt worker start --agent-id agent-xxx

# Output:
# [2025-11-14 10:00:00] Worker started
# [2025-11-14 10:00:00] Agent ID: agent-xxx
# [2025-11-14 10:00:00] Polling interval: 5s
# [2025-11-14 10:00:00] Loaded workflows: local_dev, feature_development, general_task, dry_run
# [2025-11-14 10:00:01] Checking for available tasks...

Common Options

# Start with specific workflow (runs ONLY this workflow)
anyt worker start --agent-id agent-xxx --workflow local_dev

# Custom poll interval (check every 10 seconds)
anyt worker start --agent-id agent-xxx --poll-interval 10

# Maximum backoff (when no tasks found)
anyt worker start --agent-id agent-xxx --max-backoff 120

# Scope to specific project
anyt worker start --agent-id agent-xxx --project-id 1

# Custom workflows directory
anyt worker start --agent-id agent-xxx --workflows-dir /path/to/workflows

# Specify workspace directory
anyt worker start --agent-id agent-xxx --workspace /path/to/project
Options Reference:
  • --workspace, -w PATH: Workspace directory (default: current)
  • --workflow TEXT: Specific workflow to run (exclusive)
  • --workflows-dir PATH: Custom workflows directory (default: .anyt/workflows)
  • --poll-interval, -i SECONDS: Polling interval (default: 5)
  • --max-backoff SECONDS: Maximum backoff interval (default: 60)
  • --agent-id, -a TEXT: Agent identifier (required)
  • --project-id, -p INT: Project ID to scope task suggestions

Built-in Workflows

The CLI includes four production-ready workflows: 1. Local Development (local_dev)
  • Triggers: Any task updated to todo status
  • Best for: Quick iterations on current branch
  • Timeout: 30 minutes
  • Actions: Analyze task, implement changes, lint, test, commit, mark done
2. Feature Development (feature_development)
  • Triggers: Tasks with feature label
  • Best for: Full feature implementation with branch management
  • Timeout: 60 minutes
  • Actions: Create branch, analyze, implement, test, commit, push, mark done
3. General Task Handler (general_task)
  • Triggers: Any task created with todo status
  • Best for: Catch-all automation for general tasks
  • Timeout: 60 minutes
  • Actions: Checkout main, analyze, implement, test, commit, mark done
4. Dry Run (dry_run)
  • Triggers: Any task created with todo status
  • Best for: Testing worker setup without making code changes
  • Timeout: 30 minutes
  • Actions: Analyze task (read-only), post analysis, mark done (no code changes)

Example Workflow

1. Start the Worker

# In your project directory
cd /path/to/your/project

# Start the worker
anyt worker start --agent-id agent-xxx

2. Worker Output

[2025-11-14 15:30:00] Worker started
[2025-11-14 15:30:00] Agent ID: agent-xxx
[2025-11-14 15:30:00] Polling interval: 5s
[2025-11-14 15:30:00] Max backoff: 60s
[2025-11-14 15:30:00] Loaded workflows: local_dev, feature_development, general_task, dry_run

[2025-11-14 15:30:01] Checking for available tasks...
[2025-11-14 15:30:02] Found task: DEV-42 (Update README)
[2025-11-14 15:30:02] Matched workflow: local_dev
[2025-11-14 15:30:02] Starting attempt...

[2025-11-14 15:30:03] ✓ Started attempt #123
[2025-11-14 15:30:03] Executing workflow: Local Development

[2025-11-14 15:30:04] Step 1/8: Analyze task
[2025-11-14 15:30:10] ✓ Analysis complete

[2025-11-14 15:30:11] Step 2/8: Post analysis
[2025-11-14 15:30:12] ✓ Posted analysis to task

[2025-11-14 15:30:13] Step 3/8: Implement changes
[2025-11-14 15:30:45] ✓ Implementation complete

[2025-11-14 15:30:46] Step 4/8: Post implementation
[2025-11-14 15:30:47] ✓ Posted summary to task

[2025-11-14 15:30:48] Step 5/8: Lint code
[2025-11-14 15:30:50] ✓ Linting passed

[2025-11-14 15:30:51] Step 6/8: Run tests
[2025-11-14 15:31:05] ✓ Tests passed

[2025-11-14 15:31:06] Step 7/8: Commit changes
[2025-11-14 15:31:08] ✓ Committed changes (a1b2c3d)

[2025-11-14 15:31:09] Step 8/8: Mark complete
[2025-11-14 15:31:10] ✓ Task marked as done

[2025-11-14 15:31:11] ✓ Workflow completed successfully
[2025-11-14 15:31:11] ✓ Finished attempt #123

[2025-11-14 15:31:12] Checking for available tasks...

3. Verify Results

# View task timeline
anyt timeline DEV-42

# Check git commits
git log --oneline -5
# Output: a1b2c3d feat(DEV-42): Update README

# View attempt details
anyt attempt list DEV-42
anyt attempt show 123

# Check artifacts
anyt artifact list 123

View Available Workflows

List all available workflows:
# List workflows
anyt worker list-workflows

# Output:
# Available Workflows
# ┌─────────────────────┬───────────────────────────┬──────────────────┐
# │ Name                │ Description               │ Triggers         │
# ├─────────────────────┼───────────────────────────┼──────────────────┤
# │ Local Development   │ Direct implementation     │ task_created,    │
# │                     │ on current repository     │ task_updated     │
# ├─────────────────────┼───────────────────────────┼──────────────────┤
# │ Feature Development │ Automated feature         │ task_created,    │
# │                     │ implementation            │ task_updated     │
# └─────────────────────┴───────────────────────────┴──────────────────┘

Validate Custom Workflows

Validate a workflow file before using it:
# Validate workflow syntax
anyt worker validate-workflow .anyt/workflows/my_workflow.yaml

# Output:
# ✓ Workflow is valid: My Custom Workflow
#   Description: Custom implementation workflow
#   Jobs: 1
#     - implement: 8 steps

Monitoring Worker Activity

Check Task Progress

# View overall board
anyt board

# View task timeline
anyt timeline DEV-42

# List execution attempts
anyt attempt list DEV-42

# View attempt details
anyt attempt show 123

# List artifacts
anyt artifact list 123

# Download artifacts
anyt artifact download 456 --output result.json

Monitor Worker

The worker runs in the foreground and outputs status to stdout. You can monitor it in real-time.

Stopping the Worker

Press Ctrl+C to gracefully stop:
^C
# Worker stops immediately

Common Issues

”ANYT_API_KEY environment variable not set"

# Set API key
export ANYT_API_KEY=anyt_agent_xxxxxxxxxxxxx

# Verify
echo $ANYT_API_KEY

"No agent-id provided"

# Get your agent ID from https://anyt.dev/home/agents
# Then start worker with agent ID
anyt worker start --agent-id agent-xxx

"No tasks available"

# Check task list
anyt task list --status todo

# Create new task
anyt task add "Test task" --status todo

"Not in a workspace directory”

# Initialize workspace
anyt init --workspace-id 123 --identifier DEV

# Verify
cat .anyt/anyt.json

Advanced Usage

Run as Background Service

For production use, run as a systemd service:
# Create systemd service file
sudo cat > /etc/systemd/system/anyt-worker.service << 'EOF'
[Unit]
Description=AnyTask Worker
After=network.target

[Service]
Type=simple
User=youruser
WorkingDirectory=/path/to/project
Environment="ANYT_API_KEY=anyt_agent_xxx"
ExecStart=/usr/local/bin/anyt worker start --agent-id agent-xxx
Restart=always

[Install]
WantedBy=multi-user.target
EOF

# Enable and start
sudo systemctl enable anyt-worker
sudo systemctl start anyt-worker

# Check status
sudo systemctl status anyt-worker

# View logs
journalctl -u anyt-worker -f

Filter Tasks by Project

Use the --project-id option:
# Scope worker to specific project
anyt worker start --agent-id agent-xxx --project-id 1

Use with tmux

# Create tmux session
tmux new -s anyt-worker

# Run worker
anyt worker start --agent-id agent-xxx

# Detach: Ctrl+B then D
# Reattach: tmux attach -t anyt-worker

Multiple Workers

Run multiple workers for different workflows:
# Terminal 1: Feature worker
anyt worker start --agent-id agent-features --workflow feature_development

# Terminal 2: Bug fix worker
anyt worker start --agent-id agent-bugs --workflow local_dev

# Terminal 3: General worker
anyt worker start --agent-id agent-general --workflow general_task

Next Steps

  1. Custom Workflows - Create your own workflows
  2. Production Deployment - Deploy workers in production
  3. Authentication - Configure secure authentication
  4. Complete Guide - Comprehensive documentation

Support

Quick Reference

# Start worker
anyt worker start --agent-id agent-xxx

# Start with specific workflow
anyt worker start --agent-id agent-xxx --workflow local_dev

# List workflows
anyt worker list-workflows

# Validate workflow
anyt worker validate-workflow workflow.yaml

# View attempts
anyt attempt list DEV-42

# Stop worker
Ctrl+C
Happy automating! 🤖