Skip to content

Align the Agent37 backend with its agents API docs - #1424

Draft
ReganBell wants to merge 1 commit into
mainfrom
sandbox/agent37-docs-alignment
Draft

ReganBell wants to merge 1 commit into
mainfrom
sandbox/agent37-docs-alignment

Conversation

@ReganBell

Copy link
Copy Markdown
Contributor

Aligns the Agent37 backend with the Agent37 agents API documentation.

  • Branch on the documented error code instead of message text; wait out capacity codes, never blindly retry exec, and report the instance limit clearly.
  • Size client aborts to the documented 780 second exec cap, which includes a cold wake.
  • Move file reads and writes to the instance files endpoints.
  • Add AGENT37_IDLE_TIMEOUT_SEC, pin the template version, tag instances and look them up by tag, and validate shapes and name length at startup.
  • Surface backups as the recovery checkpoint, take an on-demand backup at teardown, and implement restart.
  • Correct the ADR's exec cap, idle default, and files API claims.

Docs: https://www.agent37.com/docs/agents-api/errors.md https://www.agent37.com/docs/agents-api/exec.md https://www.agent37.com/docs/agents-api/files.md https://www.agent37.com/docs/agents-api/instances.md

Needs live QA before merge.

Errors: every failure is branched on the error.code in the response body
instead of the HTTP status or message text. try_again, capacity_unavailable,
an invalid_request on a waking instance and the instance-URL codes for a
container that is not up bring the instance to running and retry once;
no_capacity on create is waited out; instance_limit_reached is reported with
a clear message; provisioning_failed on a running instance is never retried
because the command may still be running.

Timeouts: the exec call waits up to 780 seconds including a wake, so the
client abort is sized to that cap plus a margin for every exec and file
request instead of 150 seconds for the launch and poll execs. Commands of up
to 600 seconds run synchronously, leaving room for the two-minute wake from
cold storage; longer ones run detached as before.

Files: reads, writes, spooled output and export archives go through
PUT/GET /v1/files/content on the instance URL with X-Agent37-Key, which
stream any size, instead of 64 KB / 256 KB base64 exec chunks.

Lifecycle: AGENT37_IDLE_TIMEOUT_SEC maps to idle_timeout_seconds (300 to
86400, default 900); the default template is pinned to
agent37-codex@2026.09.14b; instances carry user and metadata tags naming the
qm prefix and scope or scratch key and are found by those tags, adopting and
tagging a name-only instance once; cpu/memory/disk are validated against the
fixed 2/4, 4/8 and 8/16 shapes and the name prefix against the 60-character
name limit at construction.

Recovery: computerStatus reports the newest nightly or on-demand backup as
the provider_snapshot recovery point without waking a sleeping instance;
teardown after a turn that touched the home requests an on-demand backup;
restartComputer wakes the instance if needed and recreates its container
through POST /restart.

The ADR now states the 780-second exec cap, the 900-second default idle
timeout and the files API.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant