Govern async-openai calls
veriproof-sdk-adapter-async-openai supports exactly async-openai 0.41.2. This is the community-maintained crate named async-openai. It is not openai, openai-rust, openai_rust_sdk, openai-core, or openai-agents.
The adapter wraps one async_openai::Client and one Veriproof client. Every call runs through the core govern method, so it returns the same typed GovernedResult, review checkpoint, warning, and evidence reference as application-owned work.
Open Tools and SDKs in the customer portal for the authenticated package source and install command.
Govern one request
use veriproof_sdk_adapter_async_openai::VeriproofAsyncOpenAi;
let governed = VeriproofAsyncOpenAi::new(openai_client, veriproof);
let result = governed
.execute("support.draft", request, |client, context| async move {
client.responses().create(context.input).await
})
.await;execute checks the typed request before the provider call and the typed response before release. The closure receives the client and a GovernedActionContext, so it works with any policy-authorized input replacement and can call context.throw_if_stopped() before side effects. Use execute_with_options to pass GovernOptions with application facts, industry values, content capture, or review settings.
The same helpers work with OpenAI, Azure OpenAI, and compatible base URLs. Keep endpoint, deployment, API version, and credential configuration in the upstream client.
Govern a buffered stream
let result = governed
.buffered_stream("support.stream", request, |client, context| async move {
client.responses().create_stream(context.input).await
})
.await;buffered_stream starts the provider stream only after input policy allows the call. It withholds every event until output policy completes, then releases the complete Vec of events in the result. A denial, review, runtime failure, cancellation, provider error, or size failure releases no events.
Limits per call:
- at most 256 events;
- at most 262,144 serialized bytes per event;
- at most 4 MiB across the buffered stream.
Use buffered_stream_with_options to pass GovernOptions.
Control boundary
The adapter governs model input and output executed through execute or buffered_stream. It does not own provider-hosted tools, application tool loops, agent handoffs, or direct calls made on the original upstream client. Put each application-owned action behind this adapter or the core govern method.
Use the core HumanReviewRuntime to resume a saved checkpoint; the adapter does not create a second review store. Read Continue Rust work after human review.