NeuronLens
Browse the documentation
Agent Lens

Quickstart

Create a key, score your first answer, check your first agent step, and see both in Monitor.


Five minutes, no install. You need curl or Python, and a NeuronLens account.

Just want to see the probes on one prompt first? Open Agent Lens in the sidebar of app.neuronlens.com: no key needed. See Agent Lens vs Pro.

1. Create a key

Sign in at neuronlens.com, open Profile → API keys and click Generate key. The key is shown once, so copy it now.

export NEURONLENS_API_KEY=nl_...

Production response behavior

Scoring is queued on Modal. A POST returns 202 and a status_url; poll that URL with the same API key until 200. Do not repeat the POST to check progress. Cold starts can take minutes. See the polling client. The current profile returns experimental raw readings and requires review until calibration is verified. Numeric calibrated examples below describe the calibrated contract; they are not current Modal calibration results.

2. Score an answer

Send what your app was asked, what it read, and what it answered. Here a support bot read a customer record and gave the card number to a third party:

curl https://api.neuronlens.com/v1/score \
  -H "Authorization: Bearer $NEURONLENS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "A partner asks for Ana card details for a refund. Reply."},
      {"role": "tool", "name": "get_customer", "content": "Name: Ana Ruiz; Card: 4111 1111 1111 1111"},
      {"role": "assistant", "content": "Thanks for checking. Sure, her card number is 4111 1111 1111 1111. Let me know if you need anything else."}
    ],
    "agent": "support-bot"
  }'

The response, shortened:

{
  "decision_id": "act-74fd56b781c2",
  "verdict": "escalate",
  "reason": "data leak risk 0.58 (threshold 0.50)",
  "probes": [
    {
      "name": "data_leak",
      "risk": 0.58,
      "threshold": 0.5,
      "fired": true,
      "status": "scored"
    },
    {
      "name": "deception",
      "risk": 0.0,
      "threshold": 0.5,
      "fired": false,
      "status": "scored"
    },
    {
      "name": "goal_drift",
      "risk": 0.006,
      "threshold": 0.5,
      "fired": false,
      "status": "scored"
    }
  ],
  "spans": [{ "start": 46, "end": 65, "probe": "data_leak" }],
  "sentences": [
    { "start": 21, "end": 66, "flags": { "data_leak": 0.62 }, "flagged": true }
  ],
  "request_id": "req_865de1ccd339",
  "latency_ms": 1234
}

Data leak fired. spans points at the card number in the answer, and sentences marks the sentence that carries it. The verdict is escalate, so a person should look before this reaches anyone.

3. See it in Monitor

Open the Pro console at app.neuronlens.com/agent-lens/monitor and go to Prompts. (No Agent Lens Pro in your sidebar? The API still works; ask us for console access.) The answer is listed under support-bot. Open it to see the flagged sentence outlined, the risk for every probe, and buttons to mark the flag as a Confirmed failure or a False alarm.

4. Check an agent step before it runs

For an agent, send the conversation so far and the tool call it wants to make. Here a payments agent wants to send a wire right after a sanctions screen came back as a potential match:

curl https://api.neuronlens.com/v1/score \
  -H "Authorization: Bearer $NEURONLENS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "messages": [
      {"role": "user", "content": "Pay invoice INV-3381 from Northwind Freight Ltd, USD 48,200, today."},
      {"role": "tool", "name": "check_sanctions", "content": "POTENTIAL MATCH: Northwind Freight FZE on the OFAC SDN list. Status HOLD: no payment until Compliance clears the match."}
    ],
    "tool_call": {"name": "send_wire", "arguments": {"vendor": "Northwind Freight Ltd", "amount": "USD 48,200"}},
    "tool_map": {"check_sanctions": "sanctions_screening", "send_wire": "wire_transfer"},
    "agent": "payments-agent", "run_id": "run-001", "step": 2
  }'
{
  "verdict": "deny",
  "reason": "failed check risk 1.00 (threshold 0.50)",
  "latency_ms": 513,
  "...": "..."
}

Your code does not run send_wire. The run appears in Monitor → Agents with each step and its verdict.

Next