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.

Tip
Setup is two steps

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.tgz

This 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.

Bash
claude mcp add latentstack-agents -e LATENTSTACK_API_KEY=ls-… -- latentstack-agents-mcp

Restart 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_URLYour LatentStack URL, if it isn't https://latentstack.dev.
LATENTSTACK_DEFAULT_MODELThe 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:

ToolWhat it does
create_sessionStarts an agent with a task, optionally on your GitHub repositories, with spend caps and settings of your choice.
wait_for_sessionWaits until the agent finishes or needs you, and reports what happened.
reply_approval · answer_questionAnswers the agent when it asks before doing something (see Approvals).
send_message · cancel_runGives the agent more instructions, or stops what it is doing.
get_patch · list_outputsThe changes the agent made, and the files it kept for you.
list_files · read_file · write_fileReads and writes files in the agent's workspace.
fork_sessionStarts a second agent from where this one is, to try another approach (Fork a session).
update_limitsRaises or lowers spend caps; an agent paused at a cap carries on.
get_session · list_sessions · get_eventsStatus, spend, and what the agent has been doing.
pause_session · resume_session · delete_sessionPause, continue or end a session (Manage sessions).
create_schedule · run_scheduleRuns an agent on a clock, or once right now (Schedules).
list_schedules · get_schedule · update_schedule · list_schedule_runs · delete_scheduleYour schedules: when each runs next, how past runs went; pause, change or remove one.
list_modelsThe 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 8765
Each person connects with
claude mcp add --transport http latentstack-agents http://your-host:8765/mcp \
  --header "Authorization: Bearer ls-…"

Good to know

Warning
Permission rules cannot stop a push

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.