Skip to main content

Facto Python SDK

Forensic Accountability Infrastructure for AI Agents

facto-ai is the Python SDK for Facto, a system designed to create tamper-proof, verifiable audit trails for AI agent actions. It allows you to wrap LLM calls and agent steps, automatically generating cryptographically signed events that are stored in a verifiable log.

Features

  • Cryptographic Signatures: Every event is signed with Ed25519, ensuring authenticity.
  • Tamper-Proof Logging: Events form a hash chain, making the history immutable.
  • Easy Integration: Use decorators or context managers to wrap your existing code.
  • Verification CLI: Included CLI tool to verify evidence bundles offline.

Installation

pip install facto-ai

Quick Start

1. Initialize the Client

from facto import FactoClient, FactoConfig

client = FactoClient(
    FactoConfig(
        endpoint="http://localhost:8080",  # Your Facto ingestion endpoint
        agent_id="my-agent-001",
    )
)

2. Wrap LLM Calls

Using the Decorator:

from facto import ExecutionMeta

@client.factod(
    action_type="llm_call",
    execution_meta=ExecutionMeta(model_id="gpt-4")
)
def chat_with_llm(prompt):
    # Your LLM logic here
    return {"response": "Hello world!"}

result = chat_with_llm("Hi there")

Using the Context Manager:

with client.facto(
    "tool_execution",
    input_data={"tool": "search", "query": "weather in sf"}
) as ctx:
    # Perform action
    result = perform_search("weather in sf")
    
    # Record output
    ctx.output = result
    ctx.status = "success"

3. Verify Events

You can verify exported evidence bundles using the CLI:

facto verify path/to/evidence.json

Documentation

For full documentation, visit docs.facto.ai or the GitHub Repository.

Metadata

Release files for facto-ai 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 facto-ai 0.1.1
File Size Uploaded
facto_ai-0.1.1.tar.gz 16.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for facto-ai 0.1.1
File Interpreter ABI Platform
facto_ai-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 30.5 kB

Release files / facto_ai-0.1.1.tar.gz

Download URL facto_ai-0.1.1.tar.gz
Size 16.6 kB
Tags Source
SHA-256 checksum
How to use checksums
09b26d85355fd50c45f65a3b5e8360240d61662ee483b37b151040754dc3e8c3
BLAKE2b-256 checksum
How to use checksums
7e146884c28ab0684f132b4da7f42dc213c9da5b6c79bef6efaef553a488eacc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

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

Download URL facto_ai-0.1.1-py3-none-any.whl
Size 13.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74eeb7b19b95835ad44e4e4e3952987db505a9cbfa411f828ed093c67214563d
BLAKE2b-256 checksum
How to use checksums
ff50919b78d54b82952dfeb33eda2821c05a9ecb3fb89fced189b8230baf094d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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