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

# Quickstart

> Gate your first tool call with the Tenet judge — install, authenticate, evaluate. Under five minutes.

**Goal**: a tool call in your agent → judged for compliance risk → blocked, rewritten, or allowed. You need Python 3.11+ and an API key. Sign up at [platform.tenetlabs.com](https://platform.tenetlabs.com) and select **View key** on the dashboard ([details](https://docs.tenetlabs.com/authentication.md#get-an-api-key)).

**1. Install**

```bash theme={null}
pip install tenet-langchain   # LangChain agents — pulls in tenet-client
# or, framework-free:
pip install tenet-client
```

**2. Authenticate**

```bash theme={null}
# Keep it out of source control.
export TENET_API_KEY="sk_tenet_..."
```

If Tenet issued you M2M credentials, set `TENET_CLIENT_ID` and `TENET_CLIENT_SECRET` instead. See [Authentication](https://docs.tenetlabs.com/authentication.md).

**3. Gate a tool call**

Pick your integration:

> [tab] LangChain (recommended)
>
> ```python theme={null}
> # Python — adapt to your agent's tools and model.
> from langchain.agents import create_agent
> from tenet_client import TenetCloudJudgeClient
> from tenet_langchain import TenetJudgeMiddleware
>
> judge = TenetCloudJudgeClient.from_env()
> judge.warmup()  # pre-mint the access token now, not on the first user request
>
> agent = create_agent(
>     model="claude-sonnet-4-6",
>     tools=[search_resumes, send_email],
>     middleware=[TenetJudgeMiddleware(judge)],  # gates every tool_pre + tool_post
> )
> ```
>
> That's it. Every tool call is now judged before it runs and after it returns. Blocked calls become tool errors with a compliance-safe message — the agent sees why and self-corrects.

> [tab] Framework-free
>
> ```python theme={null}
> # Python — gates any function, sync or async.
> from tenet_client import TenetCloudJudgeClient, judged, JudgeBlocked
>
> judge = TenetCloudJudgeClient.from_env()
> judge.warmup()
>
> @judged(judge)  # checks tool_pre (args) and tool_post (return value)
> def search_resumes(query: str) -> list[dict]:
>     return _fetch_resumes(query)
>
> try:
>     hits = search_resumes("5+ years Python, must be under 30")
> except JudgeBlocked as e:
>     print(f"Stopped at {e.phase}: {e.reason}")  # age proxy → held for review, so the tool never runs
> ```

> [tab] Direct client
>
> ```python theme={null}
> # Python — call the judge yourself when you own the tool loop.
> from tenet_client import JudgePolicy, TenetCloudJudgeClient
>
> judge = TenetCloudJudgeClient.from_env()  # one client per process
> judge.warmup()
> policy = JudgePolicy()
>
> def gate_tool_call(tool_name: str, tool_input: dict) -> str | None:
>     """Call before every tool dispatch. None = run the tool; str = don't, show this instead."""
>     verdict, _ = judge.evaluate_phase(
>         policy=policy,
>         phase="tool_pre",
>         tool_name=tool_name,
>         tool_input=tool_input,
>         surface="resume_triage",  # a screening action — set per request: /concepts/surfaces
>     )
>     if verdict.decision == "block":  # also what you get if the judge is unreachable
>         return verdict.reason or "Blocked by compliance check."
>     if verdict.decision == "review":
>         # Pause for a person here (/guides/hitl). Until they approve, don't run the tool.
>         return f"Held for human review: {verdict.reason}"
>     return None  # allow, or caveat (verdict.caveat carries an advisory note)
>
> print(gate_tool_call("search_resumes", {"query": "5+ years Python, must be under 30"}))
> # → Held for human review: …
> ```

**4. See it on the platform**

Open the dashboard at [platform.tenetlabs.com](https://platform.tenetlabs.com). The call is listed under **Recent decision traces** and on **Decision traces**, with its verdict. It can take a few seconds to appear.

**5. Read the verdict**

The canonical decide endpoint is `POST /decide` on `judge.tenetlabs.com`.

A direct HTTP call looks like:

```bash theme={null}
curl -s https://judge.tenetlabs.com/decide \
  -H "Authorization: Bearer $TENET_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "surface": "resume_triage",
    "messages": [{"role": "user", "content": "find candidates under 30"}],
    "context": {"recruiter_prompt": "find candidates under 30"}
  }'
```

Response shape:

```json theme={null}
{
  "verdict": "route_to_human",
  "severity": "high",
  "latency_ms": 11,
  "decision_id": "9f2c1a7b4e8d40a3b6c5e2f1a0d9c8b7",
  "route_reason": "semantic_graded",
  "degraded": false,
  "findings": [
    {
      "domain": "eeo",
      "verdict": "route_to_human",
      "severity": "high",
      "enforcement": "enforce",
      "rule_ids": ["EEO-AGE-PROXY-01"],
      "risk_labels": ["EEO-AGE-PROXY-01"],
      "evidence_span": "tier1:recruiter_prompt:under 30"
    }
  ]
}
```

Through the SDK, the same response surfaces as:

```python theme={null}
verdict.decision           # "allow" | "block" — the binary you act on
verdict.verdict            # native vocabulary: "include", "exclude", "route_to_human", ...
verdict.severity           # "none" | "low" | "medium" | "high" | "critical"
verdict.reason             # what triggered it — the finding's evidence_span
verdict.decision_id        # correlation key — log it
verdict.findings           # per-domain findings — read for per-domain detail
verdict.eeo_finding        # findings[0] when EEO is entitled
```

The top-level fields are the merged most-restrictive judgment across enforcing domains — an integration that branches only on `verdict` and `severity` is safe by construction. Read `findings[]` when you want per-domain audit logs or visibility into audit-only signals. Full rules: [Multi-verdict responses](https://docs.tenetlabs.com/concepts/multi-verdict.md).

Why did it decide that? Each finding carries `rule_ids` and `evidence_span` — see [How the Judge decides](https://docs.tenetlabs.com/concepts/decisions.md).

## Defaults you should know

* **Judge**: `hr-1` (EEO/HR compliance) — the only judge served by `judge.tenetlabs.com` today. Any other `TENET_JUDGE_ID` raises `JudgeUnavailableError` rather than silently 404ing.
* **Surface**: `resume_triage` — the client default. Right for the screening examples above; wrong as a hardwired value for everything else. When your product also drafts job ads, ranks candidates, writes interview questions, or composes outreach, set `surface=` per request — see [Surfaces](https://docs.tenetlabs.com/concepts/surfaces.md).
* **Timeout**: 3.0s per call. Guard hits return without a model call; other requests wait on one judge call. Read `latency_ms` on your responses to size the timeout for your traffic.
* **Failure mode**: fail-closed. Unreachable judge → `JudgeUnavailableError`, never a silent allow. Override per-policy if a tool is read-only and low-risk — see [Policies](https://docs.tenetlabs.com/guides/policies.md).

## Next

* [Set the right `surface` per request](https://docs.tenetlabs.com/concepts/surfaces)
* [Multi-verdict responses — `findings[]` and the merge rule](https://docs.tenetlabs.com/concepts/multi-verdict)
* [Tune verdict → action mapping with policies](https://docs.tenetlabs.com/guides/policies.md)
* [Act on blocks early with verdict-first streaming](https://docs.tenetlabs.com/guides/streaming.md)
* [Full middleware options](https://docs.tenetlabs.com/guides/langchain.md)
* [Wire protocol](https://docs.tenetlabs.com/api-reference/introduction.md)


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