Skip to main content

Tama Python SDK

Typed, agent-friendly access to Tama's control plane. The SDK can reuse the credentials written by the Tama CLI, so local scripts need no token plumbing.

cd sdks/python
uv sync --extra dev
from tama_sdk import Tama

with Tama(profile="production") as tama:
    machine = tama.new(name="worker", image="ubuntu:24.04")

    result = machine.exec(["git", "status", "--short"], check=True)
    print(result.stdout)

    prompt = machine.prompt(
        "Fix the failing tests, then summarize the change.",
        agent="codex",
    )
    print(prompt.output)

The common workflows mirror the CLI: new, list, rm, stop, start, fork, exec, logs, prompt, expose, unexpose, ports, desktop, and terminal. Returned machines keep those actions scoped:

machine = tama.get("worker")
machine.stop()
machine.start()

session = machine.prompt("Review the repository", detach=True)
for event in tama.logs(session.id):
    print(event.data, end="")

Secondary resources use discoverable collections:

tama.snapshots.list(machine="worker")
tama.templates.list()
tama.secrets.set("OPENAI_API_KEY", "...")
tama.tokens.create("ci")

For CI, set TAMA_TOKEN and optionally TAMA_API_URL. Configuration precedence is explicit constructor values, environment variables, then the selected CLI profile. The SDK never prints credentials.

The complete generated schema is available as tama_sdk.proto, and the generated service stub is available as tama.raw when a new RPC lands before its convenience wrapper.

Safety and retries

Read-only RPCs retry short UNAVAILABLE and DEADLINE_EXCEEDED failures with bounded exponential backoff. Mutations are never retried automatically: a timed-out create or snapshot may already be running on the server.

Development

uv run --extra dev python scripts/generate.py
uv run --extra dev pytest
uv run --extra dev ruff check .
uv run --extra dev mypy

The generated protobuf modules are committed so installing the wheel does not require protoc.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tama_sdk-0.1.0.tar.gz (25.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tama_sdk-0.1.0-py3-none-any.whl (28.7 kB view details)

Uploaded Python 3

File details

Details for the file tama_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: tama_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 25.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for tama_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 c16d32402bfe4a6bdb5dc2683b5ed68e3901953e006fa5d0d5f58ff5b81a8b36
MD5 27dc0efbdcbbb55f64656db325cbc182
BLAKE2b-256 f276d6e484a30ca78625f0076e232fd8989c20aa6246f1bbe80047226923c0dd

See more details on using hashes here.

File details

Details for the file tama_sdk-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tama_sdk-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 28.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.4

File hashes

Hashes for tama_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a476ec63c84bb861c970d9f15ea68d502e78d836db7656a24263f6622749d07
MD5 9f4991b3c0a909b4b857de37dacd167f
BLAKE2b-256 4a808ae32c7fd42a2a5daa4cb18900b7026222320a490124d1637ea6ca435da0

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

This release

0.1.0 This release

2 files

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