How to use Jev AI: a practical API tutorial
Build a small support router with Jev's HTTP API, interpret Choice and Noul answers, and handle uncertainty before connecting the result to an agent.
A useful first Jev integration is a router that recommends where a request should go. The output is easy to inspect, and you can compare recommendations with the queue your support team actually chose.
We'll build that router with Node.js and the HTTP API. It will classify the topic and check whether the customer reports that an earlier support attempt failed. It will print a proposed route without modifying a ticket.
Prepare a server-side example
Use Node.js 20 or later. Obtain a TypeSafe API key through the TypeSafe console, then make it available to the process as TYPESAFE_API_KEY. Keep the key on the server.
TypeSafe documents a bearer-authenticated POST endpoint at https://api.typesafe.ai/v1/systemone. The request contains a model identifier, the material to evaluate, and named questions. See its quickstart.
Save the following as route-ticket.mjs. This is an original example based on the documented API, not a recorded production run.
Run it after setting the environment variable:
The response fields and error handling follow the HTTP API reference. The example stops on an API failure; a live support service should preserve the ticket in a fallback queue when that happens.
Read the result before acting on it
Inspect answers.topic.choice for the selected topic and answers.prior_help_failed.noul for the second judgment. The example does not assume a particular returned value. Record what your account actually receives.
For Choice, confidence summarizes the shape of the probability distribution. It is not interchangeable with the probability attached to the winning option. TypeSafe explains that distinction in its confidence guide.
Our rule sends uncertain topics, unmatched topics, and likely failed support attempts to review. The numbers are examples of policy settings, not validated recommendations. If the costliest mistake is making a customer repeat failed troubleshooting, evaluate that mistake explicitly when selecting a cutoff.
Improve the questions with examples
Create a small set of tickets with an expected topic and a label for failed prior help. Include ordinary requests and awkward ones:
- A new invitation problem with no previous support contact.
- A customer who mentions yesterday's successful support interaction while reporting a different issue.
- A ticket containing both an access problem and an invoice question.
- A short reply whose meaning depends on the previous message.
The second case tests whether the question distinguishes prior contact from failed help. The fourth tests whether you supplied enough context. Treat those as separate defects rather than adjusting a single threshold until both disappear.
Prepare for a live request path
Add bounded retries for temporary failures and an overall time budget. TypeSafe documents 429 and 529 responses as retryable with backoff. Avoid a retry loop that makes the customer wait indefinitely. API error reference.
Keep the question wording in version control. The sample pins a model version; record the returned version too, and evaluate changes before updating it. Compare proposed routes with human labels before letting the recommendation move real tickets.
For the surrounding application design, read building an agent harness with Jev.
Bring the conversation into Currai
A routing label is more useful when you can read the conversation that produced it. Use the Currai integration skill to instrument your application's real request path, including relevant decision inputs, outputs, and the agent's eventual response.
Then define a Currai intent for repeated support attempts and inspect its matched conversations. Those examples give your team concrete material for improving the router and the response that follows it. Connect your application to Currai.
