Reference
MCP tools
Generated from Annex's MCP server. Tools with an action group related operations; the badges list the actions. Connect with these steps.
Start a sandbox
sandbox_createStarts a new sandbox (a Linux computer) on one of the user's connected provider accounts and waits until it is running. Use it when you need somewhere to run commands or keep files, but first check sandbox_list for a running one you can reuse. It costs the user money from the moment it starts until sandbox_stop, billed by their provider at rate_per_hour_micros (millionths of a US dollar an hour), so pick the smallest size that will do. Route fastest goes by start-up times measured from Annex's servers in Europe, so a provider far from Europe can look a little slower than it would be near it. Pass task to put it in an existing task (to fan work out; see task_queue, and task_plan for how many). Each sandbox gets ANNEX_URL, ANNEX_WORKSPACE_ID, ANNEX_TASK_ID and ANNEX_TASK_TOKEN in its environment: the token reaches only its task's queues, key-value store and memory, and stops working when the sandbox stops. Pass secret_groups (names from workspace_info secret_groups, granted to this API key) to add the user's secrets as environment variables; a sandbox joining a task gets the task's groups. Their values are hidden as ••••NAME in output Annex shows you; never print them on purpose. A new task gets an automatic checkpoint about 5 minutes after the first change, then every 30 minutes while something changes, and if its provider ends it while you're using it, Annex carries on in a new sandbox from the newest checkpoint (auto_checkpoint_minutes and auto_resume change that). Annex stops it a day after it starts (lifetime_minutes, up to 7 days) and after an hour with no command running and no use through Annex (idle_minutes, 0 is off). Starts past the workspace's or this key's limit on sandboxes running at once, its monthly spend limit, its per-sandbox CPU/memory ceilings, or outside its operating hours are refused (workspace_info limits). A sandbox its provider ended shows status lost, with replaced_by naming the new sandbox when Annex carried on; calls on it say which one to use. isolation and requires narrow where it may start (a VM only, an arm64 processor…). With dry_run true it starts nothing and returns route: the accounts it would try in order with price, start-up and why, the ones left out with each check they failed, and the smallest changes that would make more eligible. Returns the sandbox: its id (pass it to the other sandbox_* tools), task, provider, region, size, status and hourly rate.
annex_accountsstringwhere Annex's own provider accounts (paid from the workspace's Annex credit, see
workspace_infocredits) go, finer thanuse_credit:afterthe user's own accounts,first,only, oroff. Leave both out for the user's own accounts onlyauto_checkpoint_minutesnull | integerSave a checkpoint automatically this many minutes after something changed: 0 is off, 5 to 60. Default 30 for a new task, off when joining one; the first comes about 5 minutes after the first change (later when Annex is busy). Each one uses some of the sandbox's time and sends only new files out; Annex keeps the newest 3.
auto_resumenull | booleanIf the provider ends this sandbox while you're using it, start a new one from its newest checkpoint on another of your accounts (the same provider if you named one). Default on for a new task. The new sandbox is billed like any other. Running programs and work since the last checkpoint can't be recovered.
dry_runbooleantrue to start nothing and get back route: the accounts Annex would try in order (with price, start-up and why), the ones left out with every check they failed, and the smallest changes that would make more eligible
fallbacksnull | booleanfalse to try only the first account that fits (no failover); true or left out to move on when one can't start it
idle_minutesnull | integerAnnex stops it after this many minutes with no command running and no use through Annex: 0 is off, up to 1440; 60 if left out.
ignorenull | arrayproviders never to use for this one, added to the workspace's own (
denied_providers); it wins over route, order and providersisolationnull | arrayhow each sandbox may be walled off from its machine:
container(shares the machine's kernel),gvisor(a container behind gVisor's own kernel) orvm(a virtual machine of its own). Providers whose isolation Annex doesn't know are left out. Leave out for anylifetime_minutesnull | integerAnnex stops it this many minutes after it started: 1 to 10080 (7 days); 1440 (a day) if left out.
memory_gibintegermemory in GiB, 1 to 256 (4 if left out); the price grows with it
ordernull | arrayproviders to try first, in this order, such as [
selfhost,daytona]; the rest follow as the route ranks them. Leave out for the workspace's default orderprovidersnull | arrayonly these providers, such as [
selfhost,daytona]. Must be within the workspace's allowed providers. Leave out for whatever the workspace allowsregionstringwhere it should run, such as
us-eastoreu-west, or an area (us,americas,eu,apac,me,af) for any region in it; leave out for anywhere (withfastest, Annex picks a region where it measured quicker starts, else the provider chooses)regionsnull | arrayonly these regions or areas, such as [
eu-london,eu-west] or [eu]; in this order when the account serves several. Must be within the workspace's allowed regions (workspace_infolimits). Leave out for whatever the workspace allowsrequiresnull | arraywhat the provider must offer:
amd64orarm64(its processor),long_lifetime(no cap of its own shorter thanlifetime_minutes). Leave out for nothingroutestringhow to pick the provider:
cheapest,fastest(the account and region that start quickest, by the start-up times Annex measured on the user's accounts, else for that provider across Annex, else the provider's own figure; within 15% the cheaper wins; with no region it starts in a region measured quicker, else where the provider chooses), or a connected provider's name such asdaytona;selfhostis the workspace's own servers, and at $0 an hourcheapestuses them first. Leave out to use the workspace's default route (workspace_infolimits:default_route)secret_groupsnull | arraynames of the user's secret groups to add to its environment, such as [
github]; a later group wins a name. Leave out when joining a task: it gets the task's groupsspotbooleantrue for spare capacity the provider may take back at short notice (AWS only; it falls back to a normal machine; priced as one here)
taskstringa task id (
tsk_…) of this workspace to join, to split one task's work over many sandboxes; leave out for a new tasktemplatestringa template of the workspace to start from, by name (
sandbox_templatelists them): it fills the size, route and secret groups this call leaves out and runs its set-up commands in the new sandbox. Leave out for the workspace's default template if it has one;nonefor no templateuse_creditnull | booleanhow to pay for it: true for Annex credit only (Annex's own accounts), false or left out for the user's own connected accounts only (their own keys). Annex credit must be turned on for the workspace
vcpuintegervirtual CPUs, 1 to 64 (2 if left out); the price grows with it
List sandboxes
sandbox_listLists the workspace's sandboxes, newest first, 25 to a page; by default only the running ones, which are the ones costing money right now. Use it to find a sandbox to reuse before creating one, and to check nothing is left running when you finish; with sandbox_id it returns that one sandbox with every provider tried to start it, and runaway (out_of_memory, cpu or memory when it has been killing processes for lack of memory or flat out for 15 minutes; Annex never stops it for that), and with metrics: true also its CPU, memory and disk use (measured after each command and every minute for 10 minutes after one) and any processes killed for lack of memory, so you can tell whether it needs a bigger size; with logs: true also its log, any provider, running or ended: what Annex wrote about it (commands started, notes, checkpoints, resumes, and alerts such as lost, stopped, out of memory or idle and lifetime stops), what its newest 5 commands printed (the last 32 KB of each Annex has read; read a whole one with sandbox_command_output), and on the user's own server what its main process printed; filter with source and stream, page for older lines. Set status to paused, pausing, resuming, stopped, lost (ended by its provider; replaced_by names the sandbox that carried its task on) or all to see ended ones too, and page to read further; listing costs nothing. Returns each sandbox's id, provider, region, size asked for (vcpu, memory_gib) and machine (the provider's machine it really runs on, its name, vcpu and memory_gib: a provider with fixed sizes rounds up to its smallest that fits), status, hourly rate and cost so far (in millionths of a US dollar), with paging in meta.
logsbooleanwith
sandbox_id: also its log, 25 lines a page (page 1 is the newest; page for older): its task journal lines, what its newest 5 commands printed, and on the user's own server what its main process printedmetricsbooleanwith
sandbox_id: also its CPU, memory and disk measurements, and how many processes ran out of memorypageintegerwhich page of 25, from 1
sandbox_idstringone sandbox's id, for it alone with every provider tried to start it; leave out to list
sincestringmetrics: from this RFC 3339 time, within the last 7 days; the last hour if left out. logs: from this RFC 3339 time
sourcestringlogs: only
journal,commandorcontainerlinesstatusstringrunning(the default),paused,pausing,resuming,stopped,lost(ended by its provider, not by you or Annex) orallstreamstringlogs: only output lines on
stdoutorstderr
Run a command
sandbox_runRuns a shell command in a running sandbox and waits up to wait_seconds (30 by default, at most 60) for it to finish. Use it for builds, tests, installs and anything else you would type in a terminal; the sandbox costs the same per hour whether or not commands run. If it finishes in time you get its status (exited, timed_out or failed), exit_code and output (stdout and stderr together); if it is still going, status is running and you read on with sandbox_command_output and its command_id. Output over 16 KB is cut to its last 16 KB with truncated: true (for very long output, the last 16 KB of its first 64 KB); read all of it with sandbox_command_output.
commandstringrequireda shell command line, such as 'npm test' or 'cd app && make'
cwdstringabsolute directory to run it in; leave out for the home directory
sandbox_idstringrequiredthe sandbox's id, from
sandbox_createorsandbox_listwait_secondsnull | integerhow long to wait for it to finish, 0 to 60; 30 if left out
Read a command's output
sandbox_command_outputReads a command's output (stdout and stderr together), up to 16 KB a call, from where the last call left off, with the command's current status and exit_code. Use it after sandbox_run for a command that was still running or whose output was truncated: leave out cursor to read from the start, then pass back next_cursor until done is true. Reading costs nothing beyond the sandbox's hourly rate. Returns output, next_cursor and done, with the command's current status and exit_code.
command_idstringrequiredthe
command_idthatsandbox_runreturnedcursorstringnext_cursorfrom the last call; leave out to read from the startsandbox_idstringrequiredthe sandbox's id
Work with files
sandbox_filesLists, reads, writes or deletes files in a running sandbox; path is always absolute, such as /home/user/app/main.py. action list gives a directory's entries 100 to a page; read gives a UTF-8 text file of up to 256 KB, 32 KB a call from offset (call again from next_offset while truncated is true); write creates or replaces a file with the text in content; delete removes a file, or a whole directory with recursive. Binary files and files over 256 KB can't be read here: the error says how to download them with Annex's HTTP API. File work costs nothing beyond the sandbox's hourly rate.
action"list" | "read" | "write" | "delete"requiredlist,read,writeordeletecontentstringwrite: the file's new text
offsetintegerread: the byte to start at; pass back
next_offsetpageintegerlist: which page of 100 entries, from 1
pathstringrequiredabsolute path, such as
/home/user/app/main.pyrecursivebooleandelete: also delete a directory with things in it
sandbox_idstringrequiredthe sandbox's id
Change a sandbox's settings
sandbox_updateChanges a running or paused sandbox's safety settings: auto_checkpoint_minutes (0 is off, or 5 to 60), auto_resume (carry on in a new sandbox from the newest checkpoint if its provider ends it), lifetime_minutes (billable minutes; suspended pauses are excluded while frozen and access-hold pauses count, 1 to 10080) and idle_minutes (0 is off, up to 1440). Use it to turn automatic checkpoints on before long work you can't afford to lose, or off for throwaway work, or to give long work a longer lifetime; leave a setting out to keep it. The change itself is free. Each automatic checkpoint uses some of the sandbox's time (and the user's bill) and sends only new files out; a sandbox Annex starts to carry on is billed like any other. Returns the sandbox with its settings.
auto_checkpoint_minutesnull | integerSave a checkpoint automatically this many minutes after something changed: 0 is off, 5 to 60. Default 30 for a new task, off when joining one; the first comes about 5 minutes after the first change (later when Annex is busy). Each one uses some of the sandbox's time and sends only new files out; Annex keeps the newest 3.
auto_resumenull | booleanIf the provider ends this sandbox while you're using it, start a new one from its newest checkpoint on another of your accounts (the same provider if you named one). Default on for a new task. The new sandbox is billed like any other. Running programs and work since the last checkpoint can't be recovered.
idle_minutesnull | integerAnnex stops it after this many minutes with no command running and no use through Annex: 0 is off, up to 1440; 60 if left out.
lifetime_minutesnull | integerAnnex stops it this many minutes after it started: 1 to 10080 (7 days); 1440 (a day) if left out.
sandbox_idstringrequiredthe running sandbox's id
Pause a sandbox
sandbox_pausePauses the SAME sandbox on its original provider account, preserving its files; every sandbox supports this. Close active output streams first. Commands and files are unavailable while paused. pause_mode is suspended when compute and the running slot are released, frozen when a server freezes work but keeps its allocation, or access_hold when the provider has no native suspension and Annex fences access. pause_billing_continues says whether provider cost, Annex lifetime and limits continue. If the response is lost, retry with the same sandbox_id. Never deletes or replaces the sandbox.
sandbox_idstringrequiredthe sandbox's id
Resume the same sandbox
sandbox_unpauseResumes the SAME sandbox_id and original provider account with its retained files. This is different from sandbox_resume, which restores a checkpoint into a NEW sandbox. Repeated calls on a running sandbox do nothing. A natively suspended sandbox checks workspace limits before resuming; an access hold already occupies its slot. There is no failover. A failed native call leaves the lifecycle pending; retry, or use sandbox_pause to keep it paused. Returns the sandbox. Processes and secrets retain their previous values; external connections may need reconnecting.
sandbox_idstringrequiredthe sandbox's id
Stop a sandbox
sandbox_stopStops a sandbox, which stops billing for it right away. Use it as soon as you are done with a sandbox; a new one starts in seconds if you need a computer again. Everything in it, files and running commands, is gone afterwards, so copy out what you need first. Returns the sandbox with status stopped and its final cost in millionths of a US dollar.
sandbox_idstringrequiredthe sandbox's id
Save and manage checkpoints
sandbox_checkpointSaves a running sandbox's work so it can carry on in another sandbox, on any provider: its files, a recipe for its environment, and a note in the task's journal. Use create (the default) before stopping a sandbox you will want back, before a long pause, or to move work to a different machine (more CPU, another provider, another region). It saves root (by default /workspace, else the home folder), leaving out folders that can be rebuilt (node_modules, .venv, __pycache__, target and the like; they are listed in the result) and anything in exclude. It copies files one by one, so pause writes while it runs. Running programs, memory and secrets are not saved. After the first checkpoint, only changed pieces of files are sent. Cost: nothing from Annex, but the sandbox keeps billing while it runs (seconds for a small project, minutes for gigabytes), and some providers charge for data leaving them. create waits up to about a minute; get with checkpoint_id keeps waiting. list pages a sandbox's (sandbox_id) or a task's (task_id) checkpoints; delete removes one (checkpoint_id) for good. files lists a folder of a stored checkpoint (path, else its root) 100 to a page, and read gives one of its UTF-8 text files of up to 256 KB, 32 KB a call from offset: both read Annex's own copy, so they work after the sandbox is stopped, start no sandbox and cost nothing. Returns the checkpoint: status (stored or failed), files, bytes_total, bytes_new, excluded, error.
action"create" | "get" | "list" | "delete" | "files" | "read"create(the default),get,list,delete,filesorreadcheckpoint_idstringget, delete, files and read: the checkpoint; also create, to keep waiting for one started earlier (nothing new is started)
excludenull | arraymore folder or file names to leave out, such as
dataorlogs/*.lognotestringwhere the work stands and what to do next, kept in the task's journal for whoever resumes it
offsetintegerread: the byte to start at; pass back
next_offsetpageintegerlist: which page of 25, from 1; files: which page of 100
pathstringfiles: the absolute folder to list (leave out for the checkpoint's root); read: the absolute path of the file
recipenull | objecthow to rebuild the environment on resume: setup (shell commands run before the files come back, such as 'apt-get install -y ffmpeg') and start (a command started after, such as 'npm run dev')
rootstringabsolute folder to save; leave out for
/workspace, or the home folder if there is no/workspacesandbox_idstringcreate: the sandbox to checkpoint; list: the sandbox whose checkpoints to list
task_idstringlist: the task whose checkpoints to list, instead of
sandbox_id
Resume from a checkpoint
sandbox_resumeStarts a NEW sandbox and restores a stored checkpoint into it, so the task carries on where it stopped. Route it like sandbox_create (cheapest, fastest or a provider's name): any connected provider works, whichever made the checkpoint. It runs the recipe's setup commands, copies the files back and checks every byte against the checkpoint, then runs the recipe's start command; the new sandbox joins the same task, and its journal comes back with the result. Cost: the new sandbox bills from the moment it starts until sandbox_stop, like sandbox_create; a failed resume stops it. The old sandbox keeps billing until you stop it. Waits up to about a minute; if it is still going, call again with resume_id to keep waiting. Returns the resume (status ready or failed, and the new sandbox's id) and, once ready, the task's newest journal entries.
annex_accountsstringwhere Annex's own provider accounts (paid from the workspace's Annex credit, see
workspace_infocredits) go, finer thanuse_credit:afterthe user's own accounts,first,only, oroff. Leave both out for the user's own accounts onlycheckpoint_idstringrequiredthe stored checkpoint to resume
fallbacksnull | booleanfalse to try only the first account that fits (no failover); true or left out to move on when one can't start it
ignorenull | arrayproviders never to use for this one, added to the workspace's own (
denied_providers); it wins over route, order and providersisolationnull | arrayhow each sandbox may be walled off from its machine:
container(shares the machine's kernel),gvisor(a container behind gVisor's own kernel) orvm(a virtual machine of its own). Providers whose isolation Annex doesn't know are left out. Leave out for anymemory_gibintegermemory in GiB, 1 to 256; the checkpointed sandbox's if left out
ordernull | arrayproviders to try first, in this order, such as [
selfhost,daytona]; the rest follow as the route ranks them. Leave out for the workspace's default orderprovidersnull | arrayonly these providers, such as [
selfhost,daytona]. Must be within the workspace's allowed providers. Leave out for whatever the workspace allowsregionstringwhere it should run; leave out for anywhere (with
fastest, Annex picks a region where it measured quicker starts, else the provider chooses)regionsnull | arrayonly these regions or areas, such as [
eu-london,eu-west] or [eu]; in this order when the account serves several. Must be within the workspace's allowed regions (workspace_infolimits). Leave out for whatever the workspace allowsrequiresnull | arraywhat the provider must offer:
amd64orarm64(its processor),long_lifetime(no cap of its own shorter thanlifetime_minutes). Leave out for nothingresume_idstringto keep waiting for a resume started earlier: its id; nothing new is started
routestringhow to pick the new sandbox's provider:
cheapest,fastest, or a connected provider's name; any provider worksuse_creditnull | booleanhow to pay for it: true for Annex credit only (Annex's own accounts), false or left out for the user's own connected accounts only (their own keys). Annex credit must be turned on for the workspace
vcpuintegervirtual CPUs, 1 to 64; the checkpointed sandbox's if left out
Cache dependencies
sandbox_cacheThe workspace's dependency cache: a sandbox's dependency folders (node_modules, .venv) kept by lockfile. Use save after installing dependencies, and restore in a new sandbox instead of reinstalling: each folder is keyed by its lockfile (package-lock.json, pnpm-lock.yaml, yarn.lock, bun.lockb, uv.lock, poetry.lock, Pipfile.lock, requirements*.txt), path, platform and node or python3 version, so only an exact match is restored. Checkpoints save these folders and resumes restore them on their own; call this for anything else. list pages the cached folders, most recently used first; delete removes one by key. Cost: nothing from Annex; the sandbox keeps billing while a save or restore runs. save and restore wait up to about a minute; get with job_id keeps waiting. Returns the job: cached (save), restored_from_cache and cache_misses (restore).
action"save" | "restore" | "get" | "list" | "delete"requiredsave,restore,get,listordeletejob_idstringget: the job save or restore returned, to keep waiting for it
keystringdelete: the entry's key, from list
pageintegerlist: which page of 25, from 1
rootstringabsolute folder to look for lockfiles in (3 levels deep); leave out for
/workspace, or the home folder if there is no/workspacesandbox_idstringsave and restore: the sandbox to save from or restore into
Read and write a task's journal
task_journalA task's record: list is a page of the workspace's tasks, newest activity first (sandboxes, active ones, providers, cost so far); get returns the task (task_id) with its newest sandboxes and checkpoints, the secret groups its new sandboxes get, and a page of its journal (commands run, notes, checkpoints, resumes), newest first. note adds a line to the journal from a sandbox of the task (sandbox_id, text): where the work stands and what is next, for whoever picks it up. secret_groups sets the groups (names granted to this API key) the task's future sandboxes get, for a resume or fan-out; running sandboxes keep theirs. Costs nothing.
action"list" | "get" | "note" | "secret_groups"requiredlist,get,noteorsecret_groupspageintegerlist: which page of 25 tasks; get: which page of 20 journal entries; from 1
sandbox_idstringnote: a sandbox of the task; the note goes in its task's journal
secret_groupsnull | arraysecret_groups: names of groups granted to this API key, in order (a later group wins a name); empty for nonetask_idstringget and
secret_groups: the task (tsk_…), from any of its sandboxestextstringnote: where the work stands and what is next, 16384 characters at most; never secrets
Share work through a queue
task_queueA queue of jobs shared by every sandbox of one task, for fanning work out: create sandboxes with the same task (sandbox_create task=…, or task_plan), push one message per job here, and have each sandbox claim jobs, do them, write results with task_kv, and ack. Inside a sandbox, use its own token: curl -X POST -H "Authorization: Bearer $ANNEX_TASK_TOKEN" -H 'Content-Type: application/json' -d '{}' "$ANNEX_URL/v1/workspaces/$ANNEX_WORKSPACE_ID/tasks/$ANNEX_TASK_ID/queues/jobs/claim". A claimed message not acked within visibility_seconds (300 by default) comes back for another claim; after 5 claims it goes to the queue's dead list. Queues are coordination, not storage: they expire 7 days after the task's last write. action: push (body: any JSON), claim (max, visibility_seconds), ack or release (message_id), depth (one queue's waiting, in flight and dead counts), list (every queue with its counts), dead (a page of the queue's dead messages). Costs nothing.
action"push" | "claim" | "ack" | "release" | "depth" | "list" | "dead"requiredpush,claim,ack,release,depth,listordeadbodyanypush: the message, any JSON value of 256 KB at most
maxintegerclaim: how many messages at most, 1 to 100; 1 if left out
message_idstringack and release: the id claim returned
pageintegerlist and dead: which page of 25, from 1
queuestringthe queue's name, such as
jobs: 1 to 64 of a-z, 0-9, _ and -; not for listtask_idstringrequiredthe task (
tsk_…), from any of its sandboxesvisibility_secondsintegerclaim: how long the messages stay yours before they can be claimed again, 1 to 43200; 300 if left out
Share small results
task_kvA small key-value store shared by every sandbox of one task: results, progress and settings that the task's sandboxes and you read and write. Fan-out: you push jobs with task_queue; each sandbox claims one, writes its result here (such as key results/7), and acks; you then list with prefix results/. Every key has a version; set with version is compare-and-set (0 means the key must not exist yet), so two sandboxes never overwrite each other unseen. Values are JSON of 64 KB at most; everything expires 7 days after the task's last write. action: get, set (value, optional version), delete, list (prefix, page of 25). Costs nothing.
action"get" | "set" | "delete" | "list"requiredget,set,deleteorlistkeystringget, set, delete: 1 to 200 of A-Z, a-z, 0-9 and . _ : / -, such as
results/7pageintegerlist: which page of 25, from 1
prefixstringlist: only keys starting with this
task_idstringrequiredthe task (
tsk_…), from any of its sandboxesvalueanyset: any JSON value of 64 KB at most
versionnull | integerset: only if the key is at this version (0: only if it doesn't exist yet); leave out to always write
Remember and recall
task_memoryLong-term memory for this workspace's agents, kept in the user's own Supermemory account: remember keeps text (such as a decision or what you learned) and returns its id, search finds the closest memories, each with a score from 0 to 1, and forget deletes one by id in the scope it was kept in, and only one this key remembered itself (another's is not found; only a signed-in person can delete any). Every memory says who remembered it (by: a person usr_…, an API key key_…, a sandbox sbx_…, or annex for saved journal notes; null for older ones). scope task keeps a memory with one task (task_id) and workspace shares it with every task of the workspace; a resumed checkpoint gets up to 5 back on its own. settings says whether the user has journal notes saved to memory (only they can change it). Annex sends Supermemory only what you remember or search for, so never put secrets or command output in text. It needs Supermemory connected in the Annex dashboard (Connections), else every call says so; Annex charges nothing, and Supermemory may bill the user's own plan.
action"search" | "remember" | "forget" | "settings"requiredsearch,remember,forgetorsettingsidstringforget: the memory's id, as remember or search returned it
limitintegersearch: how many, 1 to 25; 10 if left out
querystringsearch: what to look for, in plain words, 1000 characters at most
scopestringtaskfor one task's memories (needstask_id), orworkspacefor memories every task shares; not for settingstagsnull | arrayremember: up to 10 short labels, such as
decisiontask_idstringthe task (
tsk_…), from any of its sandboxes; needed for scopetasktextstringremember: what to keep, 16 KB at most; never secrets
Plan a batch of jobs
task_planWorks out how many sandboxes a batch of jobs needs, on which providers, regions and sizes, how long it will take and what it will cost, from the providers' prices and Annex's measured start-up times; plan only calculates and costs nothing. Give jobs, minutes_per_job (or a sample of measured minutes), the size, and any deadline_minutes, budget_usd_micros, regions, providers or max_sandboxes; if a deadline or budget can't be met you still get the best plan, with infeasible saying why and what would work. apply (plan_id) STARTS THE PLAN'S SANDBOXES IN THE TASK, WHICH COSTS THE USER MONEY at est_cost_micros or more until you stop them; confirm the cost with the user first. It is done once per plan and waits up to about a minute; get shows progress. Applying pushes no jobs: push one message per job to the plan's queue with task_queue, and stop each sandbox when its queue runs dry.
action"plan" | "get" | "list" | "apply"requiredplan(work one out; costs nothing),get,listorapply(starts the plan's sandboxes, which costs money)budget_usd_microsnull | integerspend at most this, in millionths of a US dollar ($2 is 2000000)
deadline_minutesnull | numberfinish within this many minutes, start-up included; leave out for no deadline
headroomnull | numberextra sandboxes for slow jobs, as a share: 0.15 (the default) is 15% more
ignorenull | arrayproviders never to use, added to the workspace's own
isolationnull | arrayhow each sandbox may be walled off: container, gvisor or vm; leave out for any
jobsintegerhow many jobs, 1 to 1000000
max_sandboxesnull | integerat most this many sandboxes, 1 to 1000
memory_gibintegermemory per sandbox in GiB, 1 to 256
minutes_per_jobnull | numberhow long one job takes on one sandbox, in minutes; or give sample instead
pageintegerlist: which page of 25, from 1
plan_idstringget and apply: the plan's id (
pln_…)providersnull | arrayproviders allowed, such as [
aws,daytona], within the workspace's own allowed providers; leave out for whatever the workspace allowsqueuestringthe task queue you will push the jobs to;
jobsby defaultregionsnull | arrayregions allowed, such as [
eu-west,eu-central], within the workspace's own allowed regions; leave out for whatever the workspace allowsrequiresnull | arraywhat the provider must offer: amd64, arm64,
long_lifetime; leave out for nothingsamplenull | arraymeasured minutes of some jobs; their median is used as
minutes_per_jobspotstringspare capacity a provider may take back (AWS only):
never(the default),allowedorpreferspreadnull | booleankeep at least a quarter on a second provider when there is one, so one outage doesn't stop the work; true by default
task_idstringrequiredthe task (
tsk_…) the sandboxes are for, from any of its sandboxesvcpuintegervirtual CPUs per sandbox, 1 to 64
Read the workspace
workspace_infoRead-only facts about the workspace, to choose routes, regions and sizes: regions (each region and the connected providers that serve it), usage (sandbox-hours and spend over days 7, 30 or 90), connections (the provider accounts the user connected, with any limits they set; never keys), accounts (per account: how many sandboxes and vCPUs run against its limits, the limits plans use and where they came from, this month's spend as Annex's estimate and as the provider billed it where the user allowed it, and the provider's status; connection_id for one, and for the user's own servers their specs, live readings (metrics: true) and log (logs: true: what the Annex helper there did and saw, and its sandboxes starting, ending and running out of memory)), connectors (every provider Annex can connect, and how), secret_groups (the names of the secret groups this API key may add to sandboxes; never values), measurements (measured start-up times and how often each provider was unavailable, per region and size), limits (concurrent sandboxes for the workspace and this API key, current use and monthly estimated spend, per-sandbox CPU/memory ceilings, operating hours, and the workspace's routing rules: allow or deny lists of regions and providers, each with the owner's note, which every start obeys, Annex credit included; allowed_regions, allowed_providers and denied_providers are what they allow together; only the user changes them, in Settings › Limits and Settings › Rules). credits (the workspace's Annex credit, in early access and off until EVERSONDER turns it on for the workspace: a sandbox_create with use_credit true runs on Annex's own account at a provider and is paid from it; without use_credit, sandboxes run only on the user's own accounts. balance_micros is what is left, and only the user adds credit, in the dashboard). Costs nothing. Connecting accounts, API keys and secret values are for the user in the Annex dashboard, never for agents.
action"regions" | "usage" | "connections" | "accounts" | "connectors" | "secret_groups" | "measurements" | "limits" | "credits"requiredregions,usage,connections,accounts,connectors,secret_groups,measurements,limitsorcreditsconnection_idstringaccounts: one account (
con_…) instead of a pagedaysintegerusage: 7, 30 (the default) or 90
levelstringaccounts with logs:
info(everything, the default),warning(warnings and errors) orerrorlogsbooleanaccounts, with
connection_id: also that server's log, newest first, 25 to a page: what the Annex helper there did and saw, and its sandboxes starting, ending and running out of memorymetricsbooleanaccounts, with
connection_id: also that server's readings: CPU, memory, disk, network and sandboxes against its limitpageintegerconnections, accounts,
secret_groupsand measurements: which page of 25, from 1resolutionstringaccounts with metrics:
raw(the default, about one a minute),1m,5mor1hsandbox_idstringaccounts with logs: only the lines about this sandbox
sincestringaccounts with metrics or logs: since this RFC 3339 time, within the last 7 days (default: the last hour for metrics, all 7 days for logs)
Stop a running command
sandbox_command_stopStops a command sandbox_run started that is still running, and everything it started, as Ctrl+C would: SIGINT, then SIGTERM 2 s later, then SIGKILL 2 s after that. Use it for a command that hangs, runs too long or was a mistake, instead of stopping the whole sandbox; the sandbox and its files stay. It costs nothing. A command that has already ended is an error that says so. Returns the command's status and exit_code as it is then: usually exited with 130, 143 or 137 (the signal that ended it).
command_idstringrequiredthe
command_idthatsandbox_runreturnedsandbox_idstringrequiredthe sandbox's id
Save and use templates
sandbox_templateA template is what new sandboxes start as: a size, a route and set-up commands (installing what the work needs) that Annex runs in each new sandbox before handing it over, on any provider. Use save after working out how to set a sandbox up, so the next one starts ready: give name and the fields to keep; saving under a name that exists replaces that template whole. default true makes it the template every sandbox in the workspace starts from unless sandbox_create names another or none. list shows the workspace's templates, get one, delete removes one (sandboxes already started keep what they have). draft with sandbox_id writes a template from a sandbox you have set up: its size, its route and the commands that were run in it, oldest first; prune them to the ones that matter, then save with a name. Templates cost nothing. The set-up commands run in the first sandbox; Annex then saves the files they changed and puts them back in later sandboxes on the same provider and kind of machine instead of running them again (setup.note says when), unless always_run is true. Returns the template, or templates for list.
action"list" | "get" | "save" | "delete" | "draft"list(the default),get,save,deleteordraftalways_runbooleansave: true to run the set-up commands in every sandbox and never reuse their saved result; needed when a command starts a program that must be running
defaultbooleansave: true to make it the template every start in the workspace uses unless it names another
descriptionstringsave: a sentence on what it is for
memory_gibintegersave: memory in GiB, 1 to 256; leave out to let each start decide
namestringthe template's name: lower-case letters, digits and dashes, such as
node-dev; needed for get, save and deleteregionstringsave: a region code such as
eu-central; leave out for anywhereroutestringsave:
cheapest,fastestor a provider's name; leave out to let each start decidesandbox_idstringdraft: the sandbox to write a template from
secret_groupsnull | arraysave: names of secret groups added to each sandbox's environment
setupnull | arraysave: shell commands run in order in a new sandbox, such as ['apt-get update && apt-get install -y ripgrep', 'npm i -g pnpm']; the first that fails stops the rest. At most 30. Annex saves what they changed on disk after the first run and puts it back in later sandboxes instead of running them again (files only: not running programs, not
/tmp)vcpuintegersave: virtual CPUs, 1 to 64; leave out to let each start decide
See and report what each run did
task_runA task's runs: one execution of work, start to end. Annex records each webhook call as a run on its own (received, each attempt, how it ended, the task's journal lines from its sandbox), and the agent may start runs of its own and report on any. status: queued (waiting for a running sandbox or the agent), running, stuck (nothing heard within its timeout, 10 minutes by default; it can still finish), succeeded, failed (the agent said so, or 5 attempts failed), delivered (written into the sandbox with no command: report on it to say what happened), cancelled. may_have_run_twice says an attempt started while an earlier one may still have been working. A call whose run has ended is never handed out again. list (page) newest first; get (run_id) with events and cost_micros (its sandboxes while it ran, shared with anything else there) plus agent_cost_micros (what the agent reported). start (name, timeout_seconds) a run of your own; event (run_id, kind such as step, tool, log or usage, text, cost_micros); heartbeat (run_id, timeout_seconds) keeps it from going stuck, keeps the call's queue claim, and answers cancel: true once cancelled; finish (run_id, status succeeded or failed, result, error, cost_micros); cancel (run_id): a queued call is handed to no one and a running webhook command is stopped; replay (run_id): a webhook call sent again as a new run, within 7 days. Inside a sandbox the webhook's command gets ANNEX_RUN_ID, and the delivered JSON has run. Costs nothing.
action"list" | "get" | "start" | "event" | "heartbeat" | "finish" | "cancel" | "replay"requiredlist,get,start,event,heartbeat,finish,cancelorreplaycost_microsintegerevent, finish: what it cost you apart from sandboxes (model calls), in micro-dollars
errorstringfinish: why it failed
kindstringevent: step, tool, log, error, usage or your own word (lowercase, 32 characters at most)
namestringstart: what the run is, 60 characters at most
pageintegerlist: the page, from 1; 25 runs a page
resultstringfinish: a short summary of the outcome
run_idstringevery action but list and start: the run (
run_…)statusstringfinish: succeeded or failed
task_idstringrequiredthe task (
tsk_…), from any of its sandboxestextstringevent: what happened, 2,000 characters at most (secret values of the sandbox are taken out)
timeout_secondsintegerstart, heartbeat: how long it may go quiet before it is stuck, 30 to 86400 (600 by default)
Send run events to your URL
task_run_subscriptionSend a task's run events to a URL of yours as they happen: run.started, run.succeeded, run.failed, run.stuck, run.cancelled, run.delivered. Each is a POST of {id, type, created_at, run} with Annex-Event and Annex-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<body>" keyed with the secret>; any 2xx counts, else it is tried 3 more times over about 6 minutes. create (url: https, events: all if left out) answers the secret once; list with each one's last try; delete (subscription_id). 5 per task.
action"create" | "list" | "delete"requiredcreate,listordeleteeventsnull | arraycreate: which of run.started, run.succeeded, run.failed, run.stuck, run.cancelled, run.delivered; all if left out
subscription_idstringdelete: the subscription (
rsb_…)task_idstringrequiredthe task (
tsk_…), from any of its sandboxesurlstringcreate: an https URL of yours
Receive calls from other services
task_webhookInbound webhooks for a task: a secret URL (such as for GitHub, Stripe or Slack to call) whose every request reaches the task's sandboxes. create (name, deliver, command, queue, wake) answers its url once: keep it, Annex keeps only a hash. deliver sandbox (the default): Annex writes each request into the task's newest running sandbox as JSON at /tmp/annex-inbox/<webhook id>/<message id>.json ({method, query, headers, body or body_base64, from, received_at}) and, with command, runs it there with the file on stdin and ANNEX_WEBHOOK_FILE set (exit 0, or it is tried again, 5 times at most); requests wait on the webhook's own queue (named after it) while no sandbox of the task runs. deliver queue: they only wait on a queue (webhooks, or queue), for the agent to claim with task_queue or its task token. list every webhook of the task with its deliveries; delete (webhook_id) revokes one. A sender's retry with the same delivery id (Idempotency-Key, Webhook-Id, X-GitHub-Delivery) is taken once. Inside a sandbox, its own token makes one: curl -X POST -H "Authorization: Bearer $ANNEX_TASK_TOKEN" -H 'Content-Type: application/json' -d '{"name":"github"}' "$ANNEX_URL/v1/workspaces/$ANNEX_WORKSPACE_ID/tasks/$ANNEX_TASK_ID/webhooks". Costs nothing.
action"create" | "list" | "delete"requiredcreate,listordeletecommandstringcreate, deliver sandbox: run in the sandbox for each request, with it on stdin; leave out to only write the file
deliverstringcreate:
sandbox(the default: Annex writes each request into a running sandbox of the task) orqueue(they wait on the queue for the agent to claim)namestringcreate: a name for you, such as
github; 60 characters at mostqueuestringcreate, deliver queue only: the task's queue the requests go on;
webhooksif left out (a sandbox webhook has its own)task_idstringrequiredthe task (
tsk_…), from any of its sandboxeswakebooleancreate, deliver sandbox: resume the task's newest paused sandbox when a call finds none running (a call never pauses or stops one)
webhook_idstringdelete: the webhook (
whk_…)