Relay Agent is an on-machine A2A agent for developer task delegation.
It accepts a repository issue over the standard A2A protocol, asks the local developer to approve it, creates an isolated Git worktree, delegates the coding work to GitHub Copilot CLI, and optionally publishes the result as a GitHub Draft PR.
The local worktree is always retained so the developer can inspect or modify the changes before accepting them.
A2A assignment
-> Relay Agent URL (Dev Tunnel)
-> approval dialog / task board
-> clone or reuse repository cache
-> create isolated worktree
-> run Copilot CLI
-> commit local changes
-> optionally push and create a Draft PR
-> notify the developer
Review the issue context and explicitly approve local execution before Relay Agent creates a worktree or starts the coding agent.
Track pending approvals, work in progress, and completed tasks from the local board.
- Every assignment requires explicit approval.
- No repository is cloned and no worktree is created before approval.
- The local worktree is preserved if Draft PR creation fails.
- Draft PRs are never marked ready automatically.
- Repository credentials and GitHub tokens are not stored by Relay Agent.
- Each developer signs in with their own GitHub account.
The bootstrap script can install the required tools on Windows:
- Git
- Python 3.10 or newer
- GitHub CLI (
gh) - GitHub Copilot CLI
- Microsoft Dev Tunnel CLI
Windows App Installer (winget) is required for automatic system package
installation.
The GitHub account cloning this private repository must have access to it.
gh auth login
gh repo clone xinyi-gong/relay-agent
cd relay-agent
.\bootstrap.ps1bootstrap.ps1:
- Installs any missing system tools with
winget. - Installs GitHub Copilot CLI with npm.
- Installs Relay Agent into an isolated per-user Python environment.
- Adds the
relay-agentcommand to the user PATH. - Asks which GitHub repository this Relay Agent serves.
To verify an already provisioned machine without installing system packages:
.\bootstrap.ps1 -SkipSystemPackagesTo install without opening the configuration wizard:
.\bootstrap.ps1 -SkipConfigureEach developer uses their own GitHub account:
gh auth login
gh auth status
relay-agent init
relay-agent whoamiThe configuration file is stored at:
%APPDATA%\relay-agent\config.toml
relay-agent init binds this Relay Agent to one GitHub repository in
owner/repository form. All assignments received at this agent's URL are
handled in that repository.
Copilot execution, approval, and Draft PR publishing are always enabled by the initialization wizard:
WORKER_MODE = "copilot"
REQUIRE_APPROVAL = "true"
ASYNC_WORK = "true"
DRAFT_PR_ENABLED = "true"The public URL is not entered during initialization. setup-tunnel.ps1
discovers the developer's Dev Tunnel URL and writes PUBLIC_BASE_URL
automatically.
Relay Agent does not require a central registry. Each developer exposes their local agent through a named Dev Tunnel and gives that URL directly to the A2A caller.
Authenticate and configure a tunnel:
devtunnel user login -g
.\setup-tunnel.ps1setup-tunnel.ps1:
- Resolves the signed-in GitHub username.
- Creates a tunnel named
relay-<github-user>. - Adds public HTTP port
8080. - Resolves the public HTTPS URL.
- Writes
PUBLIC_BASE_URLandTUNNEL_NAMEtoconfig.toml. - Prints the URL to give to the A2A caller.
Start the tunnel and keep that terminal open:
devtunnel host relay-<github-user>Start Relay Agent in another terminal:
relay-agent startVerify the public AgentCard:
https://<tunnel>-8080.<region>.devtunnels.ms/.well-known/agent.json
The AgentCard url field must contain the same public Dev Tunnel URL, not
localhost.
Relay Agent is the on-machine endpoint in the GitHub Actions -> Microsoft Foundry -> A2A workflow. The workflow and hosted Dispatcher remain separate deployments; this repository contains only the local worker that receives the A2A assignment and performs approved work. See docs/foundry-dispatch.md for the boundary and runtime contract.
Every assignment must be a JSON object containing an issue number:
{
"issue_number": "123",
"title": "Fix the upload retry behavior",
"body": "Add bounded retries and cover the timeout case.",
"assignee": "developer-github-login"
}The dispatcher does not send a repository. Relay Agent reads its fixed
REPO_SLUG from the configuration created by relay-agent init.
Default locations:
%APPDATA%\relay-agent\
repos\
owner\
repository\
worktrees\
owner\
repository\
issue-123\
Repositories are cloned once and reused from the cache. Every issue gets its own branch and worktree:
branch: agent/issue-123
worktree: ...\worktrees\owner\repository\issue-123
New assignments appear in two places:
- a Windows approval dialog
- the Pending Approval column on the task board
The first decision wins. Approving from the board closes the dialog; responding to the dialog resolves the board item.
The desktop dialog lets the developer edit the incoming prompt before approving. Relay Agent passes that edited prompt to the local coding agent; board approval retains the original dispatched prompt.
The task board is available by default at:
http://127.0.0.1:8181/
The Windows system tray icon also opens the board.
Task actions include:
- Approve
- Decline
- Open GitHub issue
- Stop
- Open in IDE
- Open Draft PR
- Delete
When enabled, Relay Agent:
- Pushes the issue branch.
- Reuses an existing open PR for that branch, if present.
- Otherwise creates a new GitHub Draft PR.
- Stores the PR URL on the task board.
Configuration:
DRAFT_PR_ENABLED = "true"
DRAFT_PR_REMOTE = "origin"The PR is created in the repository bound during relay-agent init.
The signed-in GitHub account must have permission to push a branch and create a PR in the target repository.
If publishing fails, the task remains completed locally and the error appears on the task card.
Environment variables override values in config.toml.
| Setting | Default | Purpose |
|---|---|---|
RELAY_GITHUB_USER |
auto-detected | Developer identity |
A2A_HOST |
127.0.0.1 |
Local A2A bind address |
A2A_PORT |
8080 |
Local A2A port |
PUBLIC_BASE_URL |
local URL | Public Dev Tunnel URL advertised by AgentCard |
REPO_SLUG |
required | Fixed GitHub repository as owner/repository |
REPO_CACHE_ROOT |
%APPDATA%\relay-agent\repos |
Cached repository checkouts |
WORKTREE_ROOT |
%APPDATA%\relay-agent\worktrees |
Issue worktrees |
WORKER_MODE |
mock |
mock or copilot |
COPILOT_AUTOPILOT |
true |
Run Copilot CLI unattended after approval |
REQUIRE_APPROVAL |
true |
Require approval before any repository work |
ASYNC_WORK |
true |
Run approval and long work in the background |
APPROVAL_TIMEOUT_SEC |
300 |
Approval timeout; 0 waits indefinitely |
BOARD_ENABLED |
true |
Enable the local task board |
BOARD_PORT |
8181 |
Task board port |
TRAY_ENABLED |
true |
Enable the Windows tray icon |
DESKTOP_TOAST |
true |
Enable Windows notifications |
DRAFT_PR_ENABLED |
false |
Push and create/reuse a Draft PR |
DRAFT_PR_REMOTE |
origin |
Git remote used for branch push |
relay-agent init
relay-agent start
relay-agent whoami
relay-agent config-path
relay-agent install-autostart
relay-agent uninstall-autostart
Install Windows login autostart:
relay-agent install-autostartRemove it:
relay-agent uninstall-autostartStart Relay Agent in mock mode:
$env:WORKER_MODE = "mock"
relay-agent startSend a local A2A assignment:
python scripts\dispatch.py `
--url http://127.0.0.1:8080 `
--issue 123 `
--title "Relay Agent smoke test" `
--body "Create the mock task artifact." `
--assignee developer-github-loginThe request returns immediately with pending-approval. Approve it from the
dialog or task board to continue.
Create a local environment and install editable:
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install -e .Run tests:
.\.venv\Scripts\python.exe -m unittest discover -s tests -vRun compile validation:
.\.venv\Scripts\python.exe -m compileall -q relay_agent tests scripts
