SourceryKit

Security & Safety 💻 Python ⚖️ Other 🟢 Actively maintained
19 stars

SourceryKit is the Python SDK for Provably, enabling agents to self-verify API and MCP calls against recorded source evidence and create portable proofs. It detects tool calling errors and data hallucinations, helping downstream agents trigger retries and improve accuracy. It is designed for developers building AI agents that need verifiable claims.

✨ Key features

  • Verifiable claim evaluation with portable proofs
  • Automatic HTTP interception for API and MCP calls
  • Endpoint allow-listing to block untrusted destinations
  • Deterministic verdicts: PASS, CAUGHT, or ERROR
  • Framework-agnostic integration with major agent SDKs

🎯 Use cases

  • Verify agent claims about external API calls
  • Detect and prevent data hallucinations in agent outputs
  • Trigger retries or repair workflows based on proof outcomes
  • Audit agent actions with cryptographically anchored records

📦 Installation

🧰 Requirements: Requires Python 3.12+ and a Provably account with API key; optionally a PostgreSQL URL for custom database.

pip install sourcerykit
sourcerykit init          # one-time setup: account, sandbox, credentials

Prefer installing from source?

git clone git@github.com:ProvablyAI/sourcerykit.git
pip install -e ./sourcerykit

🚀 Usage

import uuid
import httpx
import sourcerykit
from agents import Agent, Runner
from sourcerykit import SourceryKitAgentResponse

async def run_verifiable_agent():
    await sourcerykit.bootstrap_system()
    await sourcerykit.insert_trusted_endpoint(url="https://api.example.com/data")
    async with sourcerykit.async_intercept_context(agent_id="demo-agent", action_name="get_data"):
        async with httpx.AsyncClient() as client:
            response = await client.get("https://api.example.com/data", params={"query": "example_parameter"})
            response.raise_for_status()
    prompt = "You are a helpful assistant."
    agent = Agent(name="demo-agent", instructions=prompt, tools=[...], model="model-name", output_type=SourceryKitAgentResponse)
    result = await Runner.run(agent, prompt)
    final_output = result.final_output
    payload_data = {
        "answer": final_output.answer,
        "claims": [{"action_name": "get_data", "claimed_value": final_output.claimed_values, "verification_mode": "field_extraction"}]
    }
    payload = await sourcerykit.build_handoff_payload(payload_data, run_id=uuid.uuid4(), prompt=prompt, intercept_agent_id="demo-agent")
    result 

⚠️ Good to know

The project is licensed under Business Source License 1.1, which restricts commercial hosting without a commercial license until 2029-05-07 when it converts to GPL-3.0-or-later.

❓ FAQ

What Python version is required?

Python 3.12 or higher is required.

How do I configure SourceryKit?

Run sourcerykit init to interactively set up your account, organization, and database. Alternatively, set environment variables like PROVABLY_API_KEY, SOURCERYKIT_ORG_ID, and SOURCERYKIT_POSTGRES_URL.

What are the possible evaluation outcomes?

The evaluator returns one of three outcomes: PASS, CAUGHT, or ERROR.

Can I use my own PostgreSQL database?

Yes, pass --postgres-url during init or set SOURCERYKIT_POSTGRES_URL manually.

📊 Repository

Stars★ 19
Forks🍴 1
Open issues🐛 16
Last commit🕒 Sep 1, 2026
Created📅 Apr 2026
Language💻 Python
License⚖️ Other

🤖 Overview, features, install steps and FAQ were generated from the project's README on Sep 4, 2026. Always check the original source before running commands.