Deploy your first agent
From an empty folder to a private agent you call from the playground, your terminal and your code.
Tutorial
Before you start
You need three things:
- Node.js 22.19 or later, for the Skrun CLI.
node --versiontells you which one you have. - A GitHub account: you sign in to skrun.sh with it.
- An API key from a model provider: Anthropic, OpenAI, Google, Mistral, Groq or xAI. skrun.sh does not supply model access: your agent calls its model with your key, and the provider bills you for what it uses.
1.Create your account
Go to the sign-up page and choose Continue with GitHub. The page names the terms you accept by continuing. Once GitHub confirms, you land in your dashboard.
Create the account here, on skrun.sh, before you use the CLI: Sign in from the CLI signs in to this account.
2.Install the CLI
npm install -g @skrun-dev/cli
skrun --versionThe second command prints the CLI's version: 2.0.0 or later.
3.Sign in from the CLI
skrun login --registry https://api.skrun.sh--registry tells the CLI where skrun.sh is. The CLI keeps that address with your sign-in, and the commands you run next go there.
The CLI prints a one-time code and opens the Authorize Skrun CLI page in your browser, with the code filled in. Check that it matches the one in your terminal, choose Continue with GitHub, and use the account you just created. Only ever continue for a skrun login you ran yourself.
When the page says you are all set, go back to your terminal: the CLI has saved a key in ~/.skrun/config.json. That key is tied to https://api.skrun.sh, the address it came from, and the CLI sends it nowhere else. It also expires; when it does, run skrun login again.
Then check who you are signed in as:
skrun whoamiIt prints your namespace (your GitHub username) and the address the CLI talks to, https://api.skrun.sh. Your agents live under that namespace: in the commands below, replace <you> with it.
4.Create an agent
skrun init my-agent
cd my-agentskrun init asks for the agent's name (keep my-agent to follow along), a description and a model: pick a model from the provider you have a key for. It then writes two files in the my-agent folder:
SKILL.md: your agent's instructions, in Markdown. It follows the Agent Skills format, so aSKILL.mdyou already have works as is:skrun init --from-skill <path>builds an agent around it.agent.yaml: the agent's settings (its name, its version, its model, and what it takes and returns). As created, it takes one input,query, and returns one output,result.
Edit SKILL.md to tell your agent what to do. A first agent needs nothing more than what skrun init writes; you can change the model later, in agent.yaml.
5.Deploy
From the agent's folder:
skrun deployIt checks the agent, builds it, publishes it as a new version and prints its address. To attach a note to the version, add -m "your note".
A version is published once: to deploy a change, raise version in agent.yaml first.
6.Confirm the endpoint
Among the last lines skrun deploy prints is your agent's address:
POST https://api.skrun.sh/api/agents/<you>/my-agent/runThe agent also appears under Agents in your dashboard. It is private: only your account, and the API keys you create, can call it. Any other account gets a 404, as for an agent that does not exist.
7.Choose who pays for the model
Every run needs a key for your agent's model. There are two ways to give it one:
- Callers send their own key with each call: in the playground, in the optional LLM API key field; from code, in the
X-LLM-API-Keyheader. Their model provider bills them. This is how a client pays for their own model: see Host an agent for a client. If your agent declares a fallback model from another provider and the caller's key fails before any tool has run, the fallback uses the caller's key for that provider, or else the key you attached for it, if you attached one. - You attach yours to the agent: every call that sends no key of its own uses it, and your model provider bills you. Set the agent's caller-key policy to creator-only, and it refuses the keys callers send.
For this guide, attach yours: it is the shortest way to a first result, and From your terminal runs your agent on the key you attached. Attach it now, after the agent exists and before its first call:
skrun llm-key set <provider> --agent <you>/my-agent --key-env <VARIABLE><provider> is the provider of your agent's model (anthropic, openai, google, mistral, groq or xai), and <VARIABLE> is the environment variable that holds your key, such as ANTHROPIC_API_KEY. The CLI also reads a key piped to it. Never write the key itself in the command: your shell history would keep it.
Or attach it in your dashboard: open the agent from Agents, and in its LLM keys card pick the provider, paste the key and choose Attach.
Either way, the key is stored encrypted and never shown again.
8.Make your first call in the playground
Open your agent from Agents and choose Try in playground. In the Input card, give it a query, as JSON (such as {"query": "What can you do?"}) or with the form, then choose Run agent. The result appears under Output.
You need no API key here: your dashboard session is enough. Leave LLM API key empty, and the run uses the model key you attached.
9.From your terminal
The CLI runs your agent with your CLI session and the model key you attached. Put the input in a file:
{ "query": "What can you do?" }skrun run <you>/my-agent -f input.jsonIt waits for the run to finish, then prints the result as JSON, with your agent's answer under output. A file works the same in every shell.
Or inline:
skrun run <you>/my-agent -i '{"query": "What can you do?"}''{"query": "What can you do?"}' | skrun run <you>/my-agent --stdinPowerShell does not always pass the quotes inside an argument on to the program it calls; piping the JSON avoids the question.
10.Your API key
Your own code needs an API key. Create one in your dashboard: open Settings and, under API Keys, choose Create Key. Give it a name, then choose:
- its access: Run-only if your code only runs agents;
- its scope: One agent, then this agent, if your code calls only this one;
- its expiration: 90 days is preselected.
The key is shown once: copy it then, and keep it in an environment variable or a secret store, never in your code. Below, the variable SKRUN_API_KEY holds it.
Revoke a key from the same page at any time: it stops working at once.
The CLI creates the same key:
skrun keys create --name my-app --agent <you>/my-agent --run-only --expires-in 90It prints the key once, with its id. A key created from the CLI without --expires-in never expires.
11.From your code
From any language, a run is one HTTPS request. With curl:
curl -N https://api.skrun.sh/api/agents/<you>/my-agent/run \
-H "Authorization: Bearer $SKRUN_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{"input": {"query": "What can you do?"}}'Keep the Accept: text/event-stream header: skrun.sh runs an agent as a stream of server-sent events, and a call without it fails (see When something fails). -N tells curl to print the events as they arrive. The stream opens with run_start, carries events while your agent works, and ends with run_complete, whose output is the result, or with run_error if the run failed. Skip the event types you do not use: new ones get added over time.
event: run_start
data: {"run_id":"…",…}
…
event: run_complete
data: {"run_id":"…","output":{"result":"…"},…}With the SDK, for JavaScript and TypeScript:
npm install @skrun-dev/sdkimport { SkrunClient } from "@skrun-dev/sdk";
const client = new SkrunClient({
baseUrl: "https://api.skrun.sh",
token: process.env.SKRUN_API_KEY,
});
const result = await client.run("<you>/my-agent", { query: "What can you do?" });
console.log(result.output);Run it with node call-agent.mjs. client.run() reads the stream for you and returns the result once the run ends; client.stream() hands you the events one by one instead.
When something fails
| You see | Why | Fix |
|---|---|---|
skrun whoami prints an address other than https://api.skrun.sh | A SKRUN_REGISTRY_URL variable in your environment points the CLI elsewhere, or you ran skrun login without --registry: the CLI then targets a local address, not skrun.sh | If that variable is set, remove it and open a new terminal. Then run skrun login --registry https://api.skrun.sh |
| The CLI refuses a sign-in saved by an older version | A key is now tied to the address it came from, and a sign-in saved by an older CLI is not | Run skrun login --registry https://api.skrun.sh |
skrun login gives up before you are signed in | The browser step was not finished in time, or the GitHub sign-in was declined | Run skrun login --registry https://api.skrun.sh again; if signing in on the web fails too, go to Sign in |
skrun login says it could not reach the address | The address after --registry is wrong, or your network blocks it, or you left out --registry: the CLI then targets a local address, not skrun.sh. Nothing was saved | Check the address, then run skrun login --registry https://api.skrun.sh again |
401 | The key expired, or was revoked | For the CLI, run skrun login --registry https://api.skrun.sh; for your code, create a new key in Settings |
skrun deploy says “too many arguments” | It takes no folder: it deploys the one you are in | cd into the agent's folder, then run skrun deploy |
409 VERSION_EXISTS | This version of the agent is already published | Raise version in agent.yaml, then deploy again |
404 AGENT_NOT_FOUND from skrun llm-key set | The agent is not deployed yet | Deploy first, then attach the key |
400 LLM_KEY_REQUIRED | No model key can serve the run | Attach your key to the agent, or send one with the call: see Choose who pays for the model |
404 when you call the agent | The namespace or the name is wrong, or the agent belongs to another account (a private agent looks like it does not exist) | Check your namespace with skrun whoami, and the address skrun deploy printed |
403 KEY_SCOPE_FORBIDDEN | The key is limited to another agent, or to running | Use a key whose access and scope cover the call |
400 SYNC_MODE_UNSUPPORTED on an HTTP call | The call asked for a single response, and skrun.sh runs an agent as a stream: the run was not started | Add Accept: text/event-stream. Or pass a webhook_url, or use skrun run or the SDK |
429 | More than 60 calls in a minute from one address, or a limit of your account: too many runs in progress, or its compute time used up for now | Wait as long as the Retry-After header says, then call again |
A run ends with run_error and the code TOO_MANY_TOOL_CALLS, MODEL_OUTPUT_BUDGET_EXCEEDED or OUTPUT_TOO_LARGE | The run crossed one of its bounds: one answer of the model asked for too many tool calls at once, the model's answers in the run were too large in all, or its final answer was too large. An agent that declares its own model endpoint (model.base_url) can also end on MODEL_RESPONSE_TOO_LARGE: one response of that endpoint was too large | See Get help |
skrun whoamiprints an address other thanhttps://api.skrun.shA
SKRUN_REGISTRY_URLvariable in your environment points the CLI elsewhere, or you ranskrun loginwithout--registry: the CLI then targets a local address, not skrun.shIf that variable is set, remove it and open a new terminal. Then run
skrun login --registry https://api.skrun.sh- The CLI refuses a sign-in saved by an older version
A key is now tied to the address it came from, and a sign-in saved by an older CLI is not
Run
skrun login --registry https://api.skrun.sh skrun logingives up before you are signed inThe browser step was not finished in time, or the GitHub sign-in was declined
Run
skrun login --registry https://api.skrun.shagain; if signing in on the web fails too, go to Sign inskrun loginsays it could not reach the addressThe address after
--registryis wrong, or your network blocks it, or you left out--registry: the CLI then targets a local address, not skrun.sh. Nothing was savedCheck the address, then run
skrun login --registry https://api.skrun.shagain401The key expired, or was revoked
For the CLI, run
skrun login --registry https://api.skrun.sh; for your code, create a new key in Settingsskrun deploysays “too many arguments”It takes no folder: it deploys the one you are in
cdinto the agent's folder, then runskrun deploy409 VERSION_EXISTSThis version of the agent is already published
Raise
versioninagent.yaml, then deploy again404 AGENT_NOT_FOUNDfromskrun llm-key setThe agent is not deployed yet
Deploy first, then attach the key
400 LLM_KEY_REQUIREDNo model key can serve the run
Attach your key to the agent, or send one with the call: see Choose who pays for the model
404when you call the agentThe namespace or the name is wrong, or the agent belongs to another account (a private agent looks like it does not exist)
Check your namespace with
skrun whoami, and the addressskrun deployprinted403 KEY_SCOPE_FORBIDDENThe key is limited to another agent, or to running
Use a key whose access and scope cover the call
400 SYNC_MODE_UNSUPPORTEDon an HTTP callThe call asked for a single response, and skrun.sh runs an agent as a stream: the run was not started
Add
Accept: text/event-stream. Or pass awebhook_url, or useskrun runor the SDK429More than 60 calls in a minute from one address, or a limit of your account: too many runs in progress, or its compute time used up for now
Wait as long as the
Retry-Afterheader says, then call again- A run ends with
run_errorand the codeTOO_MANY_TOOL_CALLS,MODEL_OUTPUT_BUDGET_EXCEEDEDorOUTPUT_TOO_LARGEThe run crossed one of its bounds: one answer of the model asked for too many tool calls at once, the model's answers in the run were too large in all, or its final answer was too large. An agent that declares its own model endpoint (
model.base_url) can also end onMODEL_RESPONSE_TOO_LARGE: one response of that endpoint was too largeSee Get help
Something else? See Get help.
Next
- Host an agent for a client: give a client a key to one of your agents.
- API reference: the API that skrun.sh runs, route by route.
skrun <command> --help: every option of a command.