Protocol Documentation

Table of Contents

proto/director.proto

Top

BatchReviewRequest

FieldTypeLabelDescription
requests ReviewRequest repeated

BatchReviewResponse

FieldTypeLabelDescription
responses ReviewResponse repeated

ProcessRequest

FieldTypeLabelDescription
prompt string

ProcessResponse

FieldTypeLabelDescription
output string

coherence double

halted bool

candidates_evaluated int32

warning bool

fallback_used bool

ReviewRequest

FieldTypeLabelDescription
prompt string

response string

session_id string

ReviewResponse

FieldTypeLabelDescription
approved bool

coherence double

h_logical double

h_factual double

warning bool

StreamRequest

FieldTypeLabelDescription
prompt string

TokenEvent

FieldTypeLabelDescription
token string

coherence double

index int32

halted bool

halt_reason string

DirectorService

Method NameRequest TypeResponse TypeDescription
Review ReviewRequest ReviewResponse

Process ProcessRequest ProcessResponse

ReviewBatch BatchReviewRequest BatchReviewResponse

StreamTokens StreamRequest TokenEvent stream

schemas/proto/director/v1/director.proto

Top

APIKeyMetadata

FieldTypeLabelDescription
fingerprint string

Truncated salted fingerprint — never the raw key.

tenant_id string

issued_unix int64

When the key was issued, in unix seconds UTC.

expires_unix int64

When the key should stop working. Zero = no expiry.

revoked bool

AuditRecord

FieldTypeLabelDescription
timestamp string

RFC-3339 string with nanosecond resolution. String form keeps the wire format readable in text logs and survives clock-skew debates between services.

request_id string

tenant_id string

api_key_fingerprint string

query_hash string

Salted hash of the input query — never the plaintext.

response_length int32

Response length in characters, for volume metrics. Zero on halt.

verdict CoherenceVerdict

policy_violations string repeated

Structured policy violation codes.

latency_ms int64

Wall time the decision took end-to-end at the gateway.

model string

Model name actually routed to (may differ from requested model when the gateway falls back). Empty on pure heuristic scoring.

safety_events SafetyEvent repeated

Safety hook decisions attached to this audit row.

ChatChoice

FieldTypeLabelDescription
index int32

message ChatMessage

delta_content string

Delta content for streaming chunks. Assistants should populate `message.content` for non-stream and `delta_content` for stream.

finish_reason string

ChatCompletionRequest

FieldTypeLabelDescription
model string

messages ChatMessage repeated

temperature float

Sampling temperature. Zero signals "unset"; gateways forward the upstream default rather than zero-inject.

max_tokens int32

stream bool

tenant_id string

Tenant binding. Empty = use the tenant bound to the API key.

request_id string

Opaque per-request ID for correlation. Gateways must not mutate.

ChatCompletionResponse

FieldTypeLabelDescription
id string

model string

created_unix int64

choices ChatChoice repeated

usage TokenUsage

coherence CoherenceVerdict

Director-AI augmentation. Present on both stream chunks and final non-stream responses.

ChatMessage

FieldTypeLabelDescription
role Role

content string

name string

OpenAI allows a stable name per message, used for multi-user conversations and tool responses. Empty = not set.

CoherenceVerdict

FieldTypeLabelDescription
score float

halted bool

halt_reason HaltReason

hard_limit float

Scores below `hard_limit` halt the stream. Carried on the wire so a thin client can log the operating point without querying the server for its configuration.

score_lower float

Confidence intervals for `score`, if computed. Zero-zero means "not available" — consumers must not infer tight certainty from an absent CI.

score_upper float

sources GroundingSource repeated

Evidence trail for the verdict. Unused in heuristic mode.

message string

Free-form human string for logging and UI hover. Machine consumers should branch on `halt_reason`, not parse this.

GroundingSource

One line of scorer output for a claim-document pair. Ground-truth

sources that survive grounding are listed; full source text is

not duplicated — a reference is enough at the wire boundary.

FieldTypeLabelDescription
source_id string

similarity float

nli_support float

SafetyEvent

Tenant-safe halt or policy decision emitted by any safety hook.

The event carries references and short explanations only; raw

prompts, model output, and raw evidence text stay outside the wire

event.

FieldTypeLabelDescription
schema_version string

event_id string

timestamp string

request_id string

tenant_id string

hook_id string

hook_scope string

policy_decision PolicyDecision

halt_reason HaltReason

threshold float

observed_score float

latency_ms int64

evidence_refs string repeated

tenant_safe_explanation string

attributes SafetyEvent.AttributesEntry repeated

SafetyEvent.AttributesEntry

FieldTypeLabelDescription
key string

value string

ScoreClaimRequest

Single-shot scoring RPC input. Kept flat so clients can batch

claims without nesting.

FieldTypeLabelDescription
claim string

documents string repeated

tenant_id string

request_id string

threshold float

Per-call override of the server default. Zero = use server.

ScoreClaimResponse

FieldTypeLabelDescription
verdict CoherenceVerdict

latency_ms int64

Server-measured wall time, independent of any client-side timer.

ScoreTokenRequest

Streaming scoring: one request per token (or chunk), one verdict

per token. The server decides when to halt; clients must honour

`halted` immediately on any chunk.

FieldTypeLabelDescription
tenant_id string

request_id string

accumulated_text string

Accumulated assistant output to this point (not a delta). Mirrors the `accumulated = "".join(output_buffer) + token` shape on the Python side.

next_token string

Candidate token about to be emitted. Empty on the final "flush" request that closes the stream.

documents string repeated

ScoreTokenResponse

FieldTypeLabelDescription
verdict CoherenceVerdict

Tenant

FieldTypeLabelDescription
tenant_id string

display_name string

tier TenantTier

created_unix int64

When the tenant was created, in unix seconds UTC.

rpm_limit int32

Per-tenant rate limits. Zero = inherit gateway default.

rpd_limit int32

api_key_fingerprints string repeated

Fingerprint identifier of the API key bound to this tenant, as emitted by audit_salt.get_audit_salt + truncated SHA-256. Raw keys never cross this wire.

TokenUsage

FieldTypeLabelDescription
prompt_tokens int32

completion_tokens int32

total_tokens int32

HaltReason

NameNumberDescription
HALT_REASON_UNSPECIFIED 0

HALT_REASON_NONE 1

HALT_REASON_COHERENCE_BELOW_THRESHOLD 2

HALT_REASON_INJECTION_DETECTED 3

HALT_REASON_POLICY_VIOLATION 4

HALT_REASON_TOKEN_TIMEOUT 5

HALT_REASON_TOTAL_TIMEOUT 6

HALT_REASON_CALLBACK_TIMEOUT 7

PolicyDecision

NameNumberDescription
POLICY_DECISION_UNSPECIFIED 0

POLICY_DECISION_ALLOW 1

POLICY_DECISION_WARN 2

POLICY_DECISION_HALT 3

POLICY_DECISION_BLOCK 4

Role

NameNumberDescription
ROLE_UNSPECIFIED 0

ROLE_SYSTEM 1

ROLE_USER 2

ROLE_ASSISTANT 3

ROLE_TOOL 4

TenantTier

NameNumberDescription
TENANT_TIER_UNSPECIFIED 0

TENANT_TIER_INDIE 1

TENANT_TIER_PRO 2

TENANT_TIER_PERPETUAL 3

TENANT_TIER_ENTERPRISE_PILOT 4

TENANT_TIER_ENTERPRISE 5

ChatGateway

Method NameRequest TypeResponse TypeDescription
ChatCompletion ChatCompletionRequest ChatCompletionResponse

ChatCompletionStream ChatCompletionRequest ChatCompletionResponse stream

CoherenceScoring

Method NameRequest TypeResponse TypeDescription
ScoreClaim ScoreClaimRequest ScoreClaimResponse

ScoreStream ScoreTokenRequest stream ScoreTokenResponse stream

Scalar Value Types

.proto TypeNotesC++JavaPythonGoC#PHPRuby
double double double float float64 double float Float
float float float float float32 float float Float
int32 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. int32 int int int32 int integer Bignum or Fixnum (as required)
int64 Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. int64 long int/long int64 long integer/string Bignum
uint32 Uses variable-length encoding. uint32 int int/long uint32 uint integer Bignum or Fixnum (as required)
uint64 Uses variable-length encoding. uint64 long int/long uint64 ulong integer/string Bignum or Fixnum (as required)
sint32 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. int32 int int int32 int integer Bignum or Fixnum (as required)
sint64 Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. int64 long int/long int64 long integer/string Bignum
fixed32 Always four bytes. More efficient than uint32 if values are often greater than 2^28. uint32 int int uint32 uint integer Bignum or Fixnum (as required)
fixed64 Always eight bytes. More efficient than uint64 if values are often greater than 2^56. uint64 long int/long uint64 ulong integer/string Bignum
sfixed32 Always four bytes. int32 int int int32 int integer Bignum or Fixnum (as required)
sfixed64 Always eight bytes. int64 long int/long int64 long integer/string Bignum
bool bool boolean boolean bool bool boolean TrueClass/FalseClass
string A string must always contain UTF-8 encoded or 7-bit ASCII text. string String str/unicode string string string String (UTF-8)
bytes May contain any arbitrary sequence of bytes. string ByteString str []byte ByteString string String (ASCII-8BIT)