megacode-agent-sdk
Drive a MEGA harness agent session from a Rust program: start a session, give the model tools your program
runs, answer its approval requests, and read what it does. One session is one harness process. Use it to
build an agent that is not a coding agent.
The example below also uses tokio (with macros and rt), serde (with derive) and serde_json.
The crate needs a harness binary of the same major and minor version. It uses the binary option, then the
MEGACODE_AGENT_SDK_BINARY environment variable, then a verified copy in its cache, and otherwise downloads
the matching release and checks it against digests compiled into the crate.
use ;
use Deserialize;
use json;
async
In a source checkout, a complete errand with an approval and a scripted model, which needs no API key, is examples/pip.rs:
The second argument names the harness binary; without it the example reads MEGACODE_AGENT_SDK_BINARY,
and only then downloads.
The options, tools, approvals, testing with a mock file, versions, the download and its trust rules are in the
agent SDK guide (docs/sdk.md in the source).
Licensed under either of MIT or Apache-2.0, at your option.