You can hand a long task from Claude Code, Codex or Cursor to a cloud agent by adding Lark as an MCP server. From there it can also become a job that runs on its own, on a schedule or a webhook. One command connects it:
claude mcp add --transport http lark https://dashboard.larkbot.app/mcp
Then say "Hand this off to Lark: …". A Lark agent picks up the task on its own cloud computer (a Linux VM with a shell, files and a browser), while your laptop and your coding session stay free. Your coding agent follows the run, brings you the Lark agent's questions, and saves the report and files it made into your project.
Why hand off a task to a cloud agent
Some work doesn't belong in your local session:
- It's long. A Lark run can last 24 hours by default, up to 7 days, and keeps going after you close your laptop.
- It needs a browser. Research across many sites, a form to fill in, a UI to click through.
- It would block you. A big data job, a slow build, or a scrape you don't want running on your machine.
The flow is four steps: you ask; it runs in a VM; you answer if it's stuck; you get the results back in your project.
Add Lark as an MCP server
No API key is needed. Add the server, then sign in with your Lark account in the browser window that opens.
Claude Code
claude mcp add --transport http lark https://dashboard.larkbot.app/mcp
The first time it's used, your browser opens Lark. If it doesn't, run /mcp in Claude Code and choose lark, then Authenticate.
Codex
codex mcp add lark --url https://dashboard.larkbot.app/mcp
# then sign in (opens your browser):
codex mcp login lark
Cursor
Add Lark to ~/.cursor/mcp.json:
{ "mcpServers": { "lark": { "url": "https://dashboard.larkbot.app/mcp" } } }
Claude Desktop
In Settings, then Connectors, choose Add custom connector, name it Lark, and use the URL https://dashboard.larkbot.app/mcp.
With an API key, for CI
For CI or clients that can't sign in, an admin creates a key in Settings, then API keys:
claude mcp add --transport http lark https://dashboard.larkbot.app/mcp \
--header "Authorization: Bearer $LARK_API_KEY"
# Codex reads the key from the environment variable you name.
codex mcp add lark --url https://dashboard.larkbot.app/mcp --bearer-token-env-var LARK_API_KEY
Allow it
When you sign in, Lark shows which app is asking, where it will send you back (your own computer), what it can do, and which organization to use if you're in more than one. Click Allow. Signing in creates a member key named "MCP · app · you". It can't touch secrets, members or billing, and you can revoke it any time in Settings, then API keys.
Only allow apps you started: the Allow page warns you if it would send you anywhere but your own computer.
Hand off a long task
Ask in plain words, with what "done" looks like and what you want back:
Hand this off to Lark: find 10 CDL Class A jobs near Fresno posted this week, with direct links, as a CSV. Use my notes in ./job-prefs.md.
In Claude Code you can also use the ready-made slash command, which needs nothing installed:
/mcp__lark__handoffhands a task to Lark properly: it uploads the files the task needs, picks the right agent and skills, keeps the model cheap, follows the run, asks you its questions and saves what it made into your project./mcp__lark__check-runsshows what's running, what's waiting for you, and how recent runs went.
What happens under the hood
Your coding agent calls Lark's tools:
upload_filesends any local files the task needs. The run finds them in its inputs folder.list_agentschecks for an agent that fits. Orcreate_agentmakes one with standing instructions.start_runhands over the task. Leave out the agent for a one-off: it runs on the general-purpose adhoc agent, so nothing needs setting up, and the run is still on record with a one-line summary.wait_for_runwaits up to 55 seconds at a time and reports that the run is still working (with its latest steps), needs your input, or is finished (with the report and files).
list_models lists the models agents can use with their prices, so your coding agent can pick a cheap model for routine work and a stronger one only when the task needs it.
Hand over work in progress
If you're mid-task, your coding agent can pass everything the Lark agent needs to pick up exactly where you are:
- context: what's been done, tried and decided, and what's next
- repo, ref, repo_bundle, repo_patch, branch: your repository as you have it, with unpushed commits and uncommitted changes applied
- integrations: services already connected in Lark, such as GitHub, Gmail or Slack
- secrets: credentials as environment variables, for that run only
- mcp_servers: MCP servers from your computer, by URL with headers or by command
Credentials are stored encrypted, scrubbed from the log and deleted when the run ends. Your coding agent asks you before sending any.
Wait for it and answer its questions
When the Lark agent needs a login, a choice or an approval, wait_for_run says the run needs your input. Your coding agent is told to ask you and pass your answer on with answer_run, never to answer for you. The same tool sends extra instructions while the run works ("also include their pricing page").
Every run also has a page in Lark where you can watch its screen, message it or stop it.
Download the files it made
When the run finishes, get_run_file fetches what it made. Text comes back as text. Videos, images and anything else come back as a 30-minute download link with a curl command, so your coding agent saves the file straight into your project.
Troubleshooting
| Problem | What to do | |---|---| | No browser opened, or "needs authentication" | In Claude Code run /mcp and choose lark, then Authenticate. In Codex run codex mcp login lark. | | "This app isn't registered with Lark" | Remove the server (claude mcp remove lark or codex mcp remove lark) and add it again. | | 401 after it worked before | The key was revoked or you left the organization. Connect again. | | A run is refused (402) | Your budget or plan limit was reached, or the agent's model isn't in your plan. The error says which. |
What it costs
Handed-off runs are ordinary runs: model tokens and machine time at the providers' prices plus 20%, counted toward your plan and budget, with the cost shown as it works. See how much AI agents cost to run and the pricing.
FAQ
Does this work with any MCP client?
Yes. Claude Code, Codex, Cursor, Claude Desktop or any MCP client can connect. Lark follows the MCP authorization spec, OAuth 2.1 with PKCE and dynamic client registration.
Can the Lark agent push to my repository?
It gets your repository as you have it, and connected services such as GitHub can go along as integrations. What it does is up to your task, and it asks when it needs approval.
How is this different from running a background task locally?
It runs on its own cloud computer with a browser, can last up to 7 days, and keeps going when your laptop sleeps.
Can a handed-off task become a scheduled agent?
Yes. Once a task works, make it an agent with standing instructions and add a trigger. See running AI agents on a schedule and from webhooks, what a cloud AI agent is, and the full docs.
Start free and add Lark to your editor in one command.