Skip to main content

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

Project description

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for asqav_pydantic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 04d37022de40bbcfedc76ebee5adc94794dcd01763e06fe98212a99e59262b5b
MD5 c23ca2f2bb5bf377bff61888d5beb71e
BLAKE2b-256 0da6f8229889b184dfeff27ed957fa7f811b00a05ff06b02fb97511e9cd4c9a5

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for asqav_pydantic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 565af81eca5ca1c0c7516a4520a9a5274978b8264b399dee112802c0c5ee65d7
MD5 0f06687e93de05a94d786154efe54192
BLAKE2b-256 ec602d857a3178fe94bafe8cc2ed18ec8e734cf5cf370ce9d89ca326be0b9b3c

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