Quickstart


This page walks you through installing AI Agents HQ and running your first task coordination workflow. By the end, you will have created a task, claimed it as an agent, and marked it complete — the same workflow that AI agents use in production.

No AI tools required for this walkthrough

You do not need Claude, Gemini, or Codex installed to follow along. The hq CLI works on its own. You will be playing the role of an agent manually to understand how the system works.

Installation


Prerequisites

You need two things installed on your machine:

  1. Go 1.23 or later — the programming language the project is written in
  2. Git — to clone the repository

If you are not sure whether Go is installed, run this in your terminal:

terminal
$ go version
go version go1.23.6 linux/amd64

If you see a version number, you are good. If you see "command not found", you need to install Go first.

Installing Go

How to install Go on Linux / WSL

Download and extract Go to /usr/local:

terminal
$ wget https://go.dev/dl/go1.23.6.linux-amd64.tar.gz -O /tmp/go.tar.gz
$ sudo tar -C /usr/local -xzf /tmp/go.tar.gz
$ rm /tmp/go.tar.gz

Then add it to your PATH permanently by adding this line to your ~/.bashrc (or ~/.zshrc if you use zsh):

terminal
$ echo 'export PATH="/usr/local/go/bin:$PATH"' >> ~/.bashrc
$ source ~/.bashrc
$ go version
go version go1.23.6 linux/amd64
How to install Go on macOS

The easiest way is with Homebrew:

terminal
$ brew install go
$ go version
go version go1.23.6 darwin/arm64

Or download the installer from go.dev/dl.

How to install Go on Windows

Download the MSI installer from go.dev/dl and run it. Go will be added to your PATH automatically. Restart your terminal after installing.

If you are using WSL (Windows Subsystem for Linux), follow the Linux instructions instead.

Clone and Build

terminal
# Clone the repository
$ git clone https://github.com/gbasran/ai-agents-hq.git
$ cd ai-agents-hq
# Build the hq binary
$ go build ./cmd/hq/
# This creates an executable called "hq" in the current directory
# Verify it works
$ ./hq version
hq version 0.1.0
# Optional: move it somewhere on your PATH
$ sudo mv hq /usr/local/bin/
$ hq version
hq version 0.1.0

Verify the Installation

Run the test suite to make sure everything is working correctly on your machine:

terminal
$ go test ./... -v -race
ok github.com/gbas/ai-agents-hq/cmd/hq 1.507s
ok github.com/gbas/ai-agents-hq/internal/teams/protocol 1.026s
ok github.com/gbas/ai-agents-hq/internal/teams/storage 1.110s

If all three packages show ok, you are good to go. The -race flag enables the race detector, which checks for concurrency bugs.

Your First Task


Let us walk through the complete lifecycle of a task. This is exactly what happens when AI agents coordinate — you are just doing it by hand to understand each step.

Step 1: Create a Task

Create a new task assigned to the "claude" tool in a team called "demo":

terminal
$ hq task create --team demo --tool claude --subject "Write unit tests for the login module" --description "Add tests for email validation, password hashing, and session creation."
{"id":1,"status":"pending","subject":"Write unit tests for the login module"}

The system responds with JSON confirming the task was created. It has ID 1 and starts in pending status — meaning it is available for an agent to pick up.

Step 2: List Available Tasks

Check what tasks are available:

terminal
$ hq task list --team demo
[{"id":1,"status":"pending","subject":"Write unit tests for the login module","tool":"claude","version":1}]

You can filter by tool, status, or only show tasks that are ready to claim (no unresolved dependencies):

terminal
# Only show tasks for Claude
$ hq task list --team demo --tool claude
# Only show pending tasks
$ hq task list --team demo --status pending
# Only show tasks that are ready (pending + no blockers)
$ hq task list --team demo --ready-only

Step 3: Claim the Task

An agent claims the task by providing its name, tool, and the current protocol version:

terminal
$ hq task claim --team demo --task 1 --agent my-agent --tool claude --protocol-version 2
{"id":1,"status":"in_progress","owner":"my-agent","leaseOwner":"my-agent","version":2}

Notice what changed:

  • Status went from pending to in_progress
  • Owner is now my-agent
  • Version bumped from 1 to 2 (every change increments the version)
  • A lease was set (the agent has 30 minutes to finish or send a heartbeat)

If another agent tries to claim the same task now, it gets rejected:

terminal
$ hq task claim --team demo --task 1 --agent other-agent --tool claude --protocol-version 2
# Exit code 10 (CAS conflict) — the task is already claimed

Step 4: Send a Heartbeat (for Long Tasks)

If the work takes more than a few minutes, the agent should send periodic heartbeats to extend its lease:

terminal
$ hq task heartbeat --team demo --task 1 --agent my-agent
{"id":1,"leaseOwner":"my-agent","leaseUntil":...}

This resets the 30-minute timer. Without heartbeats, the lease eventually expires and another agent could take over (this is the crash recovery mechanism).

Step 5: Complete the Task

When the work is done, the agent reports completion with a summary and an idempotency key:

terminal
$ hq task complete --team demo --task 1 --agent my-agent --summary "Added 12 unit tests covering email validation, password hashing, and session creation. All tests pass." --protocol-version 2 --idempotency-key "1-my-agent-complete"
{"id":1,"status":"completed","version":3}

The idempotency key (1-my-agent-complete) ensures that if this exact command runs again (due to a retry or crash recovery), it is silently ignored instead of causing an error.

Step 6: Communicate via Inbox

Agents can send messages to each other through inboxes. For example, after completing a task, an agent might notify the lead:

terminal
$ hq inbox send --team demo --to lead-agent --from my-agent --type task_completed --protocol-version 2 --idempotency-key "1-my-agent-report" --payload '{"taskId":1,"summary":"Added 12 unit tests. All pass."}'
{"event_id":1,"type":"task_completed","from":"my-agent","to":"lead-agent"}

The lead agent reads its inbox:

terminal
$ hq inbox read --team demo --agent lead-agent
[{"event_id":1,"type":"task_completed","from":"my-agent","to":"lead-agent","payload":{"taskId":1,"summary":"Added 12 unit tests. All pass."}}]

What Just Happened?


You just walked through the complete task coordination workflow:

01 Create Task
02 List & Filter
03 Claim (with lease)
04 Do Work + Heartbeat
05 Complete (idempotent)
06 Notify via Inbox

In a real deployment, AI agents do exactly these steps automatically. The orchestrator creates tasks, each AI tool's agent session picks up tasks assigned to it, does the work, and reports back. The hq CLI handles all the tricky parts — concurrency, crash recovery, duplicate detection — so agents can focus on the actual work.

Next Steps


Core Concepts

Understand how CAS versioning, leases, and idempotency work to keep everything safe. Read more

CLI Reference

Full reference for every hq command, flag, and exit code. Read more

Agent System

Learn about the Claude, Gemini, and Codex agent definitions and how they collaborate. Read more

Architecture

Dive into the Go code structure, protocol layer, and storage layer. Read more