Java SDK
Use com.veriproof:veriproof-sdk-core for application-owned actions. Add the Enforce adapter for each framework your application uses.
Govern one action
In the customer portal, open Tools and SDKs. Select your language and adapters, then follow the installation instructions shown there.
The package registry instructions use VeriProof's public GitLab feeds. Installs require no GitLab account or package credential. See SDK access for workstation and CI guidance.
VeriProof packages used here: com.veriproof:veriproof-sdk-core, com.veriproof:veriproof-sdk-adapter-spring-ai.
Store the API key as VERIPROOF_API_KEY, then create one client:
try (var veriproof = Veriproof.fromEnvironment()) {
var result = veriproof.govern(
"contract.answer",
request,
context -> {
context.throwIfStopped();
return answerContract(context.input());
}
);
}The core SDK checks the input before it calls answerContract. It checks output before release through the typed result.value() boundary.
Only completed, completed-with-warning, and transformed results can contain a released value. Pass the governed context’s stop signal into child work.
Never release a value from a blocked result, which the portal shows as Stopped by policy. Use the typed status, safe message, reason code, and evidence reference to handle results without a value.
REVIEW_CONTEXT_REQUIRED (review_context_required): Policy asked for human review, but the call didn’t include review options, so no review was opened and the action didn’t run. VeriProof recorded the attempt, and the evidence reference identifies it. Add GovernOptions.review(...) with an active review profile and run the action again. Retrying unchanged records the same stop.
Report token usage
Declare the model call with executionDescriptor, then report the counts the provider returned from inside the action. VeriProof prices the call from those counts and the call’s model.
var result = veriproof.govern(
"support.reply",
request,
context -> {
var response = provider.complete(context.input());
context.reportTokenUsage(response.inputTokens(), response.outputTokens());
return new Reply(response.text());
},
GovernOptions.builder()
.model(GovernModel.of("gpt-4.1-mini", "openai"))
.executionDescriptor(GovernedExecutionDescriptor.modelInvocation("chat"))
.build()
);The counts are metadata, so VeriProof records them even when content capture is off. The last report wins. reportTokenUsage throws IllegalArgumentException for a negative count and IllegalStateException when the call declared no model invocation; nothing is recorded. tryReportTokenUsage returns false instead of throwing. The OpenAI adapter reports the Responses API usage for you.
Handle a stop
Pass the governed action context into child work. Call context.throwIfStopped() immediately before each protected side effect.
A live Stop directive applies only to its matching run or application. The SDK signals the action before it acknowledges the directive. It does not terminate the Java process. Reconcile the side effect when the result reports uncertain completion.
Use typed industry values for shared business terms and facts for application-specific rule data. The active field contract checks required fields, types, and allowed values before protected work begins.
Continue after human review
Save the review checkpoint in the provided SQLite protected workflow store or an application implementation of the review-store contract. Verify signed callback bytes before parsing. A worker can then resume the saved checkpoint with a rebuilt protected callback.
Core Human Review uses a 12-field bounded brief and a response and resume-mode matrix. route_to_revision starts application-owned revision work and never runs the superseded payload. Private-note content remains in VeriProof and is excluded from the callback.
Reconcile uncertain execution before retrying an external side effect.
The hosted Server Ingest path is the default. Set VERIPROOF_EDGE_ENDPOINT to use the Edge API of your VeriProof Agent Gateway.
See Core Human Review for the lifecycle contract and the runnable Java receiver guide for callback hosting.
Framework adapters
Add the Enforce adapter for each framework your application uses. Checks names the operation the adapter controls. Put the core SDK’s governed action around anything under Not covered.
| Framework | Package | Checks | Not covered |
|---|---|---|---|
| LangChain4j | com.veriproof:veriproof-sdk-adapter-langchain4j | Synchronous text ChatModel calls, including calls that offer tools, and opt-in AI service tool calls | Streaming, multimodal input, and provider-hosted tools. |
| Micronaut LangChain4j | com.veriproof:veriproof-sdk-adapter-micronaut | Explicitly wrapped Micronaut-managed ChatModel, including calls that offer tools | Tool executors not wrapped with VeriproofLangChain4jTools, streaming, multimodal messages, and provider-hosted tools. |
| OpenAI Java | com.veriproof:veriproof-sdk-adapter-openai | Synchronous text-only Responses calls | Background responses, tools, and structured output and streaming. |
| Quarkus LangChain4j | com.veriproof:veriproof-sdk-adapter-quarkus-langchain4j | Explicitly wrapped raw ChatModel, including model calls of generated AI services with tools | Tool methods of generated AI services, streaming, multimodal content, and provider-hosted tools. |
| Semantic Kernel Java | com.veriproof:veriproof-sdk-adapter-semantic-kernel | Completed text chat calls represented by Mono and opt-in plugin function calls | Plugin functions left out of the tool selection and streaming. |
| Spring AI | com.veriproof:veriproof-sdk-adapter-spring-ai | Model calls and local tool calls | Streaming and handoffs are not covered until Spring AI exposes qualified withholding and continuation boundaries. |
See the package catalog and Java release notes.