Skip to main content
Tasks are the fundamental unit of evaluation in Harbor. This guide shows you how to create custom tasks to test agent capabilities on your specific use cases.

Task Structure

A Harbor task is a directory containing these components:

Quick Start

Generate a task template using the CLI:
This creates a complete task structure with examples.

Configuration File

The task.toml file defines task metadata and resource requirements:
task.toml

Configuration Options

Metadata

  • author_name - Task creator name
  • author_email - Contact email
  • difficulty - Task difficulty level (easy/medium/hard)
  • category - Task category (programming, reasoning, research, etc.)
  • tags - List of relevant tags for filtering

Timeouts

  • verifier.timeout_sec - Maximum time for verification tests
  • agent.timeout_sec - Maximum time for agent execution
  • agent.setup_timeout_sec - Maximum time for agent setup (optional)

Environment Resources

  • cpus - Number of CPU cores (integer)
  • memory - RAM allocation (e.g., “2G”, “4G”, “8G”)
  • storage - Disk space (e.g., “10G”, “20G”)
  • gpus - Number of GPUs (default: 0)
  • gpu_types - Preferred GPU types (e.g., [“a100”, “h100”])
  • allow_internet - Whether agent can access internet
  • build_timeout_sec - Maximum time for Docker build
  • docker_image - Pre-built image to use (optional)

Instruction File

The instruction.md file contains the natural language task description:
instruction.md
The script should handle missing values gracefully.

Advanced Environments

For complex setups, install tools and configure the environment:
environment/Dockerfile

Using Pre-built Images

For faster startup, specify a pre-built image:
task.toml

GPU Support

For GPU-enabled tasks:
task.toml
environment/Dockerfile

Verification Tests

The test script verifies the agent’s solution and writes a reward to /logs/verifier/reward.txt.

Simple Test Script

tests/test.sh

Using pytest

tests/test.sh
tests/test_solution.py

Partial Credit

For fine-grained evaluation, write a float reward (0.0 to 1.0):
tests/test.sh

JSON Rewards with Metadata

Provide detailed feedback:
tests/test.sh
tests/evaluate.py

Docker Compose Tasks

For multi-service tasks, use Docker Compose:
environment/docker-compose.yaml
When using Docker Compose, the agent executes in the main service. All other services are sidecars.

MCP Server Integration

Provide Model Context Protocol servers to agents:
task.toml
See the hello-mcp example task for a complete implementation.

Skills Integration

Provide reusable skills to agents:
Skills are automatically made available to agents that support them (like Claude Code).

Reference Solutions

Provide a reference solution for testing:
solution/solve.sh
Test your solution:

Testing Your Task

Test Locally

Test the Environment

Test the Verifier

Best Practices

  1. Make instructions clear: Agents should understand the task from the instruction alone
  2. Specify exact paths: Use absolute paths in instructions and tests
  3. Test your verifier: Ensure tests pass with your reference solution
  4. Minimize environment size: Use slim base images and multi-stage builds
  5. Set appropriate timeouts: Allow enough time but not too much
  6. Handle edge cases: Test with missing files, invalid input, etc.
  7. Use deterministic tests: Avoid tests that depend on randomness or timing
  8. Document assumptions: Explain any non-obvious requirements

Examples

Explore example tasks in the Harbor repository:
  • examples/tasks/hello-world - Basic file creation task
  • examples/tasks/hello-mcp - MCP server integration
  • examples/tasks/hello-skills - Skills integration
  • examples/tasks/hello-cuda - GPU-enabled task
  • examples/tasks/llm-judge-example - LLM-based evaluation

Next Steps

Running Evaluations

Run evaluations on your custom tasks

Benchmark Adapters

Convert existing benchmarks to Harbor format

Custom Agents

Test your tasks with custom agents