Agent Self-Updates
Agents keep themselves current: publish a new version for a platform, and every agent on that platform installs it on its next update check. This page covers how an update runs, how to publish versions, and what to do when endpoint security gets in the way.
When agents check for updates
An agent asks the server for the latest version (GET /api/agent/version):
- On startup, right after its first successful heartbeat
- Every hour while running (
update_intervalin the agent config, default1h) - On demand, when you click Update on an agent (or Update All on the Agents page)
The server answers with the newest version registered for the agent's OS and architecture, or 204 No Content when the agent is already on it. Agents never downgrade unless the version is marked mandatory.
How an update runs
- Download. The new binary is saved to a temporary file next to the current one.
- Verify. Its SHA256 hash and size must match what the server advertised. If the agent has an
update_public_key(set at enrollment), the Ed25519 signature over the hash must also verify. Unsigned or tampered binaries are rejected. - Swap. The new binary takes the agent's path, and the previous one is kept next to it as
achilles-agent.exe.old(Windows) orachilles-agent.old(Linux/macOS). - Launch check. The agent runs the new binary once, at its final path, with
--version. It must start, and it must report the version it was advertised as. - Commit or roll back.
- If the check passes, the agent reports the result, exits, and the service manager (SCM, systemd or launchd) starts the new binary.
- If the check fails, the agent restores the
.oldbinary, keeps running on its current version, and reports the update as failed with the reason.
The launch check (steps 4–5) arrived in agent 0.6.6. The binary doing the update runs this logic, so the update to 0.6.6 still ran without it; every update after that is protected. Older agents exit straight after the swap. If Windows then refuses to start the new binary, the agent stays offline until someone starts it by hand (see Troubleshooting).
On Windows, Service Control Manager recovery actions restart the service after it exits. They don't cover a service that fails to start, so the agent also registers a one-time scheduled task (AchillesAgentRestart) that starts the service about two minutes later and then deletes itself.
Update tasks
Clicking Update creates an update_agent task. It finishes as:
| Status | Output | Meaning |
|---|---|---|
| Completed | update applied, restart pending | Installed; the agent restarts on the new version |
| Completed | already up to date | The agent was already on the latest version |
| Failed | the reason (e.g. launch check failed, rolled back) | Nothing changed; the agent is still running its previous version |
Each agent has at most one open update task: clicking Update again while one is pending reuses it instead of queueing another. Judge success by the Version column on the Agents page, which comes from the agent's own heartbeat.
Publishing a new version
Agent versions are shared by the whole install: every agent updates to the newest version registered for its platform, whatever organization it belongs to. So when the install uses Clerk organizations, only an administrator who is not signed in to an organization can build, upload, register or delete a version. A user or API key in an organization can see the versions and update its own agents, but gets 403 when changing them.
Go to Settings → Agent. There are two ways to publish.
Build Agent Binary (recommended)
The server compiles the agent from the git repository in AGENT_REPO_URL (branch AGENT_REPO_BRANCH, default main). Before every build it fetches the latest commit, so a build always uses the current branch and doesn't depend on when the server was last deployed. Windows builds are signed with the active code-signing certificate.
- The version you type is compiled into the binary, so its label and what it reports always match.
- The Source column under Registered Versions shows the commit the version was built from, e.g.
1bbe749. Check it against your repository before agents pick the version up. An ambersource says <version>line means the code on the server was older than the number you typed. For a binary that was uploaded or registered from a file, the column shows the notes typed at that time, and the server refuses notes that start withBuilt from source, so a commit in this column always comes from a build the server made. - Docker and server installs build from the server's own checkout (the repository folder the containers were started from), so run
git pullthere before Build from source. A build made first compiles the old code under the new version number. The release notes show the checked-out commit, and add(source says 0.7.2)when the agent version in the source differs from the version you typed. Agents that already installed such a build don't take a corrected rebuild of the same version; they update with the next version. - If the server can't reach the repository, the build fails rather than compiling possibly stale code.
Upload Agent Binary
Upload a binary you built yourself, e.g. a CI release artifact. The server reads the version compiled into the file and rejects the upload (HTTP 422) unless it matches the version you entered:
Version mismatch: this binary was built as 0.6.3 but is being registered as 0.6.4.
Binaries built without a version stamp are rejected too, because the version they would report can't be verified. Build with make build-all VERSION=<version>, and check a file before uploading with:
go version -m achilles-agent-windows-amd64.exe | grep ldflags
# build -ldflags="-s -w -X main.version=0.6.6"
If a binary's embedded version differs from the version it's registered as, every agent that installs it restarts still reporting the old version, is offered the "new" version again, and reinstalls it in a loop until it hits rate limits. The upload check prevents this. Agents 0.6.5 and later also refuse to reinstall the same file (same SHA256) that didn't change their version.
Rolling out safely
- Publish one platform first (usually Windows), watch one or two online agents update and keep heartbeating, then publish the other platforms.
- To stop a rollout, delete the version under Registered Versions. Agents that haven't updated yet stay on their current version.
- Build versions for every platform you run. Agents only see versions registered for their own OS and architecture.
Endpoint security (Microsoft Defender ASR)
Every new build is a binary no endpoint has seen before. The Defender attack surface reduction (ASR) rule "Block executable files from running unless they meet a prevalence, age, or trusted list criterion" (01443614-cd74-433a-b99e-2ecdc07bfc25) blocks exactly that. In Block mode, Windows refuses to start the updated agent ("Access is denied", Defender event 1121). Agents 0.6.6 and later detect this and roll back. Older agents go offline.
Add a per-rule exclusion for the agent folder, for this rule only. In Intune: Endpoint security → Attack surface reduction → your ASR policy → the rule above → ASR Only Per Rule Exclusions → Add:
C:\F0
The same exclusion lets the security tests and their stage binaries start. Endpoint Prerequisites has the Group Policy steps, why it is safe, and what it costs.
- Use the per-rule list, not the global "ASR Only Exclusions". The global list exempts the folder from every ASR rule, so the tests would no longer be judged by them.
- Exclude the folder only where it is locked. Agents 0.7.1 and later (and the bootstrap script) restrict
C:\F0to SYSTEM and Administrators. On an older agent installed without the bootstrap script, update the agent first. - Don't add a Defender Antivirus exclusion or a certificate "Allow" indicator. The agent and all test binaries are signed with the same certificate, so trusting it would let every test through.
To confirm on an endpoint:
- A Defender event 5007 (configuration changed) shows the policy arrived.
- The best proof is the next update: the agent keeps heartbeating on the new version.
- The other ASR rules still apply to the tests: when a test trips one of them, event 1121 names that rule's GUID, not
01443614.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
Agent goes offline right after an update; the service is STOPPED with SCM event 7000 "Access is denied" | Endpoint security blocked the new binary (agents before 0.6.6) | Add the ASR exclusion above, let the policy sync, then run sc start AchillesAgent |
| Update task Failed: "new agent binary failed its launch check … rolled back" | Same block, caught by a 0.6.6+ agent, which stays on its current version | Add the exclusion. The next update check retries |
| An agent downloads the same version every few seconds and never changes version | The binary's embedded version doesn't match its registered version | Delete that version under Registered Versions, then publish a correctly built one |
| Upload rejected with 422 | Embedded version missing or different from the one entered | Rebuild with VERSION=<version>, or register it as the version it reports |
| Build fails: "Could not refresh agent source from git" | Server can't reach AGENT_REPO_URL | Check network access and GITHUB_TOKEN, then retry |
| Update task stuck in Executing | Agents before 0.6.5 sent a result the server rejected | Cosmetic: check the Version column. Fixed in 0.6.5 and later |