Skip to main content

Python SDK for Facto - Forensic Accountability Infrastructure for AI Agents

Project description

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.

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

facto_ai-0.1.1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

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

facto_ai-0.1.1-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file facto_ai-0.1.1.tar.gz.

File metadata

  • Download URL: facto_ai-0.1.1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for facto_ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 09b26d85355fd50c45f65a3b5e8360240d61662ee483b37b151040754dc3e8c3
MD5 baea6b0ec8728e5e2430713192ffd4cc
BLAKE2b-256 7e146884c28ab0684f132b4da7f42dc213c9da5b6c79bef6efaef553a488eacc

See more details on using hashes here.

File details

Details for the file facto_ai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: facto_ai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for facto_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 74eeb7b19b95835ad44e4e4e3952987db505a9cbfa411f828ed093c67214563d
MD5 831c57c86874e7c512cc2f60a6ec339d
BLAKE2b-256 ff50919b78d54b82952dfeb33eda2821c05a9ecb3fb89fced189b8230baf094d

See more details on using hashes here.

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