Java SDK
A typed JVM client for the EvalGuard /api/v1 surface — evals, security scans, traces, firewall, cost, compliance and prompts — plus a LangChain4j content filter.
Group ai.evalguard, artifact evalguard-sdk, v1.0.0.
Status — source available, Maven Central pending
The core Java client and the LangChain4j content filter compile and ship in the build at packages/java-sdk. The Maven Central publishing pipeline is wired (Sonatype Central Portal) and gated on namespace verification. Until it goes live, build from source or email support@evalguard.ai for a pre-release artifact. The LangChain4j chat-model listener and the Spring AI adapters (auto-configuration / interceptor / guardrail advisor) are experimental and currently excluded from the published build — they were written against API versions that have since drifted and are being reconciled. For production JVM use today, the REST API works from any language.
Install
Once Maven Central publishing is live, the coordinates will be:
<dependency> <groupId>ai.evalguard</groupId> <artifactId>evalguard-sdk</artifactId> <version>1.0.0</version> </dependency>
Until then, build and install the artifact to your local Maven repo from source:
git clone https://github.com/EvalGuardAi/evalguard cd evalguard/packages/java-sdk mvn -B clean install # -> ai.evalguard:evalguard-sdk:1.0.0 in ~/.m2
Quick start
Build a client from an API key, then call the typed methods. Every call throws EvalGuardException on a non-2xx response.
import ai.evalguard.EvalGuardClient;
import ai.evalguard.model.*;
var client = EvalGuardClient.builder(System.getenv("EVALGUARD_API_KEY"))
.build();
// Run a red-team security scan
var scan = client.runSecurityScan(
SecurityScanRequest.builder()
.projectId(projectId)
.model("gpt-4")
.build());
System.out.println("pass rate: " + scan.passRate());
// Real-time firewall check on an inbound prompt
var verdict = client.checkFirewall(
FirewallCheckRequest.builder()
.input(userPrompt)
.build());
if (!"allow".equals(verdict.action())) {
throw new IllegalStateException("blocked by firewall: " + verdict.reasons());
}LangChain4j content filter
Drop EvalGuardContentFilter into a LangChain4j pipeline to guardrail model I/O against your EvalGuard firewall rules.
import ai.evalguard.langchain4j.EvalGuardContentFilter; var filter = new EvalGuardContentFilter(client); // Reject or flag inputs/outputs that violate your firewall policy // before they reach (or leave) the model. var safeInput = filter.filterInput(userMessage);
Method reference
The published client exposes typed methods across these areas:
Evaluations
runEval()getEval()listEvals()Security
runSecurityScan()getSecurityScan()listSecurityScans()Traces
createTrace()getTrace()listTraces()searchTraces()Firewall
checkFirewall()listFirewallRules()createFirewallRule()Monitoring
getMonitoringAlerts()getMonitoringDrift()Cost / FinOps
getCost()getCostForecast()getCostSavings()Compliance
checkCompliance()listComplianceFrameworks()Prompts
createPrompt()getPrompt()listPrompts()updatePrompt()Prompt deployments & environments
listEnvironments()createEnvironment()removeEnvironment()setPromptDeployment()removePromptDeployment()