Skip to main content

AnyTask Worker Guide

Complete guide to the AnyTask Worker system for automated task execution.

Table of Contents


Overview

The AnyTask Worker is an automated task execution system that:
  • Continuously polls for tasks assigned to your agent
  • Executes workflows automatically based on task triggers
  • Updates task status and posts progress notes
  • Tracks execution attempts and artifacts
  • Uses Claude Code for AI-assisted implementation

How It Works

┌─────────────────────────────────────────────┐
│         AnyTask Worker Architecture         │
└─────────────────────────────────────────────┘

1. Worker polls API for tasks assigned to agent
2. Matches tasks to workflows based on triggers
3. Executes workflow steps sequentially
4. Uses AI (Claude) for analysis and implementation
5. Updates task with progress and results

Key Features

  • Built-in workflows for common development tasks
  • Custom workflow support via YAML files
  • Secret management via system keyring
  • Attempt tracking with full execution history
  • Artifact storage for outputs and results
  • Variable interpolation for dynamic workflow configuration
  • Error handling with automatic task updates

Quick Start

1. Set Up Authentication

export ANYT_API_KEY=anyt_agent_xxxxxxxxxxxxx

2. Initialize Workspace

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

3. Get Your Agent ID

Visit https://anyt.dev/home/agents and copy your agent identifier (e.g., agent-xxx).

4. Start the Worker

# Start with all built-in workflows
anyt worker start --agent-id agent-xxx

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

# Start with custom workflows directory
anyt worker start --workflows /path/to/workflows --agent-id agent-xxx

5. Create a Task

anyt task add "Implement user login" --status todo
The worker will automatically pick up and execute the task!

Worker Commands

Start Worker

anyt worker start [OPTIONS]
Options:
  • --workspace, -w: Workspace directory (default: current)
  • --workflow: Specific workflow to run (local_dev, feature_development, general_task)
  • --workflows: Custom workflows directory (default: .anyt/workflows)
  • --poll-interval, -i: Polling interval in seconds (default: 5)
  • --max-backoff: Maximum backoff interval in seconds (default: 60)
  • --agent-id, -a: Agent identifier (required)
  • --project-id, -p: Project ID to scope task suggestions
Examples:
# Start with default settings
anyt worker start --agent-id agent-xxx

# Custom poll interval
anyt worker start --agent-id agent-xxx --poll-interval 10

# Specific workflow only
anyt worker start --workflow local_dev --agent-id agent-xxx

# Custom workflows directory
anyt worker start --workflows /custom/workflows --agent-id agent-xxx
Workflow Resolution Priority:
  1. If --workflow specified: Uses that specific workflow only
  2. If --workflows specified: Loads all workflows from that directory
  3. Otherwise: Loads all workflows from .anyt/workflows/
  4. Falls back to built-in workflows if not found
Built-in Workflow Locations: Built-in workflows are checked in this order:
  1. Custom directory (if --workflows specified)
  2. Workspace .anyt/workflows/ (user can override built-ins)
  3. Package built-in workflows

List Workflows

anyt worker list-workflows [OPTIONS]
Options:
  • --workflows: Workflows directory (default: .anyt/workflows)
Example:
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 Workflow

anyt worker validate-workflow <workflow_file>
Validates a workflow file’s syntax and structure. Example:
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

Built-in Workflows

The CLI includes three built-in workflows for common development scenarios.

1. Local Development (local_dev)

Purpose: Direct implementation on current repository state without branch switching. Best for:
  • Quick iterations and fixes
  • Working on current branch
  • Local testing
  • Simple tasks
Trigger Conditions:
  • task_created: Any newly created task
  • task_updated: Any task updated to todo status
Workflow Steps:
  1. Analyze task - Uses Claude Haiku to analyze requirements
  2. Post analysis - Adds analysis to task as note
  3. Implement changes - Uses Claude Code to implement
  4. Post implementation - Adds summary to task
  5. Lint code - Runs make lint (continues on error)
  6. Run tests - Runs make test (continues on error)
  7. Commit changes - Creates git commit with task reference
  8. Mark complete - Updates task to done status
Configuration:
timeout-minutes: 30
model: claude-haiku-4-5-20251001
When to use:
  • Working on current branch
  • Simple bug fixes
  • Quick prototypes
  • Local development

2. Feature Development (feature_development)

Purpose: Full feature workflow with proper branch management and testing. Best for:
  • Production features
  • Complex implementations
  • Tasks requiring thorough testing
  • Team collaboration
Trigger Conditions:
  • task_created: Tasks with feature label
  • task_updated: Tasks with feature label updated to todo status
Workflow Steps:
  1. Checkout code - Checks out main branch
  2. Cache dependencies - Caches uv/pnpm dependencies
  3. Analyze task - Creates detailed implementation plan
  4. Implement changes - Uses Claude Code to implement
  5. Lint code - Runs make lint (fails on error)
  6. Run tests - Runs make test (fails on error)
  7. Commit changes - Creates detailed git commit
  8. Mark complete - Updates task to done status
On Failure:
  • Posts error note to task
  • Creates follow-up bug task for investigation
Configuration:
timeout-minutes: 60
model: claude-haiku-4-5-20251001
When to use:
  • Feature development
  • Production-ready code
  • Tasks requiring tests
  • Quality assurance needed

3. General Task Handler (general_task)

Purpose: Catch-all workflow for any TODO task without specific labels. Best for:
  • Generic tasks
  • Mixed work types
  • Default workflow
  • Unclassified tasks
Trigger Conditions:
  • task_created: Any task with todo status
  • task_updated: Any task updated to todo status
Workflow Steps:
  1. Checkout code - Checks out main branch (no clean)
  2. Analyze task - Uses Claude to analyze requirements
  3. Implement changes - Uses Claude Code to implement
  4. Run tests - Runs make test (continues on error)
  5. Commit changes - Creates git commit
  6. Mark complete - Updates task to done status
Configuration:
timeout-minutes: 60
model: claude-haiku-4-5-20251001
When to use:
  • Any TODO task
  • Mixed work types
  • Default handling
  • Quick processing

Writing Custom Workflows

Create custom workflows by adding YAML files to .anyt/workflows/ directory.

Basic Workflow Structure

# Workflow metadata
name: My Custom Workflow
description: Description of what this workflow does

# Trigger conditions
"on":
  task_created:
    labels: ["custom-label"]
  task_updated:
    status: ["todo"]
    labels: ["custom-label"]

# Jobs to execute
jobs:
  my_job:
    name: Job Display Name
    runs-on: local
    timeout-minutes: 60

    steps:
      - name: Step 1
        uses: anyt/checkout@v1
        with:
          branch: main

      - name: Step 2
        uses: anyt/claude-code@v1
        with:
          prompt: "Implement: ${{ task.description }}"

      - name: Step 3
        uses: anyt/task-update@v1
        with:
          status: done

    # Optional failure handling
    on-failure:
      - name: Handle error
        uses: anyt/task-update@v1
        with:
          note: "Failed: ${{ failure.message }}"

Minimal Workflow Example

name: Simple Workflow
"on":
  task_created:
jobs:
  run:
    name: Run Task
    steps:
      - name: Do work
        run: echo "Hello, ${{ task.title }}"

Workflow Syntax Reference

Workflow Root

name: string (required)
description: string (optional)
"on": WorkflowOn (required)
jobs: Dict[str, WorkflowJob] (required)
on-failure: List[WorkflowStep] (optional)

Triggers (on)

Define when the workflow should run:
"on":
  task_created:
    labels: ["feature", "bug"]       # Match tasks with these labels
    status: ["todo"]                 # Match tasks with this status

  task_updated:
    status: ["todo", "in_progress"]  # Match status changes
    labels: ["urgent"]               # Match tasks with this label
Trigger Types:
  • task_created: Runs when a new task is created
  • task_updated: Runs when a task is updated
Filter Options:
  • labels: List of required labels (task must have ALL labels)
  • status: List of valid statuses (task can match ANY status)
Examples:
# Match any task with "feature" label
"on":
  task_created:
    labels: ["feature"]

# Match tasks updated to "todo" status
"on":
  task_updated:
    status: ["todo"]

# Match tasks with BOTH conditions
"on":
  task_created:
    labels: ["feature"]
    status: ["todo"]

# Multiple triggers
"on":
  task_created:
    labels: ["urgent"]
  task_updated:
    status: ["todo"]

Jobs

jobs:
  job_name:
    name: Display Name
    runs-on: local                  # Currently only "local" supported
    timeout-minutes: 60             # Job timeout (default: 60)
    steps: List[WorkflowStep]

Steps

Action-based step:
- name: Step Name
  uses: anyt/action-name@v1
  id: step_id                       # Optional, for referencing outputs
  with:
    param1: value1
    param2: value2
  if: condition                     # Optional conditional
  continue-on-error: false          # Optional, default: false
  timeout-minutes: 30               # Optional, default: 30
Command-based step:
- name: Run Command
  run: make test
  continue-on-error: true
  timeout-minutes: 10
Conditional Execution:
- name: Deploy to production
  uses: anyt/deploy@v1
  if: ${{ task.labels contains 'production' }}

On-Failure Handler

on-failure:
  - name: Log error
    uses: anyt/task-update@v1
    with:
      note: "Failed at: ${{ failure.step }}"

  - name: Notify team
    run: echo "Task failed" | mail -s "Failure" [email protected]

Available Actions

Git Actions

anyt/checkout@v1

Checkout git repository to specific branch. Parameters:
- name: Checkout code
  uses: anyt/checkout@v1
  with:
    branch: main          # Branch to checkout (default: current)
    clean: true           # Clean working directory (default: false)
    create: false         # Create branch if doesn't exist (default: false)

anyt/git-commit@v1

Create git commit with changes. Parameters:
- name: Commit changes
  uses: anyt/git-commit@v1
  with:
    message: |
      feat: Implement feature

      Task: ${{ task.identifier }}
    add: all              # What to add: "all" or specific files
Outputs:
  • commit_hash: The SHA of the created commit

Claude/AI Actions

anyt/claude-prompt@v1

Get response from Claude without code execution. Parameters:
- name: Analyze task
  uses: anyt/claude-prompt@v1
  id: analysis
  with:
    model: claude-haiku-4-5-20251001  # Model to use
    prompt: |
      Analyze this task:
      ${{ task.description }}
    output: result                     # Output variable name (default: result)
Outputs:
  • {output}: The Claude response (default: result)
  • tokens_used: Number of tokens consumed
Available Models:
  • claude-haiku-4-5-20251001 (fast, cost-effective)
  • claude-sonnet-4-5-20250929 (balanced)
  • claude-opus-4-5 (most capable)

anyt/claude-code@v1

Execute Claude Code CLI for implementation. Parameters:
- name: Implement feature
  uses: anyt/claude-code@v1
  id: implementation
  with:
    model: claude-haiku-4-5-20251001
    prompt: |
      Implement: ${{ task.description }}
    stream: true                               # Stream output (default: false)
    dangerously-skip-permissions: true         # Skip permission prompts (default: false)
Outputs:
  • summary: Implementation summary
  • tokens_used: Number of tokens consumed
  • files_modified: List of modified files

Task Actions

anyt/task-update@v1

Update task status or add notes. Parameters:
- name: Update task
  uses: anyt/task-update@v1
  with:
    status: done                    # New status (optional)
    note: |                         # Note to add (optional)
      Implementation completed
    timestamp: true                 # Add timestamp to note (default: false)
Valid Statuses:
  • backlog
  • todo
  • in_progress
  • done
  • cancelled

anyt/task-analyze@v1

Analyze task and post structured analysis. Parameters:
- name: Analyze task
  uses: anyt/task-analyze@v1
  with:
    model: claude-haiku-4-5-20251001
Outputs:
  • analysis: Structured analysis result
  • tokens_used: Number of tokens consumed

anyt/task-detail@v1

Get detailed task information. Parameters:
- name: Get task details
  uses: anyt/task-detail@v1
  id: details
Outputs:
  • identifier: Task identifier
  • title: Task title
  • description: Task description
  • status: Current status
  • labels: Task labels

Cache Actions

anyt/cache@v1

Cache dependencies and artifacts. Parameters:
- name: Cache dependencies
  uses: anyt/cache@v1
  with:
    path: |
      ~/.cache/uv
      node_modules
    key: deps-${{ hashFiles('**/requirements.txt') }}
    restore-keys: |
      deps-
Cache Key Functions:
  • hashFiles(pattern): Hash of files matching pattern

Testing Actions

anyt/test@v1

Run tests with automatic framework detection. Parameters:
- name: Run tests
  uses: anyt/test@v1
  with:
    framework: pytest              # Framework: pytest, jest, etc.
    path: tests/                   # Test directory
    args: -v --cov                 # Additional arguments

anyt/build@v1

Build project. Parameters:
- name: Build project
  uses: anyt/build@v1
  with:
    command: make build           # Build command

Dry-Run Actions

For testing workflows without external dependencies:
  • anyt/dry-run-claude-prompt@v1
  • anyt/dry-run-claude-code@v1
  • anyt/dry-run-git-commit@v1

Variable Interpolation

Use ${{ ... }} syntax to access dynamic values.

Task Variables

${{ task.identifier }}         # DEV-42
${{ task.title }}              # Task title
${{ task.description }}        # Full task description
${{ task.status }}             # current status
${{ task.labels }}             # List of labels
${{ task.priority }}           # Priority value (-2 to 2)
${{ task.owner }}              # Owner ID

Step Outputs

Reference outputs from previous steps:
steps:
  - name: Analyze
    uses: anyt/claude-prompt@v1
    id: analysis
    with:
      prompt: "Analyze: ${{ task.description }}"
      output: result

  - name: Implement
    uses: anyt/claude-code@v1
    with:
      prompt: |
        Based on analysis:
        ${{ steps.analysis.outputs.result }}

Failure Variables

Available in on-failure handler:
on-failure:
  - name: Report error
    uses: anyt/task-update@v1
    with:
      note: |
        Failed at: ${{ failure.step }}
        Error: ${{ failure.message }}

Environment Variables

Access environment variables:
- name: Use API key
  run: echo "Key: ${{ env.API_KEY }}"

Functions

hashFiles(pattern) Calculate hash of files matching pattern:
key: deps-${{ hashFiles('**/package.json') }}
Example Usage:
- name: Complex example
  uses: anyt/claude-code@v1
  with:
    prompt: |
      Task: ${{ task.identifier }}
      Title: ${{ task.title }}

      Previous analysis:
      ${{ steps.analysis.outputs.result }}

      Labels: ${{ task.labels }}
      Priority: ${{ task.priority }}

Secret Management

Store sensitive values securely in system keyring.

Set Secret

anyt worker secret set SECRET_NAME --value "secret-value"
Or prompt for value:
anyt worker secret set SECRET_NAME
# Enter value for secret 'SECRET_NAME': _

Get Secret

# Show masked
anyt worker secret get SECRET_NAME
# Output: SECRET_NAME: sec******lue

# Show full value
anyt worker secret get SECRET_NAME --show
# Output: SECRET_NAME: secret-value

Delete Secret

anyt worker secret delete SECRET_NAME

Use Secrets in Workflows

- name: Deploy
  run: |
    export API_KEY="${{ secrets.API_KEY }}"
    deploy.sh

Test Secret Interpolation

anyt worker secret test "KEY=\${{ secrets.API_KEY }}"

Workflow Execution

Execution Flow

1. Worker polls for tasks
2. Matches task to workflow triggers
3. Creates attempt record
4. Executes steps sequentially
5. Updates task with progress
6. Stores artifacts
7. Marks attempt as complete/failed

Viewing Execution History

List attempts for a task:
anyt attempt list DEV-42
Show attempt details:
anyt attempt show attempt-123
Download artifacts:
anyt artifact download artifact-456 --output result.json

Execution Context

Each workflow execution has access to:
  • Task data: All task fields and metadata
  • Step outputs: Results from previous steps
  • Environment: Environment variables
  • Secrets: Stored secrets via keyring
  • Workspace: Current workspace configuration

Examples

Example 1: Simple Bug Fix Workflow

name: Bug Fix
description: Automated bug fix workflow

"on":
  task_created:
    labels: ["bug"]

jobs:
  fix:
    name: Fix Bug
    timeout-minutes: 30
    steps:
      - name: Analyze bug
        uses: anyt/claude-prompt@v1
        id: analysis
        with:
          prompt: |
            Analyze this bug:
            ${{ task.description }}

      - name: Fix bug
        uses: anyt/claude-code@v1
        with:
          prompt: |
            Fix: ${{ task.description }}

            Analysis: ${{ steps.analysis.outputs.result }}

      - name: Run tests
        run: make test

      - name: Commit
        uses: anyt/git-commit@v1
        with:
          message: "fix: ${{ task.title }}"

      - name: Complete
        uses: anyt/task-update@v1
        with:
          status: done
          note: "Bug fixed and tested"

Example 2: Documentation Workflow

name: Documentation Update
description: Update documentation automatically

"on":
  task_created:
    labels: ["docs"]

jobs:
  update_docs:
    name: Update Documentation
    steps:
      - name: Checkout
        uses: anyt/checkout@v1

      - name: Generate docs
        uses: anyt/claude-code@v1
        with:
          prompt: |
            Update documentation for: ${{ task.description }}

      - name: Commit
        uses: anyt/git-commit@v1
        with:
          message: "docs: ${{ task.title }}"

      - name: Complete
        uses: anyt/task-update@v1
        with:
          status: done

Example 3: Multi-Step Feature Workflow

name: Feature with Review
description: Feature development with review checkpoint

"on":
  task_created:
    labels: ["feature"]

jobs:
  develop:
    name: Develop Feature
    timeout-minutes: 90
    steps:
      # Phase 1: Analysis
      - name: Analyze requirements
        uses: anyt/claude-prompt@v1
        id: requirements
        with:
          prompt: |
            Analyze requirements for:
            ${{ task.description }}

      - name: Post analysis
        uses: anyt/task-update@v1
        with:
          note: |
            ## Requirements Analysis
            ${{ steps.requirements.outputs.result }}

      # Phase 2: Design
      - name: Create design
        uses: anyt/claude-prompt@v1
        id: design
        with:
          prompt: |
            Create technical design for:
            ${{ steps.requirements.outputs.result }}

      - name: Post design
        uses: anyt/task-update@v1
        with:
          note: |
            ## Technical Design
            ${{ steps.design.outputs.result }}

      # Phase 3: Implementation
      - name: Implement feature
        uses: anyt/claude-code@v1
        with:
          prompt: |
            Implement based on design:
            ${{ steps.design.outputs.result }}

      # Phase 4: Testing
      - name: Run tests
        run: make test

      - name: Lint code
        run: make lint

      # Phase 5: Completion
      - name: Commit
        uses: anyt/git-commit@v1
        with:
          message: |
            feat: ${{ task.title }}

            ${{ steps.design.outputs.result }}

      - name: Complete
        uses: anyt/task-update@v1
        with:
          status: done
          note: "Feature implemented and tested"

    on-failure:
      - name: Report failure
        uses: anyt/task-update@v1
        with:
          note: |
            ❌ Failed at: ${{ failure.step }}
            Error: ${{ failure.message }}

Example 4: Conditional Execution

name: Conditional Deployment
"on":
  task_updated:
    status: ["done"]

jobs:
  deploy:
    name: Deploy if Production
    steps:
      - name: Check environment
        uses: anyt/task-detail@v1
        id: details

      - name: Deploy to staging
        run: deploy-staging.sh
        if: ${{ task.labels contains 'staging' }}

      - name: Deploy to production
        run: deploy-production.sh
        if: ${{ task.labels contains 'production' }}

Best Practices

1. Workflow Organization

DO:
  • One workflow per purpose/label
  • Clear, descriptive workflow names
  • Document trigger conditions
  • Keep workflows focused and simple
DON’T:
  • Create overly complex workflows
  • Mix unrelated tasks in one workflow
  • Use vague trigger conditions

2. Error Handling

Always include error handlers:
on-failure:
  - name: Update task
    uses: anyt/task-update@v1
    with:
      note: |
        ❌ Failed: ${{ failure.step }}
        ${{ failure.message }}
Use continue-on-error for optional steps:
- name: Optional linting
  run: make lint
  continue-on-error: true

3. Timeouts

Set appropriate timeouts:
jobs:
  quick_task:
    timeout-minutes: 15    # Short tasks

  complex_task:
    timeout-minutes: 120   # Complex tasks

4. Secret Management

DO:
  • Store all sensitive values as secrets
  • Use descriptive secret names
  • Test secrets with anyt worker secret test
DON’T:
  • Hardcode API keys in workflows
  • Share secrets in workflow files
  • Log secret values

5. Variable Usage

Use variables for dynamic content:
# Good
prompt: |
  Implement: ${{ task.description }}
  Labels: ${{ task.labels }}

# Bad
prompt: "Implement the task"

6. Step Outputs

Reuse outputs from previous steps:
- name: Analyze
  id: analysis
  uses: anyt/claude-prompt@v1
  with:
    output: plan

- name: Implement
  uses: anyt/claude-code@v1
  with:
    prompt: "Follow plan: ${{ steps.analysis.outputs.plan }}"

7. Git Commits

Include task reference in commits:
- name: Commit
  uses: anyt/git-commit@v1
  with:
    message: |
      feat: ${{ task.title }}

      Task: ${{ task.identifier }}

      🤖 Generated with Claude Code

8. Task Updates

Provide meaningful progress updates:
- name: Post progress
  uses: anyt/task-update@v1
  with:
    note: |
      ## Implementation Progress

      Completed: Step 1, 2, 3
      Next: Testing
    timestamp: true

9. Testing

Test workflows before deploying:
# Validate syntax
anyt worker validate-workflow .anyt/workflows/my_workflow.yaml

# Use dry-run actions for testing
- uses: anyt/dry-run-claude-code@v1

10. Documentation

Document your workflows:
name: My Workflow
description: |
  This workflow does X, Y, and Z.

  Triggers on:
  - New tasks with "feature" label
  - Tasks updated to "todo" status

  Steps:
  1. Analyze requirements
  2. Implement changes
  3. Run tests
  4. Deploy

Troubleshooting

Worker Won’t Start

Error: ANYT_API_KEY environment variable not set
# Solution: Set the API key
export ANYT_API_KEY=anyt_agent_xxxxxxxxxxxxx
Error: --agent-id is required
# Solution: Provide agent ID
anyt worker start --agent-id agent-xxx
Error: No workspace config found
# Solution: Initialize workspace
anyt init --workspace-id 123 --identifier DEV

Workflow Not Triggering

Check trigger conditions:
# Verify task has correct label
anyt task show DEV-42

# Check workflow triggers
anyt worker list-workflows
Verify workflow file exists:
ls .anyt/workflows/

Workflow Fails

View execution logs:
# List attempts
anyt attempt list DEV-42

# Show attempt details
anyt attempt show attempt-123
Check step that failed: Look for the failed step in attempt details. Common issues:
  1. Timeout: Increase timeout-minutes
  2. Missing dependencies: Install required tools
  3. Permission errors: Check file permissions
  4. API errors: Verify API key and connectivity

Secret Not Found

Error: Secret 'API_KEY' not found
# Solution: Set the secret
anyt worker secret set API_KEY --value "your-key"

# Verify
anyt worker secret get API_KEY

Claude Code Issues

Error: Claude Code execution failed
  1. Check Claude Code is installed
  2. Review prompt for clarity
  3. Check token limits

Git Commit Fails

Error: Git commit failed
  1. Check git is configured
  2. Verify working directory is clean
  3. Check for merge conflicts
  4. Ensure branch exists

Performance Issues

Worker is slow:
  1. Reduce poll-interval (default: 5s)
  2. Check network connectivity
  3. Optimize workflow steps
  4. Use faster Claude models
Tasks timing out:
  1. Increase timeout-minutes
  2. Break into smaller tasks
  3. Optimize prompts
  4. Use parallel execution where possible

Production Deployment

Infrastructure Setup

Prerequisites

System Requirements:
  • Linux server (Ubuntu 20.04+ or equivalent)
  • Python 3.11+ (managed via uv)
  • Git configured with user credentials
  • Systemd for process management
  • 2GB RAM minimum, 4GB+ recommended
  • 10GB disk space minimum
Network Requirements:
  • Outbound HTTPS to API endpoint (api.anyt.dev)
  • Stable internet connection
  • Optional: VPN for accessing private git repositories

Installation

Install AnyTask CLI:
# Recommended: Install script
curl -fsSL https://anyt.dev/install.sh | sh

# Verify installation
anyt --version
For detailed installation options, see the Installation Guide. Install Claude Code CLI:
# Install Node.js (if not already installed)
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo bash -
sudo apt-get install -y nodejs

# Install Claude Code CLI
npm install -g @anthropic-ai/claude-code

# Verify installation
claude --version
Create Service User:
# Create dedicated user for worker
sudo useradd -r -m -s /bin/bash -d /var/lib/anyt-worker anyt-worker

# Create necessary directories
sudo mkdir -p /etc/anyt/{environments,workflows/{production,staging,development},systemd}
sudo mkdir -p /opt/projects/{production,staging,development}
sudo mkdir -p /var/log/anyt

# Set ownership
sudo chown -R anyt-worker:anyt-worker /var/lib/anyt-worker
sudo chown -R anyt-worker:anyt-worker /opt/projects
sudo chown -R anyt-worker:anyt-worker /var/log/anyt

Configuration

Environment Configuration

Production Environment (/etc/anyt/environments/production.env):
# API Configuration
ANYT_API_KEY=anyt_agent_production_xxx_yyy_zzz
ANYT_API_URL=https://api.anyt.dev
AGENT_ID=agent-prod-001

# Workflow Configuration
WORKFLOWS_DIR=/etc/anyt/workflows/production
POLL_INTERVAL=5
MAX_BACKOFF=60

# Git Configuration
GIT_AUTHOR_NAME="AnyTask Worker (Production)"
GIT_AUTHOR_EMAIL="[email protected]"
GIT_COMMITTER_NAME="AnyTask Worker (Production)"
GIT_COMMITTER_EMAIL="[email protected]"
Set Permissions:
sudo chmod 600 /etc/anyt/environments/*.env
sudo chown anyt-worker:anyt-worker /etc/anyt/environments/*.env

Workspace Initialization

Initialize Production Workspace:
# Switch to service user
sudo -u anyt-worker bash

# Navigate to project directory
cd /opt/projects/production

# Initialize git repository (if not already a git repo)
git init
git remote add origin https://github.com/company/production-repo.git
git fetch origin
git checkout main

# Initialize AnyTask workspace
anyt init --workspace-id 1 --identifier PROD

# Configure workspace
cat > .anyt/anyt.json << EOF
{
  "workspace_id": "1",
  "name": "Production",
  "identifier": "PROD",
  "api_url": "https://api.anyt.dev",
  "agent_key": "anyt_agent_production_xxx_yyy_zzz",
  "current_project_id": 1
}
EOF

# Verify configuration
anyt auth whoami

Systemd Service Configuration

Production Worker Service

Create Service File (/etc/systemd/system/anyt-worker-prod.service):
[Unit]
Description=AnyTask Worker - Production
Documentation=https://docs.anyt.dev/worker-system/
After=network-online.target
Wants=network-online.target

[Service]
Type=simple
User=anyt-worker
Group=anyt-worker
WorkingDirectory=/opt/projects/production

# Environment configuration
EnvironmentFile=/etc/anyt/environments/production.env

# Start worker
ExecStart=/home/anyt-worker/.local/bin/anyt worker start \
    --agent-id ${AGENT_ID} \
    --workflows ${WORKFLOWS_DIR} \
    --poll-interval ${POLL_INTERVAL} \
    --max-backoff ${MAX_BACKOFF}

# Restart policy
Restart=always
RestartSec=10
StartLimitInterval=300
StartLimitBurst=5

# Logging
StandardOutput=journal
StandardError=journal
SyslogIdentifier=anyt-worker-prod

# Security hardening
NoNewPrivileges=true
PrivateTmp=true
ProtectSystem=strict
ProtectHome=true
ReadWritePaths=/opt/projects/production /var/log/anyt
ReadOnlyPaths=/etc/anyt

# Resource limits
LimitNOFILE=65536
LimitNPROC=4096
MemoryMax=4G
CPUQuota=200%

[Install]
WantedBy=multi-user.target

Enable and Start Service

# Reload systemd
sudo systemctl daemon-reload

# Enable service to start on boot
sudo systemctl enable anyt-worker-prod

# Start service
sudo systemctl start anyt-worker-prod

# Check status
sudo systemctl status anyt-worker-prod

# View logs
journalctl -u anyt-worker-prod -f

Production Workflows

Feature Development Workflow

Create Workflow (/etc/anyt/workflows/production/feature_development.yaml):
name: Production Feature Development
description: Automated feature implementation with full testing and review

"on":
  task_created:
    labels: ["feature"]
    status: ["todo"]

jobs:
  develop:
    name: Develop and Test Feature
    timeout-minutes: 90

    steps:
      # Analysis Phase
      - name: Analyze Requirements
        uses: anyt/claude-prompt@v1
        id: analysis
        with:
          model: claude-sonnet-4-5-20250929
          prompt: |
            Analyze requirements for: ${{ task.description }}

            Provide:
            1. Technical approach
            2. Dependencies and prerequisites
            3. Testing strategy
            4. Potential risks

      - name: Post Analysis
        uses: anyt/task-update@v1
        with:
          note: |
            ## Requirements Analysis
            ${{ steps.analysis.outputs.result }}
          timestamp: true

      # Implementation Phase
      - name: Checkout Code
        uses: anyt/checkout@v1
        with:
          branch: main
          clean: true

      - name: Cache Dependencies
        uses: anyt/cache@v1
        with:
          path: |
            ~/.cache/uv
            node_modules
          key: deps-${{ hashFiles('**/requirements.txt', '**/package.json') }}

      - name: Implement Feature
        uses: anyt/claude-code@v1
        id: implementation
        with:
          model: claude-sonnet-4-5-20250929
          prompt: |
            Implement the following feature based on analysis:

            ${{ steps.analysis.outputs.result }}

            Requirements:
            ${{ task.description }}

            Follow best practices:
            - Write comprehensive tests
            - Add documentation
            - Follow project code style
            - Handle errors gracefully

      # Testing Phase
      - name: Lint Code
        run: make lint
        continue-on-error: false
        timeout-minutes: 5

      - name: Run Unit Tests
        run: make test
        continue-on-error: false
        timeout-minutes: 15

      - name: Run Integration Tests
        run: make test-integration
        continue-on-error: false
        timeout-minutes: 20

      # Finalization Phase
      - name: Commit Changes
        uses: anyt/git-commit@v1
        with:
          message: |
            feat(${{ task.identifier }}): ${{ task.title }}

            ${{ steps.implementation.outputs.summary }}

            Task: ${{ task.identifier }}

            🤖 Generated with Claude Code

      - name: Mark Complete
        uses: anyt/task-update@v1
        with:
          status: done
          note: |
            ✅ Feature implemented and tested

            ## Summary
            ${{ steps.implementation.outputs.summary }}

            ## Files Modified
            ${{ steps.implementation.outputs.files_modified }}

            All tests passing.
          timestamp: true

    on-failure:
      - name: Report Failure
        uses: anyt/task-update@v1
        with:
          status: todo
          note: |
            ❌ Automated implementation failed

            **Failed Step**: ${{ failure.step }}
            **Error**: ${{ failure.message }}

            Please review and implement manually or update requirements.
          timestamp: true

      - name: Create Bug Task
        uses: anyt/task-create@v1
        with:
          title: "Fix: Failed automated implementation of ${{ task.identifier }}"
          description: |
            Automated workflow failed for: ${{ task.title }}

            Original task: ${{ task.identifier }}
            Failed step: ${{ failure.step }}
            Error: ${{ failure.message }}

            Review workflow execution and fix issues.
          labels: ["bug", "worker-failure"]
          priority: 1
          depends_on: ${{ task.identifier }}

Production Bug Fix Workflow

Create Workflow (/etc/anyt/workflows/production/bug_fix.yaml):
name: Production Bug Fix
description: Automated bug fix with regression testing

"on":
  task_created:
    labels: ["bug", "production"]
    status: ["todo"]

jobs:
  fix:
    name: Fix Bug
    timeout-minutes: 60

    steps:
      - name: Analyze Bug
        uses: anyt/claude-prompt@v1
        id: analysis
        with:
          model: claude-sonnet-4-5-20250929
          prompt: |
            Analyze this production bug:
            ${{ task.description }}

            Provide:
            1. Root cause analysis
            2. Fix approach
            3. Testing strategy
            4. Prevention measures

      - name: Checkout Code
        uses: anyt/checkout@v1
        with:
          branch: main
          clean: true

      - name: Implement Fix
        uses: anyt/claude-code@v1
        with:
          model: claude-sonnet-4-5-20250929
          prompt: |
            Fix this bug: ${{ task.description }}

            Analysis: ${{ steps.analysis.outputs.result }}

            Requirements:
            - Add regression tests
            - Update documentation
            - Verify fix doesn't break existing functionality

      - name: Run Full Test Suite
        run: make test-all
        timeout-minutes: 30

      - name: Commit Fix
        uses: anyt/git-commit@v1
        with:
          message: |
            fix(${{ task.identifier }}): ${{ task.title }}

            Root cause: ${{ steps.analysis.outputs.result }}

            Task: ${{ task.identifier }}

            🤖 Generated with Claude Code

      - name: Mark Complete
        uses: anyt/task-update@v1
        with:
          status: done
          note: |
            ✅ Bug fixed and tested

            All tests passing, including new regression tests.

    on-failure:
      - name: Escalate
        uses: anyt/task-update@v1
        with:
          status: todo
          priority: 2  # Increase priority
          note: |
            ⚠️ Automated fix failed - Manual intervention required

            Error: ${{ failure.message }}

Monitoring and Observability

Logging Configuration

Structured Logging:
# Configure journald for structured logs
sudo mkdir -p /etc/systemd/journald.conf.d/

cat <<EOF | sudo tee /etc/systemd/journald.conf.d/anyt.conf
[Journal]
Storage=persistent
MaxRetentionSec=7day
MaxFileSec=1day
ForwardToSyslog=no
EOF

sudo systemctl restart systemd-journald
Log Aggregation (Optional - Grafana Loki):
# promtail-config.yaml
server:
  http_listen_port: 9080

positions:
  filename: /var/lib/promtail/positions.yaml

clients:
  - url: http://loki:3100/loki/api/v1/push

scrape_configs:
  - job_name: anyt-worker
    journal:
      max_age: 12h
      labels:
        job: anyt-worker
    relabel_configs:
      - source_labels: ['__journal__systemd_unit']
        target_label: 'unit'
      - source_labels: ['__journal__hostname']
        target_label: 'host'

Metrics Collection

Custom Metrics Script (/usr/local/bin/anyt-metrics.sh):
#!/bin/bash
# Collect worker metrics for monitoring

# Get worker status
WORKER_STATUS=$(systemctl is-active anyt-worker-prod)

# Get recent attempts count
ATTEMPTS_TODAY=$(anyt attempt list --since "1 day ago" | wc -l)

# Get success/failure rate
SUCCESS_COUNT=$(journalctl -u anyt-worker-prod --since "1 day ago" | grep "completed and marked as done" | wc -l)
FAILURE_COUNT=$(journalctl -u anyt-worker-prod --since "1 day ago" | grep "Failed to" | wc -l)

# Output metrics (Prometheus format)
cat <<EOF
# HELP anyt_worker_up Worker service status
# TYPE anyt_worker_up gauge
anyt_worker_up{environment="production"} $( [ "$WORKER_STATUS" = "active" ] && echo 1 || echo 0 )

# HELP anyt_attempts_total Total attempts in last 24h
# TYPE anyt_attempts_total counter
anyt_attempts_total{environment="production"} $ATTEMPTS_TODAY

# HELP anyt_attempts_success_total Successful attempts in last 24h
# TYPE anyt_attempts_success_total counter
anyt_attempts_success_total{environment="production"} $SUCCESS_COUNT

# HELP anyt_attempts_failure_total Failed attempts in last 24h
# TYPE anyt_attempts_failure_total counter
anyt_attempts_failure_total{environment="production"} $FAILURE_COUNT
EOF
Cron Job for Metrics:
# /etc/cron.d/anyt-metrics
*/5 * * * * anyt-worker /usr/local/bin/anyt-metrics.sh > /var/lib/node_exporter/textfile_collector/anyt.prom

Health Checks

Health Check Script (/usr/local/bin/anyt-health-check.sh):
#!/bin/bash
set -euo pipefail

# Check systemd service
if ! systemctl is-active --quiet anyt-worker-prod; then
    echo "ERROR: Worker service is not running"
    exit 1
fi

# Check API connectivity
if ! curl -f -s -H "X-API-Key: ${ANYT_API_KEY}" \
    "${ANYT_API_URL}/v1/health" > /dev/null; then
    echo "ERROR: Cannot reach API endpoint"
    exit 1
fi

# Check recent activity (should have polled in last 5 minutes)
LAST_POLL=$(journalctl -u anyt-worker-prod --since "5 minutes ago" | \
    grep -c "Checking for available tasks" || echo 0)

if [ "$LAST_POLL" -lt 1 ]; then
    echo "WARNING: No polling activity in last 5 minutes"
    exit 1
fi

echo "OK: Worker is healthy"
exit 0
Monitoring Cron:
# /etc/cron.d/anyt-health
*/5 * * * * anyt-worker /usr/local/bin/anyt-health-check.sh || \
    echo "Health check failed" | mail -s "AnyTask Worker Alert" [email protected]

Backup and Recovery

Configuration Backup

#!/bin/bash
# /usr/local/bin/anyt-backup.sh

BACKUP_DIR="/var/backups/anyt/$(date +%Y%m%d)"
mkdir -p "$BACKUP_DIR"

# Backup configurations
tar -czf "$BACKUP_DIR/config.tar.gz" /etc/anyt/
tar -czf "$BACKUP_DIR/workspace.tar.gz" /opt/projects/production/.anyt/

# Backup workflows
tar -czf "$BACKUP_DIR/workflows.tar.gz" /etc/anyt/workflows/

# Keep last 30 days
find /var/backups/anyt/ -type d -mtime +30 -exec rm -rf {} +

Disaster Recovery

Recovery Procedure:
# 1. Restore from backup
cd /
sudo tar -xzf /var/backups/anyt/YYYYMMDD/config.tar.gz
sudo tar -xzf /var/backups/anyt/YYYYMMDD/workspace.tar.gz

# 2. Set correct permissions
sudo chown -R anyt-worker:anyt-worker /etc/anyt /opt/projects/production/.anyt

# 3. Restart services
sudo systemctl restart anyt-worker-prod

# 4. Verify
sudo systemctl status anyt-worker-prod
journalctl -u anyt-worker-prod -f

Performance Optimization

Caching Strategy

# Use caching for dependencies
- name: Cache Python Dependencies
  uses: anyt/cache@v1
  with:
    path: ~/.cache/uv
    key: python-${{ hashFiles('**/requirements.txt', '**/uv.lock') }}

- name: Cache Node Modules
  uses: anyt/cache@v1
  with:
    path: node_modules
    key: node-${{ hashFiles('**/package-lock.json') }}

Resource Limits

Systemd Resource Controls:
[Service]
# Limit memory usage
MemoryMax=4G
MemoryHigh=3G

# Limit CPU usage
CPUQuota=200%

# Limit file descriptors
LimitNOFILE=65536

# Limit processes
LimitNPROC=4096

Production Checklist

Before going live:
  • Infrastructure: Server provisioned with required resources
  • Installation: AnyTask CLI and Claude Code installed
  • Service User: Dedicated anyt-worker user created
  • Configuration: Environment files with correct keys
  • Workflows: Production workflows validated and tested
  • Systemd: Service files configured with security hardening
  • Permissions: File permissions set correctly (600 for secrets)
  • Git: Git credentials configured for commits
  • Monitoring: Logging and metrics collection configured
  • Alerts: Health checks and alert notifications configured
  • Backup: Configuration backup scheduled
  • Documentation: Runbooks and incident response procedures
  • Testing: End-to-end test in staging environment
  • Security: Security audit completed

Additional Resources

For issues and questions, contact: [email protected]