Skip to main content

Agent framework integrations for Sigmodx audit infrastructure

Project description

sigmodx-integrations

Agent framework integrations for Sigmodx — audit infrastructure for AI agents making consequential decisions.

Installation

pip install sigmodx-integrations

LangChain (Live)

Register one callback. Every agent tool call is automatically logged to Sigmodx with cryptographic attestation.

from sigmodx import SigmodxClient
from sigmodx_integrations import SigmodxCallbackHandler, ANOMALY_DETECTION_CONFIG

client = SigmodxClient(
    api_key="your-api-key",
    agent_id="your-agent-uuid",
)

handler = SigmodxCallbackHandler(
    client=client,
    config=ANOMALY_DETECTION_CONFIG,
)

result = agent_executor.invoke(
    {"input": "Check transaction TXN-2026-4421"},
    config={"callbacks": [handler]},
)

The handler:

  • Hashes tool inputs client-side (your data never leaves your environment)
  • Extracts decision type, rationale, and metadata from tool output
  • Submits the decision to Sigmodx's append-only audit trail
  • Never blocks agent execution — errors are logged, not raised

LangGraph (Live)

Two integration patterns — use whichever fits your graph structure.

Pattern 1: Stream event handler (recommended)

Process events from .astream_events() to log all tool calls automatically.

from sigmodx import SigmodxClient
from sigmodx_integrations.langgraph import (
    SigmodxLangGraphCallback,
    LANGGRAPH_ANOMALY_CONFIG
)

client = SigmodxClient(api_key="...", agent_id="...")
handler = SigmodxLangGraphCallback(
    client=client,
    config=LANGGRAPH_ANOMALY_CONFIG
)

# Process stream events
async for event in graph.astream_events(inputs, version="v2"):
    await handler.aprocess_event(event)

# Or process synchronously
for event in graph.stream(inputs):
    handler.process_event(event)

Pattern 2: Node decorator

Wrap specific decision-making nodes directly.

from sigmodx_integrations.langgraph import (
    sigmodx_node,
    LANGGRAPH_ANOMALY_CONFIG
)

@sigmodx_node(client=client, config=LANGGRAPH_ANOMALY_CONFIG)
def analyze_transaction(state: dict) -> dict:
    # your existing node logic
    return {
        "decision": "flag",
        "rationale": "Amount 3x historical average.",
        "anomaly_subtype": "unusual_amount",
        "severity": "high",
        "transaction_amount": state["amount"]
    }

graph.add_node("analyze_transaction", analyze_transaction)

Installation

pip install "sigmodx-integrations[langgraph]"
# or
pip install sigmodx-integrations langgraph

CrewAI (Live)

Two patterns: task-level callback or crew-level step callback.

Task callback (recommended for specific tasks)

from crewai import Task
from sigmodx import SigmodxClient
from sigmodx_integrations.crewai import (
    SigmodxTaskCallback,
    CREWAI_ANOMALY_CONFIG
)

client = SigmodxClient(api_key="...", agent_id="...")
sigmodx_callback = SigmodxTaskCallback(
    client=client,
    config=CREWAI_ANOMALY_CONFIG,
    task_inputs={"txn_ref": "TXN-001", "amount": 5000}
)

task = Task(
    description="Analyze transaction for anomalies",
    agent=analyst_agent,
    expected_output="flag/clear/escalate with rationale",
    callback=sigmodx_callback
)

Step callback (all agent steps)

from crewai import Crew
from sigmodx_integrations.crewai import SigmodxStepCallback

crew = Crew(
    agents=[analyst, compliance],
    tasks=[analysis_task, decision_task],
    step_callback=SigmodxStepCallback(client=client,
                                       config=CREWAI_ANOMALY_CONFIG)
)

Install

pip install "sigmodx-integrations[crewai]"

OpenAI Agents SDK (Live)

Implement RunHooks and pass to Runner.run().

from agents import Agent, Runner
from sigmodx import SigmodxClient
from sigmodx_integrations.openai_agents import (
    SigmodxRunHooks,
    OPENAI_ANOMALY_CONFIG
)

client = SigmodxClient(api_key="...", agent_id="...")
hooks = SigmodxRunHooks(client=client, config=OPENAI_ANOMALY_CONFIG)

agent = Agent(
    name="AnomalyDetector",
    instructions="Detect financial anomalies.",
    tools=[check_transaction, flag_anomaly]
)

result = await Runner.run(agent, "Check TXN-2026-4421", hooks=hooks)

Install

pip install "sigmodx-integrations[openai-agents]"

Custom scenario mapping

from sigmodx_integrations import SigmodxCallbackHandler, ScenarioConfig

config = ScenarioConfig(
    scenario="invoice_approval",
    filter_tools=["approve_invoice", "reject_invoice"],
    decision_type_extractor=lambda output: output.get("decision"),
    rationale_extractor=lambda output: output.get("reason"),
    metadata_extractor=lambda output: {
        "invoice_amount": output.get("amount"),
        "vendor_id": output.get("vendor_id"),
    },
)

handler = SigmodxCallbackHandler(client=client, config=config)

Universal adapter (any framework)

from sigmodx_integrations import SigmodxAdapter

adapter = SigmodxAdapter(client=client, scenario="anomaly_detection")

adapter.log(
    inputs={"txn_ref": "TXN-001", "amount": 5000},
    decision_type="flag",
    rationale="Amount 3x historical average.",
    anomaly_subtype="unusual_amount",
    severity="high",
    transaction_amount=5000,
)

Supported frameworks

Framework Status
LangChain Live
LangGraph Live
CrewAI Live
OpenAI Agents SDK Live
Universal adapter Live
AutoGen / Microsoft Agent Framework Coming soon
Semantic Kernel Coming soon

Request framework prioritization: github.com/Sigmodx/integrations-python/issues

Links

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

sigmodx_integrations-0.4.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

sigmodx_integrations-0.4.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file sigmodx_integrations-0.4.0.tar.gz.

File metadata

  • Download URL: sigmodx_integrations-0.4.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for sigmodx_integrations-0.4.0.tar.gz
Algorithm Hash digest
SHA256 3bcf0d6d60bff007b677a119f274449957741e8c30fbe59a8dddc341bfbea778
MD5 7a15f0c798398aaf936c093daf5284fb
BLAKE2b-256 7616bef11826b0f77abbd07ad65e059d5af6d39965f3bb8897bf944982f2400a

See more details on using hashes here.

File details

Details for the file sigmodx_integrations-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sigmodx_integrations-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9407a0d283f40598b01f89933f8d502eaf487327e9e863576050da120e6c89fd
MD5 e856fd83bd549fec250cff0d1cdb715d
BLAKE2b-256 65b5456c681947e58f05e905dfb3981108a0324ae69d369c1aad1193b42d3f90

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