Skip to main content

PydanticAI integration for asqav - cryptographic audit trails for AI agent tool calls

Project description

asqav

Governance for AI agents. Audit trails, policy enforcement, and compliance.

PyPI version Downloads License: MIT Python versions GitHub stars

Website | Docs | SDK Guide | Compliance

asqav-pydantic

Cryptographic audit trails for PydanticAI agent tool calls.

Uses PydanticAI's Hooks capability to sign every tool invocation with asqav - producing tamper-evident records for compliance and governance.

Install

pip install asqav-pydantic

Usage

import asqav
from pydantic_ai import Agent
from asqav_pydantic import AsqavHooks

asqav.init(api_key="sk_...")

hooks = AsqavHooks(agent_name="my-agent")
agent = Agent("openai:gpt-4o", capabilities=[hooks.capability()])

result = agent.run_sync("Search for the latest AI news")

Every tool call the agent makes will produce signed tool:start, tool:end, and tool:error events through the asqav API. Signatures use ML-DSA (post-quantum) cryptography server-side.

How it works

AsqavHooks extends the asqav adapter base class and builds a PydanticAI Hooks capability with three registered hooks:

  • before_tool_execute - signs tool:start with tool name and input preview
  • after_tool_execute - signs tool:end with tool name and output metadata
  • on_tool_execute_error - signs tool:error with tool name and error details

All signing is fail-open. If the asqav API is unreachable, a warning is logged but the tool call proceeds normally. Your agent pipeline never breaks because of governance.

Configuration

# Use an existing asqav agent by ID
hooks = AsqavHooks(agent_id="ag_abc123")

# Override the API key
hooks = AsqavHooks(api_key="sk_other", agent_name="audit-agent")

License

MIT

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

asqav_pydantic-0.1.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

asqav_pydantic-0.1.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for asqav_pydantic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ec0570e86b74c8ed12ac76eae1ebcb058808e5ef794bfcb09853a0b1a355bb1f
MD5 50567c61c058cfe9cac3e155ebbd71a1
BLAKE2b-256 97c9a9f8d5a6435007b1bee9a5f7caa8f9f5b1a9adeb3ab15d629bcbe7866ff0

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asqav_pydantic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54b0f8e65a513caa8c0b13c9f3e06c6ac8c505d4124cc193ab436de09b626088
MD5 05df43804d8d12b8bd3fbd4c45a7f829
BLAKE2b-256 264fa26674ddd7dfa28d3b5b0dee5dd12e9ae73c93d1f9abd48992f6748ecaf5

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