InvokeTool

CodeMode

Write MiniGo orchestration against generated integration APIs.

CodeMode

InvokeTool exposes Rust modules as a typed MiniGo programming surface. Agents write small orchestration programs against generated structs and extern functions instead of calling a flat list of primitive tools.

func Run(input Input) Output {
    result := github_to_slack_create_issue_and_notify(CreateIssueAndNotifyInput{
        Repo: input.Repo,
        Title: input.Title,
        Channel: input.Channel,
    })
    if !result.Ok {
        return Output{}
    }
    return Output{IssueUrl: result.Value.IssueUrl}
}

Publish Checks

Publishable CodeMode must be MiniGo. The core rejects package imports, goroutines, channels, ambient os/network/process APIs, MiniGo require, generated externs, and unsupported dynamic features. The generated environment injects only the selected module structs and extern functions.

Runtime Contract

Runtime validation uses the same schemas that generate MiniGo types. Results, logs, metrics, host-call failures, type errors, and validation errors are returned as structured envelopes to the SDK host.

The Rust core checks MiniGo source against codemode-env.json, compiles it to a small program representation, and executes it through the CodeMode runtime. Generated externs lower to module:<module_id>:action:<action_id> routes before dispatching through registered Rust-backed handlers. Schema, timeout, memory, instruction-budget, and host-call permission checks remain enforced by the core.

Execution requests can also set cancelled: true. The core rejects those requests before dispatching any module handler and returns a deterministic runtime_cancelled error envelope.

Module packages include .invoke/api.mgo for the agent-visible API and .invoke/codemode-env.json for the compiler/runtime ABI mirror. SDKs call checkCodeMode before executeCodeMode.

On this page