Clients
Meadow has three clients on top of the HTTP API. All three cover models, sandboxes, images, projects, keys, and provider keys. The Go SDK and mdw also read usage.
Next step: install the file your Meadow contact sent you, then run its example below. You do not need a client to use Meadow: every guide has curl samples, and Quickstart, Running commands, and Files, ports, and SSH have plain Python for the same calls.
Install
During the private beta the clients are not on PyPI, a public Go module proxy, or a package manager, and there is no download page yet. Your Meadow contact sends you the files. Ask for the one you need.
Do not run pip install meadow. That name on PyPI belongs to an unrelated project, and it installs something else. Install the wheel file by path.
To check the Python install:
Generate a client for another language
The OpenAPI file that ships with these docs is valid OpenAPI 3.1, and each operation’s operationId is the method name a generator uses. We generated a Python client with openapi-python-client, installed it, and listed models on the hosted beta with it:
The generator skipped one operation, createBuildContext, because its body is a gzip stream. Send that one call yourself. Other generators were not tried.
Set the address and the key
The key is required.
- The Python client, the Go SDK and
mdwread both variables. MEADOW_BASE_URLis optional. Without it all three clients callhttps://api.usemeadow.ai. Set it, or pass the address to the client, to call another host. A build sent out between 2026-11-24 and the addition of this default does not start without it: see the changelog.- Each client sends its version in
User-Agent:meadow-python/<version>,meadow-go/<version>,mdw/<version>.mdw --versionprints it. - You can pass them in code instead:
Meadow(api_key, base_url)in Python,meadow.WithAPIKeyandmeadow.WithBaseURLin Go,--base-urlonmdw. - Client builds sent out before 2026-11-24 had a default address that is not the hosted beta. Replace them.
What the clients do for you
- Retries. Every call is sent at most 3 times: the first try and 2 retries, as in the OpenAI SDKs.
max_retriesin Python andWithMaxRetriesin Go change that. A 429 is retried for every call, model calls included, after theretry-afterthe server sent, or with exponential backoff and jitter when it sent none. A 5xx or a lost connection is retried only for calls that are safe to repeat. Running a command, writing stdin, creating a project, and creating a key are sent once on those failures. When a 503 witherror.codeserver_restartingordatabase_unavailablecarriesx-should-retry: true, the clients send any call that is not a model call again, a command included. - Model calls are retried on a 429 only. A 429 means no provider took the call. After a 5xx or a timeout a model call is never sent again: Meadow has already tried every provider in the route, a provider may have billed for the failed call, and each send counts against the key’s limits. A stream that has started is never sent again. This rule is newer than the client builds sent out before 2026-11-24, which sent a model call once.
- Idempotency. A sandbox create carries one
Idempotency-Keyacross its retries, so a retry cannot start a second sandbox. - Dead connections. A connection can die without either side being told. The Go client and
mdwcheck a quiet connection with an HTTP/2 ping after 45 seconds and drop it when no reply comes in 10 seconds. If you build your own Go transport, keep the ping at 30 seconds or slower: the hosted service closes a connection that pings every 25 seconds or faster, and that ends a long quiet call. A call that is safe to repeat is then sent again on a new connection. The Python client has no ping: it drops an idle connection after 5 seconds, and a call already sent on a dead connection waits for its read timeout (60 seconds for most calls, none for a stream). Do: set your own timeout around a Python stream. Go clients built withoutWithHTTPClientshare one connection pool, so building a client per request does not open a connection per request. Clients with different API keys to the same host share one HTTP/2 connection as well. If that connection is closed, every call open on it ends, for every key, and the retry rules above apply to each call. To keep them apart, pass each client its own HTTP client built onmeadow.NewTransport(). If you pass your own HTTP client, it is used as it is: in Go, give itmeadow.NewTransport()as its transport. - Broken model streams. A model stream that ends with an error event (see Streaming) is an error in all three formats, never a clean finish. The Python client raises
meadow.ModelStreamError, the Go client’sModelStream.Err()returns a*meadow.ModelStreamError, andmdw models call --streamprints the error with the request ID and exits 1. The clients do not send the call again. - Waiting.
wait_running(Python) andWaitRunning(Go) poll until the sandbox runs, and raise or return an error when it ends asfailed. - Background commands.
run_background(Python),RunBackground(Go), andmdw exec --background --followstart a command and read it by offset until it ends. A dropped connection loses no output. - Directories.
upload_diranddownload_dirpack and unpack the tar for you. Downloads treat the archive as untrusted: links are skipped unless you opt in, and an entry that would land outside the target folder is rejected. - Delete. Returns nothing when the sandbox is gone, and the sandbox in
terminatingwhen the provider is slow.
One gap: the blocking exec result in the Python client and the Go SDK has no stdout_truncated or stderr_truncated field. If a command may print more than 4 MiB, run it in the background or write to a file. See Output caps.
Python
Needs Python 3.10 or newer. The example expects a ./task directory that holds a run.py.
Output from a run against the hosted beta, which took 10 seconds:
AsyncMeadow has the same groups and methods as coroutines. The methods of each group in version 0.1.0:
Only the methods in the example above were run for this page. help(client.sandboxes.exec) shows the arguments of a method.
Errors:
create(wait=True) returns the sandbox whatever its status. Check status, or call wait_running as the example does.
Go
The import path is github.com/polymath-ai-labs/meadow/sdk/meadow.
Output from a run against the hosted beta, which took 11 seconds:
meadow.Shell("...")runs throughsh -c.meadow.Argv(...)runs the list as given.- An API error is a
*meadow.APIErrorwithStatusCode,Type,Code,Message, andAttempts. Branch onStatusCodeandCode. On a model routeTypeis the provider’s string, such asrate_limit_error: see Errors. Sandboxes.Deletereturnsnilwhen the sandbox is gone, and the sandbox interminatingwhen the provider is slow.Sandboxes.UpdateNetwork(ctx, id, meadow.Network{...})replaces the network rules of a running sandbox and returns it. Python hasclient.sandboxes.update_network(sandbox_id, Network(...)), and the CLI hasmdw sandboxes network SANDBOX_IDwith--open,--block-network,--allow-domainand--allow-cidr. All three send every field, so the whole rule set is replaced.- The groups are
client.Models,client.Sandboxes,client.Images,client.Projects,client.Keys,client.Usage, andclient.ProviderKeys.
The mdw CLI
Every command below ran against the hosted beta. The mdw ssh line ran on a second sandbox, created the same way. ./environment holds a Dockerfile and the files it copies. ./task holds run.py.
mdw sandboxes create waits until the sandbox runs. mdw exec exits with the remote command’s exit code. One argument after -- runs through sh -c. Several arguments run as given.
Notes:
--jsonprints the API object on stdout and nothing else. Progress goes to stderr.mdw cp -r ./task SANDBOX:/workputs the contents of./taskinto/work. It does not create/work/task.mdw sshwrites the key to a temporary file, runs your localssh, then removes the key. Arguments after--go tossh: options first, then a remote command.- On Daytona,
sshasks you to accept the host key the first time. In a script that has no terminal it fails withHost key verification failed, so the sample passes-o StrictHostKeyChecking=accept-new. On Modal the host key is pinned and there is no question. mdw sandboxes deleteprintsdeleted <id>, orterminating <id>when the provider is slow. Both exit 0.
Other commands: keys, projects, provider-keys, models, sandboxes list|get, execs get|kill|stdin, images list|get, usage. Run mdw <command> --help for the flags.
mdw mcp runs a Model Context Protocol server for coding agents. See MCP server.
API reference
The clients wrap every operation, except that the Python client has no usage methods yet. The example above uses createSandbox, getSandbox, uploadFile, execInSandbox, getExec, downloadFile, and deleteSandbox.