Skip to main content
Integration guide

The integration model is simple: evaluate before and after the model call.

The API surface does not change when you move from Starter to Growth. The runtime keeps the same endpoints; Growth and Enterprise change how policies are operated, not how your app calls the runtime.

Request flow

User -> Your App -> /v1/evaluate/input -> Model -> /v1/evaluate/output -> User

For tool calls, insert /v1/evaluate/tool before execution. For streamed output, use /v1/evaluate/stream while tokens are still arriving.

Runtime endpoints and where each one fits in the application flow.
EndpointWhen to call itWhy it exists
POST /v1/evaluate/inputBefore the model callCheck prompts or tool inputs before they reach the model.
POST /v1/evaluate/outputAfter the model callFilter, block, or transform model output before returning it.
POST /v1/evaluate/toolBefore tool executionEvaluate tool requests and arguments before execution.
POST /v1/evaluate/streamDuring streamed outputApply runtime checks while a response is still being generated.
Core request fields for scoped policy evaluation.
FieldRequiredPurpose
textYesThe prompt, output, or tool payload to evaluate.
tenant_idYesTenant or organization identifier for scoped policy resolution.
app_idYesApplication identifier so multiple apps can share the same runtime safely.
agent_idNoOptional agent or workflow scope.
envNoOptional environment such as dev, staging, or prod.
metadataNoOptional structured context for policy and observability use cases.

Python example

from znyx_sdk import GuardrailsSyncClient

guardrails = GuardrailsSyncClient("http://localhost:8080")

input_result = guardrails.evaluate_input(
    user_message,
    tenant_id="default",
    app_id="my-app",
)
if input_result.is_blocked:
    return {"error": input_result.user_message}

llm_response = call_llm(input_result.sanitized_text or user_message)

output_result = guardrails.evaluate_output(
    llm_response,
    tenant_id="default",
    app_id="my-app",
)

return output_result.sanitized_text or llm_response

TypeScript example

import { GuardrailsClient } from '@znyx/sdk';

const guardrails = new GuardrailsClient('http://localhost:8080');

const inputResult = await guardrails.evaluateInput({
  text: userMessage,
  tenantId: 'default',
  appId: 'my-app',
});

if (inputResult.isBlocked) {
  return { error: inputResult.userMessage };
}

const outputResult = await guardrails.evaluateOutput({
  text: llmResponse,
  tenantId: 'default',
  appId: 'my-app',
});

return outputResult.sanitizedText ?? llmResponse;

Operating note

Starter works with local policy files. Growth connects the same runtime to a hosted console. Enterprise can self-host the console as well. Your integration stays stable across all three.

ArchitectureCompare Plans