Team & platformGuide

Code Mode for AI agents

An agent connected over MCP usually calls one tool at a time: list the flows, read the runs of each, pause each schedule… dozens of round trips, every answer passing through its context. With Code Mode it writes ONE program that does all of it, and calls code_mode_run once.

What you will learn
  • When Code Mode is the better path
  • What runs, as whom, and what comes back
  • The limits and how to read the writes list

One program instead of many calls

  1. The agent reads the library

    code_mode_reference gives the waiso library’s calls for the language it picks — every language Waiso runs.

  2. It writes one program

    Reads and writes alike: list, filter, change, return a summary.

  3. Waiso runs it

    In the project’s sandbox (no network), as the token: every call is checked against the token’s scope and its owner’s access.

  4. Only the outcome comes back

    The program’s result, its logs and writes — every change it made, in order, even when it stops halfway.

There is nothing to turn on: Code Mode is two tools of the same MCP server, and the server’s own guide tells agents to prefer them for any job of several steps. You can still ask for it in words — “use Code Mode” — and the agent writes a program like this one.

Pythonwhat the agent sends
import waiso

def main():
    paused = []
    for flow in waiso.api.flows.list()["flows"]:
        runs = waiso.api.runs.list(target=f"flow:{flow['id']}", status="failed", limit=50)
        if runs["total"] > 3:
            for s in waiso.api.schedules.list()["schedules"]:
                if s["target"].get("flowId") == flow["id"] and s["enabled"]:
                    waiso.api.schedules.update(s["id"], enabled=False)
                    paused.append(s["name"])
    return {"paused": paused}
RunsEvery script and flow run in this project
Live
Search name or value · amount>100Ctrl KToday7 days30 daysAll time
Kind: AllStatus: AllWaiting for you 1
campaignFlowTriggered byScheduleDuration713msRan at5 h agoStatusSuccess
load_customersstep 1 of campaignTriggered bycampaignDuration38msRan at5 h agoStatusSuccess
send_offer ×4step 2 · loopTriggered bycampaignDuration188msRan at5 h agoStatusSuccess
approvalFlowTriggered byana@shop.devDuration174msRan at5 h agoStatusWaiting
report.pyTriggered byScheduleDuration6.7sRan at4 h agoStatusSuccess
broken.pyTriggered byana@shop.devDuration877msRan at26 min agoStatusFailed
Every program an agent runs is a run of its own in Runs, named Code Mode, with the token that sent it.

When to use it, and when not

Code Mode pays off when a request means looking at many things and deciding: clean up runs, pause what keeps failing, rename a batch of scripts, collect a report across flows. The agent spends its tokens on the program and on the short answer, not on every list it would otherwise read. For a single action — run this script, show this flow — the MCP tool for it is just as good and easier to follow.

The program can only reach the platform, and only as the token: it has no network, no files outside its run, and a call outside the token’s scope raises the library’s error. A program that loops forever is stopped at its time limit; what it changed until then is still listed.

Limits and what you see

LimitCode Mode
Time60 s by default, up to the install’s script limit
ProgramUp to 64 KiB, in Python, TypeScript, JavaScript, Go, PHP, Ruby, C, C++ or Bash
Result and logs64 KiB each, marked when cut
CostOne run credit, like any script run
NetworkNone — the program reaches only the platform, through the library

Every Code Mode run is in Runs as Code Mode with the token’s name; open it to see the program, the result and a Changes made table. Each change is also in the audit log, with the token and the run.