Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/jaypopat/cf_ai_duet/llms.txt

Use this file to discover all available pages before exploring further.

This guide covers running Duet by building and running the Go server directly.

Prerequisites

  • Go 1.25.4 or later
  • SSH key pair for host authentication
  • Access to a Cloudflare Worker (see Cloudflare Worker setup)

Build from Source

1

Clone the repository

Clone the Duet repository to your local machine:
git clone https://github.com/jaypopat/cf_ai_duet.git
cd cf_ai_duet
2

Build the binary

Use the Makefile to build the Go binary:
make build
This creates the duet binary in the bin/ directory.
3

Generate SSH host key

Generate an SSH host key for the server:
mkdir -p .ssh
ssh-keygen -t ed25519 -f .ssh/id_ed25519 -N ""
4

Run the server

Start the Duet server with your configuration:
./bin/duet -addr :2222 -hostkey .ssh/id_ed25519 -worker https://your-worker.workers.dev

Configuration

The Duet server accepts the following command-line flags:
FlagDefaultDescription
-addr:2222SSH server address and port
-hostkey.ssh/id_ed25519Path to SSH host key
-worker""Duet CF Worker base URL (e.g. https://duet-cf-worker.<subdomain>.workers.dev)
The -worker flag is required for AI agent and sandbox features. Without it, only basic SSH pair programming will be available.

Development Mode

For local development with a local Cloudflare Worker:
1

Start both services

Run the development command to start both the Worker and Go server:
make dev
This runs:
  • Cloudflare Worker on http://localhost:8788
  • Duet Go server on port 2222
2

Connect to the server

Connect using SSH:
ssh <username>@localhost -p 2222
Development mode starts the Worker locally but AI inference still happens on Cloudflare’s edge. Sandbox features require a paid Cloudflare plan.

Alternative: Use Remote Worker

To run the Go server locally while using a deployed Worker:
make dev-remote
Or manually:
go run main.go -worker https://duet-cf-worker.incident-agent.workers.dev

Install Globally

To install Duet globally on your system:
make install
This installs the binary using go install, making it available in your $GOPATH/bin.

Production Considerations

For production deployments, consider:
  • Using a reverse proxy (nginx, Caddy) for TLS termination
  • Running the server as a systemd service
  • Setting up proper firewall rules
  • Using a dedicated non-root user
  • Implementing rate limiting and connection limits

Connecting to Your Server

Once running, users can connect via:
ssh <username>@your-server.com -p 2222
Replace your-server.com with your actual domain or IP address, and 2222 with your configured port.

Build docs developers (and LLMs) love