Skip to main content

tether-agents

Python client for Tether. Your agent keeps its own loop; it calls run.complete where it called its provider SDK and run.call_tool where it ran a tool, and Tether does the rest: policy, sandbox, budgets and the trace.

import tether

with tether.Run(policy="tether.toml") as run:
    messages = [tether.user("Write hello.txt, then show me what is in it.")]
    while True:
        reply = run.complete(model="claude-opus-5-5", messages=messages)
        messages.append(reply.message)
        if not reply.tool_calls:
            run.finish(reply.text)
            break
        results = [run.call_tool(call) for call in reply.tool_calls]
        messages.append(tether.tool_results(results))

A complete example is in examples/raw-loop-py.

Install

pip install tether-agents
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/chizy7/tether/releases/latest/download/tether-cli-installer.sh | sh

The second line installs the tether binary, which carries the daemon the SDK talks to. The SDK and the binary should be the same version.

To work on the SDK, from a checkout of the repository:

pip install -e sdks/python
cargo build -p tetherd          # the daemon the SDK talks to
export PATH="$PWD/target/debug:$PATH"

How it works

The SDK is a thin client for the daemon, tetherd, over gRPC on a Unix socket. Each method is one request and nothing in the SDK decides anything.

tether.Run(...) connects to the socket and starts a run. If no daemon answers, it starts one: $TETHERD if set, else tetherd or tether daemon from PATH. The daemon logs to tetherd.log beside the socket and exits by itself a few seconds after its last run.

Run(policy=, provider=, script=, dir=, workspace=, agent=, betas=, socket=) Start a run. provider is "anthropic", "openai_compat" (any server with an OpenAI-style /chat/completions, set by OPENAI_BASE_URL and OPENAI_API_KEY) or, with script, "fake"
run.tools The tools the run offers
run.complete(model=, messages=, tools=, params=) One model turn. Returns a Reply
run.call_tool(call) Run a tool the model asked for. Returns a ToolResult
run.finish(outcome) The agent is done
run.halt() Trip the run's kill switch
run.answer(subject_seq, allow) Answer a policy ask, from another thread
run.events() Iterate the trace as it is written
run.id, run.trace_path The run's id and where its trace is

Used as a context manager, a run that leaves its block without a word is finished, or halted if the block raised.

Things to know:

  • Append reply.message to your history exactly as it is. It can hold blocks only the provider understands, such as reasoning blocks, which must go back unchanged.
  • Check reply.stop_reason before acting. refusal and max_tokens are replies that are not finished answers.
  • A tool call that policy denies does not raise. It comes back as a ToolResult with is_error set, like any other failed call.
  • tether.Halted is raised when the run takes no more calls: a spent budget, an unanswered ask, the kill switch, a provider failure. Anything else the daemon refuses raises tether.TetherError with the gRPC status in .code.
  • Arguments left unset fall back to TETHER_POLICY, TETHER_DIR and TETHER_SOCKET, which tether run -- python agent.py sets.

Develop

cd sdks/python
uv venv && uv pip install -e ".[dev]"
cargo build -p tetherd
.venv/bin/python -m pytest

The tests start a real daemon from target/debug/tetherd and use the scripted model, so they need no API key. The gRPC stubs in src/tether/_proto are generated and committed; regenerate them after a change to proto/tether.proto:

uv run --no-project --with grpcio-tools sh scripts/gen_proto.sh

Metadata

Release files for tether-agents 0.3.0

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

Source distribution (sdist)

Source distribution for tether-agents 0.3.0
File Size Uploaded Provenance Actions
tether_agents-0.3.0.tar.gz 13.0 kB With provenance Details for tether_agents-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tether-agents 0.3.0
File Interpreter ABI Platform Actions
tether_agents-0.3.0-py3-none-any.whl Python 3 none any Details for tether_agents-0.3.0-py3-none-any.whl

Total release size: 24.7 kB

Release files / tether_agents-0.3.0.tar.gz

Download URL tether_agents-0.3.0.tar.gz
Size 13.0 kB
Tags Source
SHA-256 checksum
How to use checksums
87c4c866b80f3ce1400d7227089bf581e47c87000d8ee6822e0f4e11ef6b7c87
BLAKE2b-256 checksum
How to use checksums
5bb0b19bcfae12ca15d132e7222daa8a480f9fe182965ab1eb51778305766281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Release files / tether_agents-0.3.0-py3-none-any.whl

Download URL tether_agents-0.3.0-py3-none-any.whl
Size 11.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
117393d7b968a69a5b6aa9d1501ebdfab6f25ca3929dddfa74d4cbf3196f7452
BLAKE2b-256 checksum
How to use checksums
ff540b5f44982f32722a584b1635d42f3d0b35ea79626b0e60dd97dcaa2ee572
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

Security for tether-agents 0.3.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tether_agents-0.3.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 21, 2026.

Transparency log

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.

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