> ## 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.

# Surfaces

> The surface field tells the judge which recruiting action it's judging — five canonical values, chosen per request. The judge reads it with the request, so a wrong surface misframes the ask.

**`surface`**: the request field that tells the judge *what kind of recruiting action* it's checking. It's **optional**; omit it and the judge infers it ([below](#omitting-surface--automatic-inference)). Either way it reaches the judge as part of the request and frames how the ask is read — the same text means something different as a resume screen than as a job-ad draft.

## The five surfaces

| `surface` | Use when the user or agent is… | Example asks |
| - | - | - |
| `resume_triage` | Screening, filtering, or evaluating candidates and resumes | "filter candidates by…", resume review, screening questions about a candidate |
| `job_ad_drafting` | Writing or editing job ads, job descriptions, or postings | "draft a JD for…", "rewrite this job ad" |
| `candidate_ranking` | Ordering, comparing, or short-listing candidates | "rank these candidates", "who's the top pick" |
| `interview_question_gen` | Creating interview questions or scenarios | "draft interview questions for…" |
| `candidate_outreach` | Composing messages to candidates | "write an outreach email to…" |

`resume_triage` is the default — it's the client default in `tenet-client`, and what inference falls back to when the text gives no signal.

The field is a free string on the wire: an unknown value is **not rejected** — the literal value is passed to the judge as written, with no canonical meaning behind it. That's a forward-compatibility affordance, not an extension point. Stick to the five canonical values.

## Pick the surface per request

The surface describes the user's **current intent**, not your application. A recruiting copilot drafts a job ad in one turn and screens resumes in the next — two surfaces in one conversation.

> [!WARNING]
>
> The hardwired-surface anti-pattern: setting `surface="resume_triage"` once — in a client constructor, a config value, a copy-pasted request template — and sending it on every call. Chat, drafting, ranking, outreach: the judge is told every one of them is a resume screen, so a job-ad draft or an outreach email is framed as a screening action, and your surface distribution tells you nothing about your traffic. (At `agent_input` the engine refines an asserted `resume_triage` when the text clearly says otherwise — [below](#omitting-surface--automatic-inference) — but tool calls get no such repair.) Classify per request.

When you can't classify a request cleanly, omit `surface` and let the judge infer it rather than guessing. A wrong guess misframes the ask; an omitted field gets classified from the text.

## Omitting `surface` — automatic inference

`surface` is **optional**. When you omit it, the judge classifies the request itself and records how the value was chosen:

```json theme={null}
{
  "messages": [{"role": "user", "content": "Draft a job ad for a senior backend engineer."}],
  "context": {"recruiter_prompt": "Draft a job ad for a senior backend engineer."}
}
```

Whether the surface was provided or inferred is recorded on Tenet's server-side [decision trace](https://docs.tenetlabs.com/concepts/traces.md); it isn't a field on the default response.

How inference and a provided value interact:

* **A provided `surface` wins — with one exception.** At `phase: "agent_input"`, a provided `resume_triage` is refined when the request text clearly matches a different action: "draft a job ad for a forklift operator" sent as `resume_triage` is judged as `job_ad_drafting`. The refined value is recorded as inferred. Ambiguous text, tool phases, and every other provided surface are judged as sent.
* **No clear signal defaults to `resume_triage`.**
* **A surface never exempts a request.** It frames the ask; the same guards and the same judge apply whatever the surface.

When to rely on it vs. classify yourself:

| Situation | Recommendation |
| - | - |
| You already know the intent (a dedicated drafting flow, a mapped tool call) | Send `surface` explicitly — it's free precision |
| Free-form chat where classifying each turn is real work | Omit `surface` and let the judge infer |
| You were about to hardwire one value for everything | Omit instead — inference beats a wrong constant |

Omitting `surface` is the simplest fix for the hardwired-surface anti-pattern above: remove the constant and the judge classifies per request.

## Per-surface examples

Each body is a valid `POST /decide` request — the same envelope works on `/decide/stream`:

```json resume_triage theme={null}
{
  "surface": "resume_triage",
  "messages": [{"role": "user", "content": "filter to candidates with 5+ years of Python"}],
  "context": {
    "recruiter_prompt": "filter to candidates with 5+ years of Python",
    "candidate_content": "JANE DOE — Senior Backend Engineer …"
  },
  "phase": "tool_pre",
  "session_id": "conv-8841"
}
```

```json job_ad_drafting theme={null}
{
  "surface": "job_ad_drafting",
  "messages": [{"role": "user", "content": "draft a job ad for a night-shift warehouse lead"}],
  "context": {"recruiter_prompt": "draft a job ad for a night-shift warehouse lead"},
  "phase": "agent_input",
  "session_id": "conv-8841"
}
```

```json candidate_ranking theme={null}
{
  "surface": "candidate_ranking",
  "messages": [{"role": "user", "content": "rank these three candidates for the dispatcher role"}],
  "context": {
    "recruiter_prompt": "rank these three candidates for the dispatcher role",
    "candidate_content": "1) ALEX P — 4 yrs dispatch …\n2) SAM R — …\n3) JO K — …"
  },
  "phase": "tool_pre",
  "session_id": "conv-8841"
}
```

```json interview_question_gen theme={null}
{
  "surface": "interview_question_gen",
  "messages": [{"role": "user", "content": "draft interview questions for a pediatric nurse"}],
  "context": {"recruiter_prompt": "draft interview questions for a pediatric nurse"},
  "phase": "agent_input",
  "session_id": "conv-8841"
}
```

```json candidate_outreach theme={null}
{
  "surface": "candidate_outreach",
  "messages": [{"role": "user", "content": "write an outreach email to Jane about the senior backend role"}],
  "context": {
    "recruiter_prompt": "write an outreach email to Jane about the senior backend role",
    "candidate_content": "JANE DOE — Senior Backend Engineer …"
  },
  "phase": "tool_pre",
  "session_id": "conv-8841"
}
```

Across all five, `context.recruiter_prompt` carries the user's ask verbatim, and `context.candidate_content` is present whenever the action touches a specific candidate's material — screening it, ranking it, or writing to its owner.

## Choosing a surface from a chat or agent product

A chat product doesn't have one surface — it has one per turn. Two places to classify:

**Judging user turns (`agent_input`)** — classify the turn's intent before judging it. A keyword router or a cheap intent classifier is enough; the categories are coarse. When a turn genuinely straddles ("rank them and email the top two"), judge each action at its own tool boundary — the ranking call as `candidate_ranking`, the email call as `candidate_outreach` — rather than averaging into one surface.

**Judging tool calls (`tool_pre` / `tool_post`)** — you usually don't need a classifier: the tool already encodes the intent. Map tools to surfaces once:

| Tool kind | `surface` |
| - | - |
| Resume search, candidate filters, screening evaluators | `resume_triage` |
| Job-description generators and editors | `job_ad_drafting` |
| Ranking, scoring, shortlist tools | `candidate_ranking` |
| Interview-question or scenario generators | `interview_question_gen` |
| Email/message composers, scheduling messages to candidates | `candidate_outreach` |

```python theme={null}
# Python — the tool name is the intent signal; classify once, in the map.
SURFACE_BY_TOOL = {
    "search_resumes": "resume_triage",
    "draft_job_ad": "job_ad_drafting",
    "rank_candidates": "candidate_ranking",
    "generate_interview_questions": "interview_question_gen",
    "draft_outreach_email": "candidate_outreach",
    "schedule_interview": "candidate_outreach",  # the candidate-facing message is what's judged
}

v = judge.evaluate(
    phase="tool_pre",
    tool_name=tool_name,
    tool_input=tool_args,
    surface=SURFACE_BY_TOOL.get(tool_name, "resume_triage"),  # unmapped tool → the default
)
```

> [!NOTE]
>
> `@judged` and `TenetJudgeMiddleware` send the **client's** configured surface on every call — there's no per-call override on those paths today. If your agent's tools span action kinds, gate at a dispatch choke point with `evaluate(surface=...)` as above, or run one scoped middleware per action family (`judge_tools_pre=` allowlists, one client per surface, constructed at startup).

## What else the judge needs in the request

A related mistake: requests that are schema-valid but leave out what the judge needs.

| Field | Rule | What omitting it costs |
| - | - | - |
| `context.recruiter_prompt` | The user's actual ask, verbatim. **Required for full safety-pattern coverage.** | Patterns keyed on recruiter intent never fire — a serialized args blob is not the user's words. |
| `context.candidate_content` | The resume/candidate text, whenever the action involves one. | Candidate-side protections are disabled — the judge can't see what's being done *to* the candidate's material. |
| `session_id` | Stable within a conversation, new across conversations. | Multi-turn risk judged cold, and the [verdict trace](https://docs.tenetlabs.com/concepts/traces.md) fragments — one conversation becomes unjoinable decisions. |

On a tool phase there's more to send: `context.tool_input` and `context.tool_description` carry the facts that make a restricted action lawful, and a bare tool call routes without them. [Tool context](https://docs.tenetlabs.com/concepts/tool-context.md).

## Integration checklist

Run this against your integration before shipping:

* [ ] `surface` chosen **per request** from the five canonical values — not hardwired in a constructor, config, or request template
* [ ] Tool calls mapped tool → surface; unmapped tools fall back to `resume_triage`
* [ ] `context.recruiter_prompt` carries the user's verbatim ask on every request
* [ ] `context.candidate_content` populated whenever the action involves a candidate's material
* [ ] `session_id` stable within a conversation, different across conversations
* [ ] Spot-check production traffic: the surface distribution should look like your product. A multi-feature product sending 100% `resume_triage` is the hardwired anti-pattern.

## Common mistakes

| Mistake | Symptom | Fix |
| - | - | - |
| One hardwired surface for all traffic | Drafting and outreach asks framed as screening; surface distribution is flat | Classify per request — map tool calls, classify turns |
| Empty or synthetic `recruiter_prompt` | Intent-keyed patterns never fire; verdicts look oddly lenient on bad asks | Send the user's words verbatim |
| `candidate_content` omitted on candidate actions | Candidate-side protections silently off | Pass the material being acted on |
| New `session_id` per request | Multi-turn escalation invisible; audit traces fragment | One ID per conversation |
| Invented surface values | The judge gets a label with no canonical meaning | Use the five canonical values |

## Links

* [API overview — the request envelope](https://docs.tenetlabs.com/api-reference/introduction.md)
* [How the Judge decides — what happens after the request lands](https://docs.tenetlabs.com/concepts/decisions.md)
* [Framework-free integration — `evaluate(surface=...)` at your dispatch loop](https://docs.tenetlabs.com/guides/framework-free)
* [Verdict Traces — what `session_id` buys you at audit time](https://docs.tenetlabs.com/concepts/traces)


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