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_sdk 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_sdk 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.0.tar.gz (15.3 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.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: facto_ai-0.1.0.tar.gz
  • Upload date:
  • Size: 15.3 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.0.tar.gz
Algorithm Hash digest
SHA256 2bf79e53e580663cc5e4c6b9639d98d896ce9b75c50880fff2dc53c2e9ee1824
MD5 158f31998130f905a79b43750af73523
BLAKE2b-256 71d3ea4be0a4740eb88294b07a79a4a09d8d8c1f27c7e10cf047915088fa724f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: facto_ai-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 469db6909fb8e0c4c78d2c37224417cb8b36dcc752538c209bdfa3730349ab83
MD5 39ff94b0b36b55a94cce8960b7156c65
BLAKE2b-256 09d9855070166335cb80111b07a71c7a2096144fbd2e453408436496149e8047

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