Fuju Trace Python SDK
Python 3.8+ SDK for Agent traces. It emits deterministic events and writes them through an Exporter. The base package uses only the Python standard library.
Start with SQLite
python -m pip install 'fuju-trace[sqlite]==0.1.11'
Full tutorial · 中文教程 · SDK installation
VexDB
pip install 'fuju-trace[vexdb]==0.1.11'
import os
from fuju_trace import DbExporter, Tracer, connect
with connect(vexdb_dsn=os.environ["VEXDB_DSN"], tenant_id=1,
vector_dim=384, initialize=True) as db:
tracer = Tracer(exporter=DbExporter(db, tenant_id=1), node_id=1)
with tracer.trace("risk review", tenant_id=1) as trace:
with trace.span("investigate") as span:
span.log("suspicious transaction")
tracer.close()
print(db.search(text="transaction", k=10))
The VexDB adapter also accepts vexdb_params={...}. 384 is an example: vector_dim must match the embedding model you may use later. Text search works without supplying vectors, although VexDB still creates a vector column and index. For batching, use BufferedDbExporter, call flush() before reading, and check health() for write errors or drops. See the adapter guide.
SQLite, DuckDB, and PostgreSQL
For Python 3.10+, install the matching database extra:
python -m pip install 'fuju-trace[sqlite]==0.1.11'
python -m pip install 'fuju-trace[duckdb]==0.1.11'
python -m pip install 'fuju-trace[postgresql]==0.1.11'
Use connect(sqlite_path=...), connect(duckdb_path=...), or connect(postgresql_dsn=...). The same DbExporter and Tracer work with these stores. Their current search is a substring scan, with no BM25 or vector support. See SQL adapter guide for drivers, code, and limits.
The extras install fuju-trace-sqlite, fuju-trace-duckdb, or fuju-trace-postgresql, each using the shared fuju-trace-sql implementation.
Local embedded DB
python -m pip install -e ./fuju-trace-sdk/python -e ./fuju-trace-db-python
Use connect(path="./trace-data", tenant_id=1) with the same DbExporter and Tracer code. The separate fuju-trace-db wheel contains the Rust engine.
Logging and custom sinks
ConsoleExporter prints JSON events for local debugging. CollectingExporter stores events in memory for tests. BatchExporter wraps a sink and forwards full batches. Implement Exporter.export_batch() to integrate another database.
from fuju_trace import ConsoleExporter, Tracer
tracer = Tracer(exporter=ConsoleExporter(), node_id=1, agent_name="planner")
with tracer.trace("request", tenant_id=1) as trace:
with trace.span("planner.route", display_name="Plan next step") as span:
span.log("ready")
name becomes the stored span_name; display_name is optional. agent_name identifies the actor. event_id is derived from ext_span_id, seq, and event_type and matches the Rust and TypeScript implementations.
Tests
python tests/test_sdk.py
python -m unittest discover -s tests
Metadata
Release files for fuju-trace 0.1.11
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 |
|---|---|---|---|---|
| fuju_trace-0.1.11.tar.gz | 23.1 kB | Without provenance | Details for fuju_trace-0.1.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fuju_trace-0.1.11-py3-none-any.whl | Python 3 | none | any | Details for fuju_trace-0.1.11-py3-none-any.whl |
Total release size: 42.6 kB
Release files / fuju_trace-0.1.11.tar.gz
| Download URL | fuju_trace-0.1.11.tar.gz |
|---|---|
| Size | 23.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
613f91acd55306405a3a7eb6c3fcf5bcc53e2e29679b995697b9b4954092a6e3
|
|
BLAKE2b-256 checksum How to use checksums |
2ab640c3d872f89c0095a19b1d202c01b6c05b013663db8e285f77eda4f9aa55
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Release files / fuju_trace-0.1.11-py3-none-any.whl
| Download URL | fuju_trace-0.1.11-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
714a642e0b1fc0087cbb75d2143efa0d44509d14dd38239a041642b599a806d5
|
|
BLAKE2b-256 checksum How to use checksums |
259b586214bfaf10199253bb81c6d00336af4ee9df5292040018f036c4d7f5a0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.2
|
Security for fuju-trace 0.1.11
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.