Agents APIReference
MCP server
Use hosted agents from Claude Code, Codex, Cursor, VS Code or any other MCP client. Ask your assistant to hand a task to an agent, and it starts one, follows it, and brings back the result.
Install and connect your client. That's all you need; everything after those two sections is there for when you want more.
Install
npm i -g https://latentstack.dev/dl/latentcode-agents-mcp-0.1.0.tgzThis installs the latentstack-agents-mcp command. You need Node 20 or newer and an API key (ls-…) from your LatentStack account.
Connect your client
Run once in your terminal.
claude mcp add latentstack-agents -e LATENTSTACK_API_KEY=ls-… -- latentstack-agents-mcpRestart the client or reload its MCP servers, and the latentstack-agents tools appear. You're set up; the sections below are extras.
Settings
Set these next to LATENTSTACK_API_KEY, the same way: -e NAME=value for Claude Code, or more entries in env for the config files. In Claude Code, --scope user makes the server available in every project.
| Setting | |
|---|---|
| LATENTSTACK_BASE_URL | Your LatentStack URL, if it isn't https://latentstack.dev. |
| LATENTSTACK_DEFAULT_MODEL | The model agents use unless you name another. Without it, your assistant picks one from the models your plan allows. |
What you can ask for
Once connected, ask in plain words. For example:
Start an agent on acme/payments to fix the failing tests, and show me the diff when it's done.
Fork that session and try it without the cache.
Pause it; I'll come back to it tomorrow.
Every weekday at 9:30 IST, run an agent on acme/payments that writes a standup from yesterday's commits.Your assistant uses these tools on your behalf:
| Tool | What it does |
|---|---|
| create_session | Starts an agent with a task, optionally on your GitHub repositories, with spend caps and settings of your choice. |
| wait_for_session | Waits until the agent finishes or needs you, and reports what happened. |
| reply_approval · answer_question | Answers the agent when it asks before doing something (see Approvals). |
| send_message · cancel_run | Gives the agent more instructions, or stops what it is doing. |
| get_patch · list_outputs | The changes the agent made, and the files it kept for you. |
| list_files · read_file · write_file | Reads and writes files in the agent's workspace. |
| fork_session | Starts a second agent from where this one is, to try another approach (Fork a session). |
| update_limits | Raises or lowers spend caps; an agent paused at a cap carries on. |
| get_session · list_sessions · get_events | Status, spend, and what the agent has been doing. |
| pause_session · resume_session · delete_session | Pause, continue or end a session (Manage sessions). |
| create_schedule · run_schedule | Runs an agent on a clock, or once right now (Schedules). |
| list_schedules · get_schedule · update_schedule · list_schedule_runs · delete_schedule | Your schedules: when each runs next, how past runs went; pause, change or remove one. |
| list_models | The models your plan allows. |
Share one server with your team
Run it once over HTTP and point everyone's client at it. Each person connects with their own key, so their sessions and spend stay their own.
latentstack-agents-mcp --transport http --port 8765claude mcp add --transport http latentstack-agents http://your-host:8765/mcp \
--header "Authorization: Bearer ls-…"Good to know
An agent on a repository can push to branches your GitHub access allows, even with a rule like { "action": "bash", "resource": "git push*", "effect": "ask" }. If it should not push, say so in its instructions.