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 -> UserFor tool calls, insert /v1/evaluate/tool before execution. For streamed output, use /v1/evaluate/stream while tokens are still arriving.
| Endpoint | When to call it | Why it exists |
|---|---|---|
| POST /v1/evaluate/input | Before the model call | Check prompts or tool inputs before they reach the model. |
| POST /v1/evaluate/output | After the model call | Filter, block, or transform model output before returning it. |
| POST /v1/evaluate/tool | Before tool execution | Evaluate tool requests and arguments before execution. |
| POST /v1/evaluate/stream | During streamed output | Apply runtime checks while a response is still being generated. |
| Field | Required | Purpose |
|---|---|---|
| text | Yes | The prompt, output, or tool payload to evaluate. |
| tenant_id | Yes | Tenant or organization identifier for scoped policy resolution. |
| app_id | Yes | Application identifier so multiple apps can share the same runtime safely. |
| agent_id | No | Optional agent or workflow scope. |
| env | No | Optional environment such as dev, staging, or prod. |
| metadata | No | Optional 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_responseTypeScript 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.