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.5.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.5.0
File Size Uploaded Provenance Actions
tether_agents-0.5.0.tar.gz 13.1 kB With provenance Details for tether_agents-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 24.9 kB

Release files / tether_agents-0.5.0.tar.gz

Download URL tether_agents-0.5.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a79fa1fa1716fa0c82ad65b6cb379d4d2d9d3c42526133a651faae447c22796b
BLAKE2b-256 checksum
How to use checksums
2f0f578b33cf59acb71ca715001dc611da5d220cd1c7db6a6b13a96e18686aba
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 22, 2026.

Transparency log

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

Download URL tether_agents-0.5.0-py3-none-any.whl
Size 11.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5332513d02c1874678418e1dc9dbae6824a8524d0db75cd1f5f0f25c00d976d1
BLAKE2b-256 checksum
How to use checksums
c69519572be2493da61fc954e1603a1d7ed53449f929654dcca2f845bfaa4fb5
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 22, 2026.

Transparency log

Security for tether-agents 0.5.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.5.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 22, 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