Skip to main content

Sign OpenAI agent tool calls with Vouch Credentials.

Project description

vouch-openai

Sign the tool (function) calls an OpenAI agent makes with Vouch Protocol Credentials, so every action an OpenAI-driven agent takes carries a verifiable identity and a non-repudiable record.

It works with the OpenAI Python SDK function calling (Chat Completions and the Responses API) and with the OpenAI Agents SDK, because all of them dispatch to Python tool callables and expose a tool call as a name plus JSON arguments.

Install

pip install vouch-openai

Configure an identity

export VOUCH_DID='did:web:your-agent.example.com'
export VOUCH_PRIVATE_KEY='{"kty":"OKP","crv":"Ed25519",...}'

Generate one with vouch init --domain your-agent.example.com --env, or pass a Signer explicitly.

Sign the model's requested tool call

from openai import OpenAI
from vouch.integrations.openai import sign_tool_call

client = OpenAI()
response = client.chat.completions.create(model="gpt-4o", messages=messages, tools=tools)

for call in response.choices[0].message.tool_calls:
    credential = sign_tool_call(call)   # binds the action and its arguments
    result = dispatch(call)             # run your tool

Sign the tool callables

from vouch.integrations.openai import signed_tool, protect

@signed_tool
def get_weather(city: str) -> str:
    ...

tools = protect([get_weather, send_email])   # every invocation is signed

Verify

from vouch.integrations.openai import verify_tool_call

ok, passport = verify_tool_call(credential)

A tool runs whether or not an identity is resolved; when none is configured, signing is skipped and the call proceeds unsigned.

License

Apache-2.0. Part of Vouch Protocol.

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

vouch_openai-0.1.0.tar.gz (3.1 kB view details)

Uploaded Source

Built Distribution

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

vouch_openai-0.1.0-py3-none-any.whl (2.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for vouch_openai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0ff3289e541c8dabc6516d9d9e7179e04fe11e86bcfdbd760fb71bf4fd095d64
MD5 0c5d9f309bf1b6da2d1b2e6e80860460
BLAKE2b-256 a14df0baace04280e2010ebb593ad2520992f7146c03108e3acd8cfbef62460e

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for vouch_openai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 78ba526249c4ff8493ee8ee3e6558fdf67a95e7a1b38699f2319ad040d3b91c4
MD5 38082d28a08576be7ddd0b432570a42e
BLAKE2b-256 90c527dc31722fd8d89dc3ad71ab260be0da4c25d961422da4f3037b158ac319

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