BRIDGIT / DEVELOPERS / DECISIONS

Decisions with Jev

Ask the phone a question, get a clear answer with a confidence level, and act only when that confidence is high enough. Text goes to Jev; photos, sound and video go to Clef.

Building an app that decides things? Agents should read Designing apps with decisions first: which model and route to use, how to write questions and thresholds, preparing photos, sound and video, and what each check costs per month.

Why use it

Bridgit gives paired agents access to Jev, a decision model from TypeSafe. You send it a situation and ask a typed question, such as yes or no, or one of a few named options. It answers with the option it picked and how sure it is, for example “yes, 93% sure”. It doesn't write sentences.

Things you can do with it

When not to use it

Images, sound and video with Clef

For media, Bridgit's server also offers Clef-omni, a decision model from Cloudflare. It takes the same typed questions and gives the same kind of answers, plus a score type for rating on a scale, but it reads photos, screenshots, sound clips and short videos as well as text. In Bridgit's own tests it labelled phone screenshots correctly at 90–97% confidence, told a spoken delivery message from an alarm beep, and followed a screen recording.

Call POST {base_url}/v1/clef on Bridgit's server with a phone-made team key. The body is the same as for Jev, with up to four images, four audio clips (5 minutes each) and two videos (1 minute each), each as a base64 data URL such as data:image/jpeg;base64,.... Images can be up to 4 MB each; audio and video together up to 16 MB. Rules in actions work the same way. It costs about $0.0001 a photo and $0.0005 for 10 seconds of video, and shares Jev's hourly limit and daily budget. The phone's /v1/judgment still sends text to Jev only.

How it works

A paired agent calls POST /v1/judgment on the phone with three things. The state is what the questions are about. The questions are typed questions. The actions are optional rules saying “when this answer holds, do this”. The phone forwards the state and questions to Jev through Bridgit's server. The server checks each rule against Jev's answers and returns only the actions whose conditions held, with the reason each one fired. The phone then runs those actions as the calling agent, with the same switches and permissions as if the agent had asked directly.

An agent with a phone-made team key (GET /v1/feedback/team-key) can also call Bridgit's server directly at POST {base_url}/v1/jev, for example while the phone is offline. The body and reply are the same, but the actions come back as a list for the agent to act on; nothing runs on the phone.

Worked example

The agent sends the battery state, one question and two rules:

POST /v1/judgment
{
  "state": {"battery_percent": 12, "charging": false, "next_call_minutes": 120},
  "questions": {
    "charge": {
      "type": "choice",
      "instructions": "Should the owner plug the phone in before the call?",
      "criteria": {"yes": "Plug in first", "no": "Fine as it is"}
    }
  },
  "actions": [
    {"id": "plug_in",
     "when": {"answer": "charge", "choice": "yes", "min_confidence": 0.8},
     "do": {"type": "notice", "title": "Plug in before your call",
            "text": "12% won't last a two-hour call."}},
    {"id": "fine",
     "when": {"answer": "charge", "choice": "no", "min_confidence": 0.8},
     "do": {"type": "log", "message": "Battery is fine for the call."}}
  ]
}

Jev answers “yes” with 93% confidence. The first rule holds, so the phone shows the card. The second rule doesn't hold, so it is reported as skipped:

{
  "model": "jev-1.14.0",
  "answers": {"charge": {"type": "choice", "choice": "yes", "confidence": 0.93}},
  "usage": {"input_tokens": 212},
  "cost_usd": 0.0000089,
  "actions_schema": "bridgit-actions/1",
  "actions": [
    {"id": "plug_in", "type": "notice", "ran": true,
     "reason": "charge = yes at 0.93 ≥ 0.80"}
  ],
  "skipped": [
    {"id": "fine", "reason": "charge = yes, not no"}
  ]
}

Had Jev been unreachable, the agent would have received an error (upstream_failed or team_unavailable) and no card would have appeared.

Reference

Request

FieldWhat it is
stateRequired. Text, a JSON object or a JSON array, up to about 512 KB. Text only: no images, audio or video.
questionsRequired. 1–50 typed questions, {id: {type, instructions, criteria?}}, as in TypeSafe's primitives. choice picks one named option with a confidence; noul gives a probability from 0 to 1.
actionsOptional. Up to 10 rules, {id, when, do}, in the bridgit-actions/1 format below.

Conditions

when is one condition or a list of up to 5, and all of them must hold. A missing or malformed answer never holds. Thresholds include their edge: 0.80 passes “at least 0.80”.

ConditionHolds when
{"answer": "q", "choice": "yes", "min_confidence": 0.8}Question q picked “yes” with confidence ≥ 0.8 (min_confidence defaults to 0)
{"answer": "q", "min": 0.7}The probability answer to q is ≥ 0.7
{"answer": "q", "max": 0.2}The probability answer to q is ≤ 0.2 (min and max can be combined)

Actions (bridgit-actions/1)

This is the whole list. Every field is plain text; a link, script or unknown field makes the request fail with invalid_parameter before Jev is called. If a newer server ever sends a type this app doesn't know, the app ignores it and logs it.

TypeFieldsWhat the phone does
noticetitle (≤ 80), text (≤ 2,000, optional)Shows the owner a notice card from your agent. Needs Cards to be on and allowed for the agent.
speaktext (≤ 300)Reads the text aloud, under the speaker's usual rules and quiet hours.
logmessage (≤ 500)Writes a line, with the reason, to the phone's activity log.

Reply

model, answers (exactly as Jev gave them), usage, cost_usd, elapsed_ms, actions_schema, actions (the rules that fired: {id, type, reason, ran, error?}) and skipped ({id, reason}). An action can fire but not run, for example a card when Cards are switched off; ran is then false and error says why.

Access and limits

Errors

ErrorMeans
invalid_parameterBad state, questions or actions, or Jev refused the questions (its message is included). Nothing was run.
rate_limitedOver the hourly limit or the daily budget. Try again later.
upstream_failedJev was busy, down, slow (over 10 seconds) or unreadable. No action ran.
team_unavailableBridgit's server couldn't be reached. No action ran.

Full parameter list: POST /v1/judgment in the API reference.