Skip to main content

TinkerFin Tracing

TinkerFin Tracing records Agent runs, messages, model calls, tools, approvals, and subagents. Query conversation history and execution graphs, follow live updates, or keep traces in memory or shared storage.

Installation

pip install tinkerfin-tracing

For shared SQL storage, install the extra and an asynchronous database driver:

pip install "tinkerfin-tracing[sqlalchemy]" asyncpg

Use asyncpg for PostgreSQL, asyncmy for MySQL, or aiosqlite for SQLite.

Quick Start

Install tinkerfin and langchain-openai, and set OPENAI_API_KEY for this example. Replace the model ID with one available to your account.

import asyncio

from tinkerfin import TinkerFin
from tinkerfin_tracing import Tracer


async def main() -> None:
    tracer = Tracer()
    runtime = (
        TinkerFin()
        .with_namespace("company-a")
        .with_observer(tracer)
        .build(model="openai:gpt-5.4")
    )
    await runtime.ainvoke(
        thread_id="thread-1",
        run_id="run-1",
        input={"messages": [{"role": "user", "content": "Hello"}]},
    )
    history = await tracer.get(runtime.thread_identity("thread-1"))
    print(history.messages)
    print(history.summary.status.execution)
    print(history.graph.nodes)


asyncio.run(main())

Runtime invocation and streaming record the same lifecycle, including failures before model output. Consume streams completely or close them with await stream.aclose(). Direct execution of a compiled graph does not automatically produce a complete Trace.

Read and follow history

One Tracer can serve multiple Runtime namespaces. Query with runtime.thread_identity(thread_id) or a tinkerfin_contracts.ThreadIdentity that the host has authorized. Equal thread and run IDs in different namespaces have independent histories.

tracer.get(thread) returns messages, state, approvals, run status, and the execution graph at a fixed point in history. Select head_run_id for a branch. Use tracer.query(thread, where=TraceGraphFilter(...)) to filter model calls, tools, and subagents. Model nodes expose request_reference for retrieving retained inputs with tracer.model_request(...).

Follow updates with history.follow() or the current first graph page's follow(); close the subscription on early exit. Graph cursors bind the thread, branch, filter, and current history tail, so a new commit invalidates an earlier graph cursor. History cursors retain their fixed view. Queries are bounded; a structural overflow raises TraceQuotaExceeded.

Choose what to retain

The default CapturePolicy.public_history() retains sanitized public content, including tool inputs and results. Use CapturePolicy.public_safe() for metadata-only tool capture, or ToolTraceCapture for individual tools.

Credential redaction and provider-private reasoning removal always apply. Add business rules with Tracer(redactor=...). Redactors must be deterministic, synchronous, free of I/O, and leave their input unchanged; invalid results reject capture. Reasoning content requires both an enabled Runtime extractor and ReasoningCapturePolicy.content() on the Tracer. The default retains neither reasoning content nor its digest.

Direct TraceWriter calls accept already captured facts. Use Tracer when content requires framework and business redaction.

Durable storage and ownership

The default InMemoryTraceStore is bounded and local to one process. For SQL storage, create SqlAlchemyTraceStore(engine), await store.setup(), and pass it to Tracer(store=store). The Tracer borrows the Store; the SQL Store borrows the application's AsyncEngine. Finish all writers, followers, and accepted operations before disposing the Engine.

Setup creates an empty schema or validates existing tables and indexes. Partial or mismatched schemas are rejected. Cancellation waits for accepted setup to finish. SQLite files work with the default pool; in-memory SQLite requires AsyncAdaptedQueuePool with pool_size=1, max_overflow=0. MySQL graph queries require MySQL 8 or newer, and payload tables require InnoDB file-per-table tablespaces.

Pass a started Notifications service to the Store's notifications argument for cross-instance wakeups, using the same Redis channel in each process. The service remains host-owned and must outlive writers and followers. Hints contain identities, not captured content; followers repair missed notifications through authoritative reads. Without Notifications, followers poll storage.

See the guide for capture limits, encrypted codecs, graph rebuilding, and custom storage contracts.

Documentation

License

Apache License 2.0

Metadata

Release files for tinkerfin-tracing 0.1.1

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

Source distribution (sdist)

Source distribution for tinkerfin-tracing 0.1.1
File Size Uploaded Provenance Actions
tinkerfin_tracing-0.1.1.tar.gz 229.2 kB Without provenance Details for tinkerfin_tracing-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tinkerfin-tracing 0.1.1
File Interpreter ABI Platform Actions
tinkerfin_tracing-0.1.1-py3-none-any.whl Python 3 none any Details for tinkerfin_tracing-0.1.1-py3-none-any.whl

Total release size: 426.2 kB

Release files / tinkerfin_tracing-0.1.1.tar.gz

Download URL tinkerfin_tracing-0.1.1.tar.gz
Size 229.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3d95dfbfc4a4ef1b905951824dec67b798ffcf39b90acfc6c13c17db2f2c9223
BLAKE2b-256 checksum
How to use checksums
4cd346eff9422664d1c8b16dfaa7359de0f477f599eed4e359257c437231ed71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / tinkerfin_tracing-0.1.1-py3-none-any.whl

Download URL tinkerfin_tracing-0.1.1-py3-none-any.whl
Size 197.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a274ef98a3e92501a555063b0f16120bb6019944a190eddf871b6f82894401db
BLAKE2b-256 checksum
How to use checksums
c8c6c5a244732d4d0429f419ce97d4b9ff0cfb42d514fcae1ca592d89255456c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for tinkerfin-tracing 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

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