runstate docs
runstate is the coordination backbone for agent swarms. Your agents keep running where they run; runstate keeps their shared work, rate limits, budgets and results consistent.
Once you run more than a handful of agents in parallel, they start stepping on each other: two agents do the same task, fifty agents hit the same API and retry together, the swarm overspends overnight, and work disappears when a worker crashes.
runstate is a hosted service with TypeScript and Python SDKs that holds the state your agents need to agree on: which work is done and what its result was, how much of a shared rate limit is left, how many slots are free, how much budget is committed, and whether the run should stop. It keeps that state correct when individual agents crash, restart or run late.
runstate does not run your agents, call your models or sit in your request path. Your agents, prompts and frameworks stay where they are. You wrap the functions where agents would otherwise collide, and call them as before.
Start here
Section titled “Start here”Guides
Section titled “Guides”Each guide covers one problem teams hit when they go from one agent to many, in the order most teams run into them.
Reference
Section titled “Reference”What it looks like
Section titled “What it looks like”Wrap a function once where you define it, then call it as before:
import runstate from 'runstate-sdk'; // reads RUNSTATE_API_KEY and RUNSTATE_SPACE_ID
// Runs once per run for the same arguments. Every caller gets the same result.const research = runstate.once(researchCompany);
// Every agent draws from one search-API limit and waits its turn.const search = runstate.limit('search-api', searchWeb, { max: 60, per: 'minute' });
// At most five browsers at once, across every machine.const browse = runstate.slots('browser', openPage, { max: 5 });
// One spend ceiling for the whole swarm.const ask = runstate.budget('model-usd', callModel, { reserve: 0.4, cost: (r) => r.usd, limit: 50 });
await research('acme');await runstate.stop(); // every worker stops taking new workimport runstate # reads RUNSTATE_API_KEY and RUNSTATE_SPACE_ID
# Runs once per run for the same arguments. Every caller gets the same result.@runstate.oncedef research_company(name: str) -> dict: ...
# Every agent draws from one search-API limit and waits its turn.@runstate.limit("search-api", max=60, per="minute")def search_web(query: str) -> list: ...
# At most five browsers at once, across every machine.@runstate.slots("browser", max=5)def open_page(url: str) -> str: ...
# One spend ceiling for the whole swarm.@runstate.budget("model-usd", reserve=0.40, cost=lambda r: r.usd, limit=50)def call_model(prompt: str): ...
research_company("acme")runstate.stop() # every worker stops taking new workThe SDKs cover TypeScript and Python. From any other language, use the HTTP API directly.
Status
Section titled “Status”The hosted preview is paused while the service is rebuilt. There is nothing to sign up for right now; join the waitlist and we will write when it reopens.
For agents and LLM tools, this site is also available as llms.txt, and every page has a Markdown version (add .md to the path, or use Copy page).