> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tenetlabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Decide (streaming)

> Verdict-first Server-Sent Events. Events arrive in a locked order: `request_accepted` → `verdict` → optional `pii_findings` → optional `verdict_revised` → `explanation_chunk`* → `rewrite_chunk`* → optional `safety_findings` → `done` (the current judge emits no `explanation_chunk` / `rewrite_chunk`; audit-only `safety_findings` can trail `done`). The trailing `done` event carries an `envelope` field byte-equivalent to the sync `/decide` response body. Block at the `verdict` event; allow side-effectful calls only at `done` — an enforcing safety finding can outrank the EEO verdict via `verdict_revised`. [Streaming guide](/guides/streaming).



## OpenAPI

````yaml /api-reference/openapi.json post /decide/stream
openapi: 3.1.0
info:
  title: Judge API
  description: >-
    Compliance verdicts for agent tool calls. Agent messages and tool calls in →
    verdict, severity, and evidence out. The canonical decide endpoint is `POST
    /decide`. PII is detected on every request and redacted out of any text sent
    to a downstream LLM; detected values are not returned.
  version: 0.2.0
  contact:
    name: Tenet Labs
    url: https://tenetlabs.com
servers:
  - url: https://judge.tenetlabs.com
    description: Production
security:
  - bearerAuth: []
paths:
  /decide/stream:
    post:
      tags:
        - Decide
      summary: Decide (streaming)
      description: >-
        Verdict-first Server-Sent Events. Events arrive in a locked order:
        `request_accepted` → `verdict` → optional `pii_findings` → optional
        `verdict_revised` → `explanation_chunk`* → `rewrite_chunk`* → optional
        `safety_findings` → `done` (the current judge emits no
        `explanation_chunk` / `rewrite_chunk`; audit-only `safety_findings` can
        trail `done`). The trailing `done` event carries an `envelope` field
        byte-equivalent to the sync `/decide` response body. Block at the
        `verdict` event; allow side-effectful calls only at `done` — an
        enforcing safety finding can outrank the EEO verdict via
        `verdict_revised`. [Streaming guide](/guides/streaming).
      operationId: decideStream
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DecideRequest'
      responses:
        '200':
          description: >-
            SSE stream (`text/event-stream`). Each frame: `event: <type>`, `id:
            <event_id>`, `data: <json>`.
          content:
            text/event-stream:
              schema:
                type: string
                description: >-
                  SSE frames. Event types: request_accepted, pii_findings,
                  verdict, verdict_revised, explanation_chunk, rewrite_chunk,
                  safety_findings, error, done.
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/ValidationError'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/Unavailable'
components:
  schemas:
    DecideRequest:
      type: object
      properties:
        surface:
          type: string
          description: >-
            What kind of recruiting action is being checked — the judge reads it
            with the request, and it frames how the ask is interpreted, so pick
            it **per request** from the user's current intent, never once per
            application. Canonical values: `resume_triage` (screening/filtering
            candidates — the default), `job_ad_drafting`, `candidate_ranking`,
            `interview_question_gen`, `candidate_outreach`. Not an enum on the
            wire: unknown values are accepted and passed to the judge as written
            — stick to the five canonical values. Optional: when omitted, the
            judge infers the surface from the request text; with no clear signal
            it uses `resume_triage`. A provided value takes precedence, with one
            exception: at `phase: "agent_input"`, a provided `resume_triage` is
            refined to another canonical surface when the request text clearly
            matches one. Full guidance:
            [Surfaces](/concepts/surfaces#omitting-surface--automatic-inference).
          example: resume_triage
        messages:
          type: array
          description: >-
            Chat-style messages — the content being judged. Each item is a
            {role, content} object. `content` is a string or a list of text
            parts (`{"type": "text", "text": ...}`; `input_text` and
            `output_text` are also accepted), concatenated with no separator
            before any scanning or judging. Any other part type (image, audio,
            file, tool block) returns 422 naming the offending index. With more
            than one `user` message, the last is the request under judgment and
            earlier ones are read as conversation context. Send retrieved or
            tool-returned text as a `role: "tool"` message — the judge reads it
            as untrusted content. [Message
            content](/api-reference/introduction#message-content).
          items:
            type: object
            properties:
              role:
                type: string
                example: user
              content:
                oneOf:
                  - type: string
                  - type: array
                    items:
                      type: object
                      required:
                        - type
                        - text
                      properties:
                        type:
                          type: string
                          enum:
                            - text
                            - input_text
                            - output_text
                        text:
                          type: string
                example: find recent grads
          default: []
        context:
          type: object
          description: >-
            Evaluation context — tool name, tool input/output, and any harness
            metadata. Two keys matter most: `recruiter_prompt` (the user's
            actual ask, verbatim — required for full safety-pattern coverage)
            and `candidate_content` (the resume/candidate text, whenever the
            action involves one — omitting it disables candidate-side
            protections). See [Surfaces — what else the judge
            needs](/concepts/surfaces#what-else-the-judge-needs-in-the-request).
          properties:
            recruiter_prompt:
              type: string
              description: >-
                The user's actual ask, verbatim. Required for full
                safety-pattern coverage — a serialized args blob is not the
                user's words.
              example: filter to candidates with 5+ years of Python
            candidate_content:
              type:
                - string
                - 'null'
              description: >-
                Resume/candidate text, whenever the action involves a specific
                candidate's material. Omitting it disables candidate-side
                protections.
            tool_name:
              type: string
              description: >-
                The tool being judged. Useful in your own traces; on its own it
                does not move a verdict — a caller-asserted name is a hint the
                service re-validates, never an exemption. [Tool
                context](/concepts/tool-context).
              example: run_background_check
            tool_input:
              description: >-
                The parameters the tool is about to be called with (`phase:
                "tool_pre"`). The highest-value tool field — the judge reads
                these as facts and evaluates whether they describe a lawful
                action, so a call whose parameters carry the role, process
                stage, or consent basis passes where a bare call routes. [Tool
                context](/concepts/tool-context).
              example:
                role: delivery driver
                stage: post_offer
                consent_on_file: true
            tool_description:
              type: string
              description: >-
                What the tool does and what it requires, in the tool's own
                words. Gives the judge the tool's constraints alongside the
                call.
              example: >-
                FCRA-compliant pre-employment screening. Requires signed
                disclosure and candidate consent before execution.
            tool_output:
              description: >-
                What the tool returned (`phase: "tool_post"`). Send content you
                need judged at `tool_post` as a `role: "tool"` message. Keep it
                to what is actually being judged, since payload size drives
                latency. [Tool
                context](/concepts/tool-context#the-operational-fast-pass).
          additionalProperties: true
          default: {}
        phase:
          type:
            - string
            - 'null'
          description: Where in the agent loop this content sits.
          enum:
            - agent_input
            - tool_pre
            - tool_post
            - agent_output
            - null
        resolution_status:
          type:
            - string
            - 'null'
          description: Whether the tool output resolved the request (tool_post only).
          enum:
            - resolved
            - unresolved
            - error
            - null
        session_id:
          type:
            - string
            - 'null'
          maxLength: 199
          description: >-
            Conversation ID — groups a multi-turn conversation's evaluations
            into one audit trace. Keep it stable within a conversation, new
            across conversations.
          example: conv-8841
        domains:
          type:
            - array
            - 'null'
          items:
            type: string
          description: >-
            Per-call narrowing of the entitled domain set. Omit (or null) to run
            against every domain your account is entitled to (the default —
            maximum coverage). When provided, the effective set is `entitled ∩
            requested`; unknown or unentitled values are silently filtered. An
            empty list returns 422.
          example:
            - eeo
        intent:
          type:
            - string
            - 'null'
          enum:
            - read
            - action
            - unknown
            - null
          description: >-
            Caller-asserted classification of the call — the service's
            highest-precedence intent signal. Omit (or send `unknown`/`null`)
            for no assertion. A `read` is authoritative only at `phase:
            "tool_post"` and advisory at `agent_input`. [Read-intent
            contract](/concepts/read-intent).
          example: read
        tool_name:
          type:
            - string
            - 'null'
          description: >-
            Name of the tool being judged, as a named top-level field (the SDK
            sends it at the tool phases). A hint the service re-validates for
            intent classification — never an exemption. [Tool
            context](/concepts/tool-context).
          example: send_candidate_message
        tool_input:
          type:
            - object
            - 'null'
          description: >-
            The tool's arguments as a named top-level field (`tenet-client`
            0.7.1 sends a dict `tool_input` here). PII spans detected elsewhere
            in the request are swept out of it. It is **not** rendered into the
            judge's prompt — put what the judge must read in `context`. [Tool
            context](/concepts/tool-context#the-operational-fast-pass).
          example:
            candidate_id: c_8841
            message: Hi Jane, are you free Tuesday for a 30-minute call?
        workflow:
          type:
            - string
            - 'null'
          minLength: 1
          maxLength: 64
          pattern: ^[a-z0-9][a-z0-9._-]*$
          description: >-
            Optional label naming which of your integrations made the call (e.g.
            `resume-screener`, `recruiter-agent`), so your account's decisions
            can be filtered per workflow on the trace. Lowercase letters,
            digits, `.`, `_`, `-`, starting with a letter or digit; at most 64
            chars — a malformed value returns 422. Recorded on the decision
            trace only: never read by the judge and never affects the verdict.
            Distinct from `surface`, which the judge reads and must not be
            overloaded to separate callers.
          example: resume-screener
        mode:
          type: string
          enum:
            - judge
            - guardrails
          default: judge
          description: >-
            `judge` (default) runs the EEO judge. `guardrails` skips it and runs
            only PII detection and the safety rails; the response adds
            `redacted` — your `messages` and `context` with detected PII
            replaced by placeholders. `/decide` only: `/decide/stream` returns
            400 for `guardrails`. [Guardrails
            mode](/api-reference/introduction#guardrails-mode).
          example: guardrails
    Error:
      type: object
      description: Error envelope. Branch on `code`; `message` is for humans.
      properties:
        code:
          type: string
          description: >-
            Stable, programmatic error code — `BAD_REQUEST`, `UNAUTHENTICATED`,
            `VALIDATION_ERROR`, `RATE_LIMITED`, `QUOTA_EXCEEDED`,
            `SERVICE_UNAVAILABLE`, `batch_api_retired`, …
          example: VALIDATION_ERROR
        message:
          type: string
          description: >-
            Human-readable description. For a validation error it names the
            offending field.
        docs_url:
          type: string
          description: >-
            Link to this code's entry in the
            [Errors](/api-reference/introduction#errors) table.
        request_id:
          type: string
          description: >-
            Echoes the `X-Tenet-Request-Id` response header. Include it when
            reporting a problem.
          example: req_0123456789abcdef0123456789abcdef
        retry_after:
          type: integer
          description: Seconds to wait before retrying. Present only when applicable.
  responses:
    BadRequest:
      description: >-
        Malformed request — for example `mode: "guardrails"` on
        `/decide/stream`, which supports only `judge`. `code` is `BAD_REQUEST`.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: >-
        Missing or invalid bearer token. `code` is `UNAUTHENTICATED`. Some `401`
        responses carry no error envelope, so branch on the status code.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationError:
      description: >-
        Request failed validation — for example an empty `domains` list, a
        malformed `workflow`, or a `messages[*].content` part the judge cannot
        read. `code` is `VALIDATION_ERROR`; `message` names the offending field.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        Rate or quota limit reached. `code` is `RATE_LIMITED` (per-minute burst
        limit) or `QUOTA_EXCEEDED` (the account's monthly limit). The response
        carries a `Retry-After` header and a matching `retry_after` body field,
        in seconds; wait that long before retrying. On the stream endpoint the
        429 arrives before any SSE event.
      headers:
        Retry-After:
          description: Seconds to wait before retrying.
          schema:
            type: integer
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unavailable:
      description: Service temporarily unavailable.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        A self-serve API key (sk_tenet_…, from platform.tenetlabs.com; accepted
        on /decide and /decide/stream) or an M2M token (audience
        https://sdk.tenetlabs.com; accepted everywhere). See /authentication.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.