Skip to main content

megacode-agent-sdk

Drive a MEGA harness agent session from a Python 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.

pip install megacode-agent-sdk

Python 3.10 or newer; the standard library only; a wheel, with no source build.

The package 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 built into the package.

import asyncio
from megacode_agent_sdk import Client, Options, tool

@tool(
    "search_trains",
    "Find trains to a destination.",
    {"type": "object", "properties": {"to": {"type": "string"}}, "required": ["to"]},
)
async def search(args, ctx):
    return f"to {args['to']}: 9:10 for 42 pounds"

async def main():
    options = Options.plain("You are Pip, a personal assistant. Be brief.", tools=[search])
    async with await Client.start(options) as client:
        turn = await client.send("find me a train to Leeds")
        async for event in turn:
            print(event)

asyncio.run(main())

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.

Metadata

Release files for megacode-agent-sdk 0.31.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for megacode-agent-sdk 0.31.0
File Interpreter ABI Platform Actions
megacode_agent_sdk-0.31.0-py3-none-any.whl Python 3 none any Details for megacode_agent_sdk-0.31.0-py3-none-any.whl

Release files / megacode_agent_sdk-0.31.0-py3-none-any.whl

Download URL megacode_agent_sdk-0.31.0-py3-none-any.whl
Size 52.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a655af6ffd0f9c3323c168acb3a0524f4e4c2e7263d2c12594ff67e04595f7a1
BLAKE2b-256 checksum
How to use checksums
b8fc2a531819fbb1a5f214b39cd9d05dc227daf4aef538e2c33fff29b3feab15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.4 {"installer":{"name":"uv","version":"0.13.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for megacode-agent-sdk 0.31.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.31.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page