Skip to main content

Rootmark SDK

Agent instrumentation for Rootmark — observe, verify and govern agent runs.

The SDK records what your agents actually did: the span tree of a run, the model calls inside it, token counts, and the payloads you choose to keep. It sends them to a Rootmark collector, which you can self-host.

pip install rootmark

Requires Python 3.12 or newer.

Quickstart

import rootmark

rootmark.init(
    api_key="pk_...",                 # project API key
    project_id="...",                 # UUID
    api_key_id="...",                 # UUID
    api_url="https://rootmark.example.com",
    workflow_name="my-service",       # not "default" -- see below
)

rootmark.patch()                      # instrument supported frameworks in place

That is the whole integration for the common case. patch() installs instrumentation process-wide, so call it once at startup and before the first agent invocation.

Grouping and labelling runs

with rootmark.workflow_override("contract-review"):
    with rootmark.bind_context(tenant_id="acme", session_id=session, tags=["surface:chat"]):
        result = agent(prompt)

bind_context applies to everything that runs inside it, including tasks the agent loop spawns, because the binding follows the async context.

workflow_name should not be "default": that value lets framework instrumentation override the name you bind per run with its own agent id.

Framework support

The base install instruments nothing on its own beyond direct use. Install the extra for what you actually run:

pip install "rootmark[openai]"    # OpenAI 1.x and 2.x
pip install "rootmark[langchain]" # LangChain callback handler
pip install "rootmark[crewai]"    # CrewAI event listeners
pip install "rootmark[strands]"   # Strands agents / AWS Bedrock
pip install "rootmark[boto3]"     # Bedrock via botocore, no code change

For boto3, a session built by hand rather than the default one needs rootmark.patch_session(session) — the botocore hooks only reach the default session otherwise.

Delivery

Spans are batched on a background thread and flushed on a timer, so nothing blocks a request. A failed export is written to a spill file and retried, keeping its batch identity so the collector can recognise a replay rather than double-count it. Ordering is preserved: a batch that cannot be delivered holds back the ones behind it.

Point spill_file somewhere writable. The default is relative to the working directory, which in a container is frequently owned by root while the process runs as someone else — and a spill file that cannot be written is buffering you silently do not have.

Call rootmark.flush() before a process exits if you want outstanding spans delivered, and rootmark.shutdown() to stop the processor.

Keeping payloads out

rootmark.init(..., suppress_payloads=True)

Spans are still recorded — timings, token counts, the shape of the run — but prompt and completion text is not sent. Use this when the collector sits outside the trust boundary that the data does not leave.

Metadata

Release files for rootmark 0.1.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 rootmark 0.1.0
File Size Uploaded Provenance
rootmark-0.1.0.tar.gz 92.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for rootmark 0.1.0
File Interpreter ABI Platform
rootmark-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 152.7 kB

Release files / rootmark-0.1.0.tar.gz

Download URL rootmark-0.1.0.tar.gz
Size 92.4 kB
Tags Source
SHA-256 checksum
How to use checksums
91f718a548b87b264cdd299d4f692e60934bd6ba6cb0c0a6b183e9105106f8c1
BLAKE2b-256 checksum
How to use checksums
211139bb0c3b008a59b6533cf5cd39aa31c181c41264da3e9bee94446cd76209
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Release files / rootmark-0.1.0-py3-none-any.whl

Download URL rootmark-0.1.0-py3-none-any.whl
Size 60.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
02ffda9abae3a487545a0994e9098758ef23231b0ff3b5d212b74e996b547e89
BLAKE2b-256 checksum
How to use checksums
1aa305e75a354e8ac7b5bfd9097b90cd9e5442b2e6f8a968b39bbfb6242c6fc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.10

Security for rootmark 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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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