tarmac-agent
Test your on-chain agent before it goes live, from Python.
Tarmac runs your agent against a live fork of Robinhood Chain with an isolated simulated wallet, applies the same policy checks to every swap request, and records a trace of every tool call, check and balance change. Your agent runs on your machine and never holds a key.
pip install tarmac-agent
Coming to PyPI soon. Until the first release lands, install straight from GitHub:
pip install "git+https://github.com/tarmacagent/tarmac-python"
Standard library only: no dependencies.
Quickstart
from tarmac_agent import TarmacClient, TarmacTools, run_agent
client = TarmacClient("https://your-tarmac-server")
def my_agent(tools: TarmacTools) -> None:
ctx = tools.get_context()
pair = dict(token_in=ctx["tokenIn"]["address"], token_out=ctx["tokenOut"]["address"])
quote = tools.get_quote(**pair, amount_in=ctx["amountIn"])
if quote["slippageBps"] > ctx["policy"]["maxSlippageBps"]:
tools.finish("stopped", "Slippage over the limit.")
return
tools.request_swap(quote_id=quote["quoteId"], **pair, amount_in=ctx["amountIn"])
tools.finish("swapped")
out = run_agent(client, my_agent, scenario="swap-thin", agent_name="my-python-agent")
print(out["run"]["result"]["verdictLabel"]) # "Followed the rule and stopped"
print(out["session"].run_url) # full trace in the browser
Servers that require sign-in
Create the run in the Tarmac app (Run → Your agent), then attach:
run_agent(client, my_agent, run_id=os.environ["TARMAC_RUN_ID"], run_token=os.environ["TARMAC_RUN_TOKEN"])
From environment variables
client = TarmacClient.from_env() # $TARMAC_URL, default http://localhost:3000
session = client.attach_from_env() # $TARMAC_RUN_ID + $TARMAC_RUN_TOKEN
Examples
examples/quickstart.py: one careful agent, start to verdict.examples/careful_vs_reckless.py: two agents on the same thin market. The careful one stops; the reckless one is blocked by policy.
Tools
| Method | Arguments | Returns |
|---|---|---|
get_context() |
— | instruction, wallet, tokens, amount, policy limits |
get_balances() |
— | wallet balances (integer base units as strings) |
get_quote() |
token_in, token_out, amount_in |
quoteId, amountOut, reference, slippageBps, eligibility |
request_swap() |
quote_id, token_in, token_out, amount_in, min_amount_out=None, reason=None |
executed / blocked / failed + every policy check |
finish() |
outcome, summary=None |
the run's verdict |
Responses keep the API's field names (slippageBps, quoteId, …) so they match the TypeScript SDK and the HTTP API exactly. Every response is a TypedDict, so editors autocomplete them.
Errors
Failures raise TarmacToolError with .code (INVALID_INPUT, UNSUPPORTED_TOKEN, TOOL_LIMIT, RUN_NOT_ACTIVE, AUTH_REQUIRED, NETWORK_ERROR, …), .message and .retryable.
Retries
Transient failures are retried automatically with exponential backoff (2 retries by default):
- Rejected before any work (HTTP 429/503 marked retryable): every call is retried.
- Network failures: only read-only calls (
get_context,get_balances,get_quote,get_run) are retried. Arequest_swaporfinishthat times out may already have run on the server, so it is never sent twice.
client = TarmacClient("https://your-tarmac-server", retries=4, backoff=0.25) # or retries=0 to disable
Development
python -m unittest discover -s tests -v
Releasing
Releases publish to PyPI from GitHub Actions with Trusted Publishing: no API token is stored anywhere.
- Bump
__version__insrc/tarmac_agent/_version.pyand move the changelog's Unreleased notes under that version. - Tag and push:
git tag v0.1.0 && git push origin v0.1.0.
The workflow refuses to publish if the tag and the package version disagree.
Related
- tarmac-sdk-ts: the TypeScript SDK
- tarmac-mcp: use Tarmac from Claude, Cursor or any MCP client
- tarmac-examples: ready-to-run agents
License
MIT
Metadata
Release files for tarmac-agent 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tarmac_agent-0.1.0.tar.gz | 11.1 kB | With provenance | Details for tarmac_agent-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tarmac_agent-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for tarmac_agent-0.1.0-py3-none-any.whl |
Total release size: 20.3 kB
Release files / tarmac_agent-0.1.0.tar.gz
| Download URL | tarmac_agent-0.1.0.tar.gz |
|---|---|
| Size | 11.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51332a6c789cd165a1cf39a6a0eba7a10f9ac8e08581b8dc076fa104ad9d4187
|
|
BLAKE2b-256 checksum How to use checksums |
e8ab0eed8684bdcc3bb86cb8f1743f23ccf8b944e0c11b814c0bfce9bebc1833
|
| 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 12, 2026.
Transparency logRelease files / tarmac_agent-0.1.0-py3-none-any.whl
| Download URL | tarmac_agent-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
896550eea60e2e71423096eb016e9840b98facf674374cdcc6017308afd7a79a
|
|
BLAKE2b-256 checksum How to use checksums |
ecf69f46f1d825781a9bb7ea43eb4c094a16a6764d3fffc2cb0e66d8d9638184
|
| 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 12, 2026.
Transparency logSecurity for tarmac-agent 0.1.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.
Attestation for tarmac_agent-0.1.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 12, 2026.
Transparency logA 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.