Skip to main content

Local-first, append-only trace vault for AI agents with cryptographic integrity

Project description

Axiom Trace

Local-first, append-only trace vault for AI agents with cryptographic integrity.

pip install axiom-trace

Quick Start (3 Lines)

from axiom_trace import trace

trace.log("Processing user request")
trace.thought("Need to fetch user data")
trace.tool("database_query", {"table": "users"})
trace.done("Found 10 users")

That's it! Traces are saved to .axiom_trace/ in your project.


View Your Traces

# Pretty print recent traces
axiom log

# Watch live (like tail -f)
axiom watch

Output:

────────────────────────────────────────────────────────────────────────────────
AXIOM TRACE LOG (4 entries)
────────────────────────────────────────────────────────────────────────────────
2026-01-09T03:56:43 system_event  Processing user request
2026-01-09T03:56:43 thought       Need to fetch user data
2026-01-09T03:56:43 tool_call     ✓ database_query
2026-01-09T03:56:43 final_result  ✓ Found 10 users
────────────────────────────────────────────────────────────────────────────────

API Reference

Quick Trace Methods

Method When to Use Example
trace.log(msg) Simple log message trace.log("Starting")
trace.thought(reasoning) Agent is thinking/deciding trace.thought("Need API call")
trace.tool(name, args) Calling a tool/function trace.tool("search", {"q": "..."})
trace.done(result) Task completed trace.done("Success!")
trace.error(msg, exc) Something failed trace.error("Failed", e)
trace.input(text) User said something trace.input("What's the weather?")
trace.search(query) Semantic search traces trace.search("authentication")
trace.context(query) Get past context as string trace.context("API design")

Agent Retrospection (Semantic Search)

from axiom_trace import trace

# Search past traces semantically (powered by Memvid)
results = trace.search("user authentication", limit=5)
for r in results:
    print(f"{r['event_type']}: {r['content']}")

# Get context for prompts
past_context = trace.context("building REST APIs")
prompt = f"Based on my past work:\n{past_context}\n\nNow I need to..."

Auto-Trace Decorator

from axiom_trace import auto_trace

@auto_trace
def fetch_user(user_id: int):
    return db.get(user_id)

# Automatically captures: function name, args, result, timing, exceptions

Agent-Friendly Fields

Traces include fields designed for AI agent retrospection:

trace.record({
    "event_type": "tool_call",
    "content": {
        "input": "User asked: Build REST API",      # What prompted this
        "output": "Created api/users.py",           # What was produced
        "reasoning": "Need CRUD endpoints"          # Why this action
    },
    "success": True,                                # Did it work?
    "artifacts": ["api/users.py"],                  # Files created
    "caused_by": "previous-frame-id"                # Causality chain
})

Memvid Cloud (Optional)

For enhanced semantic search, add your Memvid API key:

# In your project's .env file
MEMVID_API_KEY=mv2_your_key_here

Axiom Trace automatically loads from .env when you import it.


CLI Commands

Command Description
axiom log Pretty print recent traces
axiom watch Live trace monitoring
axiom query --prompt "..." Search traces semantically
axiom verify Check hash chain integrity
axiom stats Show vault statistics
axiom export --session ID Export session to Markdown

Advanced: Full API

For more control, use the AxiomTrace class directly:

from axiom_trace import AxiomTrace

with AxiomTrace(vault_dir="./my_vault") as ax:
    # Record with full control
    ax.record({
        "event_type": "thought",
        "content": {
            "text": "Analyzing request",
            "rationale_summary": "Need to understand intent"
        }
    })
    
    # Query with semantic search
    results = ax.query("user request", limit=5)
    
    # Verify integrity
    status = ax.verify_integrity()

Vault Structure

.axiom_trace/
├── frames.jsonl           # Your traces (one JSON per line)
├── vault.manifest.json    # Metadata + head hash
├── vault_index.json       # Search index
└── vault.mv2              # Memvid video index

Why Axiom Trace?

  • Local-first - Data stays on your machine
  • Append-only - Can't delete or modify past traces
  • Tamper-evident - SHA-256 hash chain detects modifications
  • Agent-friendly - Fields designed for AI retrospection
  • Zero config - Works out of the box

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

axiom_trace-1.4.2.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

axiom_trace-1.4.2-py3-none-any.whl (27.8 kB view details)

Uploaded Python 3

File details

Details for the file axiom_trace-1.4.2.tar.gz.

File metadata

  • Download URL: axiom_trace-1.4.2.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for axiom_trace-1.4.2.tar.gz
Algorithm Hash digest
SHA256 df1ef2652ec73a9672f4a217283090c261010861389625a7901d69fefa313608
MD5 c9f52298194bb3434d660f4c279d771c
BLAKE2b-256 b7a31f8d2adccf4cd1bae57fd63856adb2eec64b6a5567e8060f72255cc8350a

See more details on using hashes here.

Provenance

The following attestation bundles were made for axiom_trace-1.4.2.tar.gz:

Publisher: publish.yml on atharvayeola/axiom-trace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file axiom_trace-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: axiom_trace-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 27.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for axiom_trace-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2d7479c358b889b37436bbd22d6ea250d223585ecbaff0e449131779532e415b
MD5 eda9390ac56506678bc24ebeec4b0876
BLAKE2b-256 76e0718dac22a69b097630c56e6db5b053b1ae0b66f6135f9b49fb28a7629d4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for axiom_trace-1.4.2-py3-none-any.whl:

Publisher: publish.yml on atharvayeola/axiom-trace

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page