
Welcome to Jev Fundamentals: Decision AI for Beginners. This opening lecture introduces the course, explains what you will build, and shows how each section moves you toward one practical goal: using Jev to add reliable, measurable decisions to real software.
We begin with the big question behind the course. Many AI applications only generate text, but real systems also need to decide things: which team should handle a request, which model should answer it, whether an action is safe, and when a person should step in. This course focuses on those decisions and on treating them as engineering problems rather than guesses.
You will see the roadmap. First come the foundations: Decision AI, your development environment, Jev's decision primitives, and how to write good decision questions. Next, you will learn about confidence and thresholds, then build a support ticket routing system and a cost-aware model router. After that, you will integrate decisions into LangChain and LangGraph, protect agents with tool-call gating, detect prompt injection, verify answers and citations, and filter evidence in RAG systems. Finally, you will benchmark, harden, and present a complete application.
We also introduce the evolving BrightDesk DecisionOps case study that ties the labs together, and we explain the approach: short concept lectures followed by hands-on labs. By the end of this lecture you will know what the course covers, what background helps, and how to get the most from each section.
What exactly is Decision AI, and why should you care? This lecture answers both questions with plain language and concrete examples, so that the rest of the course has a firm foundation.
We start with a simple definition. Decision AI refers to AI components whose job is to make structured decisions inside an application, such as choosing a category, assigning a score, or answering yes or no, rather than writing long passages of free text. The output is designed to be consumed by code, which makes it easier to test, log, and control.
Next, we look at why this matters. Every business workflow is full of decisions: routing a support ticket, deciding whether a refund needs approval, judging whether a document is relevant, flagging a risky instruction. When those decisions are made inconsistently or opaquely, systems become slow, costly, or unsafe. A dependable decision layer can reduce unnecessary calls to large models, enforce policies, and make behavior easier to audit.
We also discuss what Decision AI is not. It does not replace human judgment where stakes are high, and it does not remove the need for clear rules and oversight. Instead, it works alongside business logic, confidence thresholds, and human review.
Finally, we preview examples from the course, including routing, guardrails, and verification. After this lecture you will be able to explain Decision AI in your own words and recognize where it fits in a software system.
This lecture introduces Jev, the decision-focused tool you will use throughout the course, and the idea of System One models. The goal is to give you a clear mental picture of what Jev does and what role it plays in an application.
We begin with the motivation. Large language models are flexible, but using them for every small judgment can be slow, expensive, and hard to control. Jev, from TypeSafe, takes a different approach: it is built to answer structured decision questions and return typed responses that software can use directly.
Next, we introduce the idea of System One models. The name borrows from the familiar distinction between fast, intuitive thinking and slower, deliberate reasoning. In this course, a System One style model is one designed for quick, focused judgments such as classification and scoring, in contrast to long-form generation. We explain how this framing helps you decide which tasks suit Jev and which belong to a larger model or to ordinary code.
Then we preview the workflow you will follow: describe the state of the situation, ask a clear question, and receive a typed answer, optionally with probabilities, that you can combine with rules and thresholds.
We also set expectations about verifying results, since no model is perfect. After this lecture you will understand Jev's purpose, its place in an architecture, and why typed, structured outputs matter.
Choosing the right tool for a decision is a core skill in AI engineering. This lecture compares three approaches: Jev, traditional large language models, and rule-based systems, so that you know when each one fits.
We begin with rule-based systems. Rules are transparent, fast, and predictable, which makes them excellent for clear conditions such as checking a field value or enforcing a permission. Their weakness is brittleness: rules struggle with messy language, new phrasing, and situations nobody anticipated, and large rule sets become hard to maintain.
Next, we cover traditional LLMs. They handle flexible language and can reason across many topics, but when used for simple decisions they can be slower, costlier, and less consistent. Free-form answers must be parsed, and the same input may produce different wording or even different conclusions.
Then we place Jev between the two. It aims to understand natural language like a model while returning structured, typed decisions that fit directly into code, with confidence information that you can use to set thresholds.
We compare the options on accuracy, latency, cost, consistency, explainability, and maintenance, and we emphasize that the best systems combine all three: rules for hard constraints, Jev for structured judgments, and larger models for open-ended generation.
After this lecture you will be able to choose an approach for a given decision and justify your choice.
The BrightDesk DecisionOps case study is the thread that runs through the entire course, and this lecture introduces it. Instead of disconnected demos, you will build one evolving application, step by step.
We begin with the story. BrightDesk is a fictional company that receives a steady stream of customer support requests and wants to handle them faster and more safely. Messages arrive in many styles, with different urgency, topics, and risk levels, and the team must decide where each one should go and what automation is appropriate.
Next, we outline how the project grows. You will start with a simple classifier that sorts requests. Later you will add scoring for urgency and business impact, confidence thresholds, and human review. Then you will build a router that sends tasks to smaller or larger models, connect everything to agent workflows, add safety gates for tool calls, detect prompt injection, verify answers and citations, and filter evidence for retrieval-based answers.
We also describe the data you will use. Most examples rely on synthetic business data, so you can experiment freely without handling real customer information.
Finally, we explain how the case study leads to the capstone, in which you assemble the pieces into a complete, reviewable platform. After this lecture you will understand the scenario and how each lab contributes to it.
In this first practical activity you will identify real-world AI decisions, training yourself to spot the places where a decision layer could help. Recognizing decisions is the first step toward designing good Decision AI.
You will begin by looking at everyday software workflows, such as customer support, hiring screening, content moderation, order processing, document review, and security alerts. For each, list the individual decisions people or programs make: which category does this belong to, how urgent is it, is it allowed, is it safe, is this evidence relevant?
Next, you will describe each decision in a structured way. Write down the input available, the possible outputs, who consumes the result, and what happens if the decision is wrong. This simple template turns vague ideas into precise problems, and it will be reused in later labs when you write decision questions for Jev.
Then you will sort the decisions by risk and complexity. Some can be automated confidently, some need a human check, and some should remain entirely with people. Mark which ones are best handled by rules, which by a decision model, and which by a larger language model.
Finally, choose a few decisions from the BrightDesk scenario and record them as candidates for the course project. By the end of this activity you will have a short catalog of decisions and a habit of thinking about errors and consequences.
This lecture provides the Complete Hands-On Lab Package that accompanies the course. Think of it as your toolkit: one place to find the starter materials, data, and instructions you will use in the practical lectures.
We begin by explaining what the package contains and how it is organized. It is arranged to follow the structure of the course, so each lab has the materials you need, including starter code, synthetic datasets, example inputs, and notes. We show how to download the package and keep it in a tidy project folder, separate from other work, so that you can return to earlier labs easily.
Next, we describe a simple workflow for every lab: read the lab goals, set up your environment, run the starter code, complete the exercises in order, and compare your results with the expected outcomes. We also recommend keeping a short notebook of observations, since many later labs build on earlier decisions.
Then we talk about practical points. Because the course involves live exercises that need access to TypeSafe's service, you should be aware that API usage may involve costs, and we encourage you to read the pricing terms before running large experiments. Where possible, labs use small amounts of data.
Finally, we explain how to handle version differences, since tools change over time. After this lecture you will have your lab materials ready and know how to use them effectively.
Before writing code, it helps to know how all the pieces of the Jev ecosystem fit together. This lecture gives you a clear map of the tools you will use and how they relate to one another.
We begin with the core components. There is the service that runs Jev's decision models, a browser-based playground for experimenting, an API for sending decision requests from any program, and a software development kit that makes those requests convenient from Python. We explain when each is useful: the playground for quick exploration, the API for understanding what is sent and returned, and the SDK for building applications.
Next, we look at the supporting tools. You will use Python for your code, an editor such as VS Code, and libraries for handling data and environment variables. Later in the course you will add LangChain and LangGraph for agent workflows, so we show where Jev sits within those architectures.
Then we discuss the typical flow of a decision request: your application gathers state, formulates a question, sends the request, receives a typed response, and applies business logic to decide what happens next. We also touch on authentication, rate limits, and cost awareness.
By the end of this lecture you will understand the ecosystem well enough to follow the setup steps and to know which tool to reach for in each situation.
Now it is time to prepare your machine. In this lecture you will install Python, VS Code, and the libraries you need so that every lab runs smoothly.
We begin by checking whether Python is already installed and which version you have. If you need to install or update it, we walk through the process for your operating system and explain why a recent version is a good choice. Next, we install VS Code, a popular and free editor, and add the Python extension for features such as syntax highlighting, debugging, and integrated terminals.
Then we create a virtual environment, an isolated space that keeps the course packages separate from other projects. You will learn how to create it, activate it, and confirm that your terminal is using the right interpreter. We then install the required libraries using a requirements file, and we explain how to record dependencies so that your setup can be rebuilt later.
You will run a short test script to confirm that everything works, and open the project folder in VS Code to check that the editor recognizes your environment. We also install Git, which is useful for tracking changes in your lab work.
Finally, we cover troubleshooting for common problems such as path issues, permission errors, and package conflicts. After this lecture your development environment will be ready for the hands-on work ahead.
Jev offers several ways to interact with it, and this lecture explores three of them: the TypeSafe Playground, the API, and the SDK. Knowing all three helps you move from experimenting to building.
We begin with the Playground, a visual place to try decision questions without writing code. You will see how to enter a situation, pose a question, choose the kind of answer you want, and inspect the response. It is ideal for quickly testing ideas and for understanding how wording affects results.
Next, we examine the API. Here you will learn what a request contains, such as the state or context, the question, and the type of response, and what a response looks like, including the decision and any probability information. Looking at the raw request and response helps you understand what the SDK does for you and makes debugging much easier.
Then we introduce the SDK, which wraps the API in convenient Python functions and types. You will see how it reduces boilerplate, validates inputs, and returns objects that are simple to use in code.
We also discuss when to choose each tool, how to compare results between them, and how to keep track of experiments. After this lecture you will be comfortable moving between the Playground, the API, and the SDK.
API keys are the credentials that let your code use a service, and handling them carelessly is one of the most common and costly mistakes in software. This lecture shows how to manage API keys and environment variables safely.
We begin with why it matters. A leaked key can be used by others, leading to unexpected charges, exposed data, or misuse of your account. Keys should never be written directly into source code, committed to version control, pasted into screenshots, or shared in chat.
Next, we introduce environment variables, a standard way to supply secrets to a program from outside the code. You will learn how to set them in your terminal for a session, and how to store them in a local file that is excluded from version control, commonly named with a dot-env convention. We show how to load them in Python and how to check that a key is present without printing it.
Then we cover good habits: add the secrets file to your ignore list before the first commit, use separate keys for different projects, rotate keys if you suspect exposure, set spending limits where available, and give each key only the access it needs.
We also discuss what to do if a key leaks. After this lecture you will be able to configure credentials securely and build the habit of treating secrets with care.
In this lecture you will create your first Jev decision application. The goal is a small, working program that sends a situation and a question to Jev and uses the answer in code.
We begin by outlining the structure of a minimal application. It has a configuration step that loads the API key from an environment variable, a function that builds the request, a call to Jev, and code that reads the typed response and acts on it. You will see how each part maps to the concepts introduced earlier, and why keeping them separate makes the program easier to test.
Next, we write the code together. You will define a short piece of text, such as a customer message, describe the possible categories, ask Jev to choose one, and print the decision. We discuss how to handle errors, including missing keys, network failures, and unexpected responses, so that the program fails clearly rather than silently.
Then we experiment. Try several different inputs, change the wording of the question, and observe how the result changes. Keep notes on cases that surprise you, since they will be useful when you learn to test decision quality.
Finally, we organize the code into a reusable file. After this lecture you will have a working decision application and a template for the labs that follow.
In this hands-on lab you will build your first Jev-powered classifier, bringing together the setup and basic concepts from this section into a small but complete project.
You will begin by defining the problem. Choose a simple classification task from the BrightDesk scenario, such as sorting customer messages into categories like billing, technical issue, account access, and general feedback. Write down the categories clearly and gather a small set of example messages, including some that are straightforward and some that are ambiguous.
Next, you will write the classifier. Load your credentials from environment variables, create a function that takes a message and returns a category, and handle errors gracefully. Run it over your examples, print the results in a readable table, and compare them with the labels you expected.
Then you will examine the outcomes. Identify cases where the classifier disagreed with you, and decide whether the cause was an unclear category, a confusing message, or a genuine mistake. Adjust your category descriptions and try again, noting what changed.
Finally, you will save your work as a reusable module with a short README describing how to run it and what you learned. By the end of this lab you will have a working classifier and a repeatable process for improving it, which you will extend in the next sections.
Jev's decisions are built from a few simple ideas, and this lecture introduces the first three: state, questions, and typed responses. Understanding them clearly makes everything that follows easier.
We begin with state. The state is the information you give Jev about the situation: a customer message, a ticket with metadata, a tool call and its parameters, or a document and a claim. You will learn to include what is needed for the decision and to leave out what is not, since irrelevant detail can distract the model and add cost.
Next, we cover questions. A question describes what you want decided, such as which team should handle this ticket, how urgent it is, or whether this action is safe. We discuss how a good question is specific, answerable from the state, and phrased so that the possible answers are clear.
Then we explain typed responses. Rather than returning free text, Jev returns an answer in a defined form, such as one option from a list, a numeric score, or a probability-based yes or no. This makes the result immediately usable by code, easy to validate, and straightforward to log and compare.
We also show how these three parts combine in a request. After this lecture you will understand the building blocks of every Jev decision and be ready to explore the different response types.
Many business problems come down to sorting things into categories and sending them to the right place. This lecture shows how to use Jev's Choice primitive for classification and routing.
We begin with what Choice does. You provide the state and a question, along with a list of allowed options, and Jev selects one of them. Because the answer must come from your list, the result is predictable in form and can be used directly in a conditional statement or a routing table.
Next, we discuss how to design the options. Good options are distinct, cover the cases you expect, and are described clearly enough that a person could apply them consistently. We discuss including an option for other or unclear cases, and why forcing a choice when none fits can create errors.
Then we apply Choice to routing. For example, classify a support message as billing, technical, account, or sales, and use the result to select a queue. We show how to map choices to actions in code and how to log each decision for review.
We also look at multi-class pitfalls, such as overlapping categories, and at how to evaluate results against labeled examples. After this lecture you will be able to implement classification and routing with Choice and design option lists that work well in practice.
Not every decision is a category; sometimes you need to measure how much of something there is. This lecture covers Jev's Score primitive and how to use it for risk, priority, and quality evaluation.
We begin with what Score provides. Instead of selecting from a list, it returns a numeric rating along a defined scale, such as zero to ten, for a quality you describe in the question. This lets you rank items, set cutoffs, and compare cases in a consistent way.
Next, we discuss how to define a scale. A useful score has clear meaning at its endpoints and at points in between, so you should describe what low, medium, and high mean for your situation. We show examples such as urgency of a support ticket, risk of an action, and quality of a draft response, and explain why vague scales produce inconsistent results.
Then we apply scores in workflows. Use thresholds to route high-priority tickets first, to require review above a risk level, or to reject responses below a quality bar. We also discuss combining several scores, such as urgency and business impact, to form a priority.
We finish with cautions: scores are estimates, not measurements, and they need testing against examples. After this lecture you will be able to design score questions and use the results to drive prioritization and quality checks.
Sometimes the decision is simply yes or no, but with an important question attached: how sure are you? This lecture introduces Jev's Noul primitive for probability-based yes-or-no decisions.
We begin with the idea. Noul answers a yes-or-no question and gives a probability, so you receive both a leaning and a measure of how strongly the model holds it. A result of ninety-five percent yes is very different from fifty-five percent yes, even though both lean the same way, and your application can treat them differently.
Next, we discuss writing good yes-or-no questions. They should be about one clear thing, phrased so that yes means something specific, and answerable from the information provided. We show examples such as whether a message is a complaint, whether a request mentions a refund, or whether an action is destructive, and explain how double-barreled or vague questions cause confusion.
Then we introduce how probabilities support decisions. You can approve automatically above a high threshold, reject below a low one, and send the uncertain middle to a person. We preview the later section on thresholds, where you will choose cutoffs based on the cost of mistakes.
We also remind you that probabilities need checking against real examples. After this lecture you will be able to use Noul to build decisions that carry their own measure of confidence.
Real applications rarely need only one answer. This lecture shows how to combine multiple decision questions in a single request, so that you can gather several judgments about the same situation efficiently.
We begin with a realistic example: a customer message that needs a category, an urgency score, and a flag for whether it mentions a legal or safety concern. Asking three separate questions means repeating the state, which adds cost and latency. Combining them lets you send the information once and receive all the answers together.
Next, we discuss how to structure a combined request. Each question should have its own clear identifier, type, and instructions, and the response should map each answer back to its question. You will learn to keep questions independent so that one does not depend on another, and to avoid packing so many into a single request that they become hard to manage.
Then we cover using the combined results. Apply business logic that considers several answers together, such as routing by category unless the safety flag is raised, in which case the item goes straight to a human queue. We also discuss handling partial failures and validating each answer.
Finally, we compare combined and separate requests in terms of cost, clarity, and testing. After this lecture you will be able to design multi-question requests and build rules that use them well.
In this hands-on lab you will build a multi-decision support system, using Choice, Score, and Noul together to analyze incoming customer messages in the BrightDesk scenario.
You will begin by defining the decisions you want. Use Choice to classify each message by topic, Score to rate urgency and perceived customer frustration, and Noul to answer yes-or-no questions such as whether the message mentions a security issue or requests a refund. Write each question carefully, including the allowed options and the meaning of each score range.
Next, you will implement the system. Build a function that accepts a message, sends a combined request, validates the typed responses, and returns a structured result. Then add business logic that combines the answers into an action, for example sending a security concern to a priority queue, sending a high-urgency billing message to a senior agent, and sending routine questions to a general queue.
Then you will test it. Run a set of sample messages, record the decisions, and look for inconsistent or surprising results. Add logging so that every decision and its inputs can be reviewed later.
Finally, you will summarize what worked, what failed, and what you would change. By the end of this lab you will have a working multi-decision pipeline that you will improve in later sections.
The quality of a decision depends heavily on the quality of the question. This lecture teaches you to write clear and focused decision questions that produce consistent, useful answers.
We begin with the characteristics of a good question. It asks about one thing, uses plain and specific language, and can be answered using only the information provided. Compare a vague question, such as is this a problem, with a focused one, such as does this message report that the customer cannot sign in. The second leaves far less room for different interpretations.
Next, we discuss common mistakes. Questions that combine several ideas, rely on unstated assumptions, use jargon the model may not share, or ask for opinions rather than judgments tend to produce unreliable results. We show how to rewrite them step by step.
Then we cover practical techniques. State the perspective or criteria explicitly, define terms that might be ambiguous, and describe edge cases when they matter. Keep the question stable between requests, since small wording changes can alter results, and version your questions like code.
We also explain how to compare question variants using a small set of examples. After this lecture you will be able to write, test, and refine decision questions systematically instead of relying on trial and error.
When you ask Jev to classify something, the categories you define are as important as the question itself. This lecture covers designing effective classification criteria.
We begin with the qualities of a good set of categories. They should be mutually exclusive, so that each item clearly fits one, and collectively exhaustive, so that every expected item fits somewhere. In practice, perfect separation is rare, so we discuss including an other or unclear category and deciding what happens when an item falls into it.
Next, we explain how to describe each category. A short, concrete definition with typical examples and with clear boundaries against neighboring categories helps both the model and the people who maintain the system. You will see how to write criteria such as billing means questions about charges, invoices, or refunds, while account access covers sign-in and password problems.
Then we discuss granularity. Too few categories lose useful distinctions, while too many create overlaps and make accuracy harder to achieve and measure. We show how to start with a small set and split categories only when you have evidence that the distinction matters for routing or action.
We also address handling items that fit several categories and how to document your criteria. After this lecture you will be able to design a category scheme that is clear, testable, and aligned with your business needs.
Decisions rely on the information you provide, and this lecture shows how to supply it in the most useful form. We cover text, JSON, and structured application state.
We begin with plain text, the simplest option. It works well for messages, emails, and short documents, and the main concern is making sure the relevant text is included and clearly delimited from any instructions. Next, we introduce JSON, which lets you organize information into named fields, such as customer tier, product, previous tickets, and the message itself. Structure helps the model use the right information and makes your requests consistent and easier to log and test.
Then we discuss structured application state more broadly. In real systems, the information for a decision may come from a database, a form, a conversation history, or the result of an earlier tool call. We show how to select and format the fields that matter, and how to keep sensitive information out of requests unless it is necessary.
We also cover practical points: keeping field names meaningful, avoiding very large inputs, and handling missing values explicitly. Finally, we discuss validating your state before sending it.
After this lecture you will be able to choose an input format, build clean state objects, and balance completeness against cost and privacy.
Poorly chosen labels and excess context are two of the most common reasons decision systems underperform. This lecture explains how to avoid ambiguous labels and unnecessary context.
We begin with ambiguous labels. Names such as issue, problem, or other can mean many things, and overlapping labels such as technical and bug force both the model and the reviewers to guess. You will learn to spot ambiguity by asking whether two competent people would assign the same label, and to fix it by renaming, merging, or defining categories more precisely.
Next, we discuss unnecessary context. It is tempting to include everything available, but extra information can distract the decision, raise costs, increase latency, and introduce sensitive data without benefit. You will see how irrelevant details, long histories, and repeated boilerplate can sometimes nudge the answer in the wrong direction.
Then we show a practical process. Start with the minimum context needed, test on examples, and add information only when it clearly improves results. Remove fields that do not change decisions, and summarize long histories where appropriate.
We also discuss documenting why each label and field exists. By the end of this lecture you will be able to simplify your labels and inputs, making decisions that are more accurate, cheaper, and easier to maintain.
A decision system is only as trustworthy as the tests behind it. This lecture explains how to test decision quality using representative examples, rather than relying on a few impressive successes.
We begin with what representative means. Your test examples should resemble the real inputs your system will meet, including common cases, borderline cases, messy formatting, unusual phrasing, and cases that should be sent for review. A set made only of clean, easy examples will overstate performance.
Next, we cover building a small labeled set. Collect examples, assign the correct answers with a clear process, and keep the set separate from the examples you used while designing your questions, so that you can measure honestly. You will learn how many examples are enough to begin, how to add more over time, and how to track where labels were uncertain.
Then we discuss running tests and reading the results. Compare predictions with labels, look at which categories are confused, and read the actual failures rather than only the summary. Failures often reveal unclear labels or missing context that you can fix.
We also introduce simple metrics and the idea of regression testing, rerunning your set whenever you change a question. After this lecture you will be able to evaluate a decision workflow and improve it with evidence.
In this hands-on lab you will improve an AI classification workflow, applying the question design, criteria, and testing ideas from this section to the classifier you built earlier.
You will begin by assembling a representative test set of BrightDesk messages, including typical requests, ambiguous ones, messages with multiple topics, and messages with irrelevant details. Label each one carefully and write down any that were hard to label, since they point to unclear categories.
Next, you will run your existing classifier on the set and record the results. Build a confusion table that shows which categories are mixed up, and read through the failures to identify causes, such as vague definitions, overlapping labels, missing context, or poorly worded questions.
Then you will make improvements one at a time. Rewrite category definitions, remove unnecessary context, restructure the input as JSON, and refine the question. After each change, rerun the test set and record accuracy and the specific cases that moved, so that you can see which changes helped and which did not.
Finally, you will document the final version, including the question, categories, input format, and test results, and keep it in version control. By the end of this lab you will have a measurably better classifier and a repeatable improvement process.
Probabilities and confidence scores are central to Decision AI, and this lecture explains what they are and how to read them. They are what allow a system to say not only what it thinks, but how strongly.
We begin with probabilities. A probability expresses the model's degree of belief that an answer is correct, as a number between zero and one, or between zero and one hundred percent. For a yes-or-no question, a probability near one means strong support for yes, near zero means strong support for no, and near one half means the model is unsure.
Next, we discuss confidence in classification. When there are several options, the probabilities across them describe how the model distributes its belief, and the gap between the top choice and the runner-up often says as much as the top value. A confident answer has a clear leader, while an uncertain one shows several close contenders.
Then we explain why this information is valuable. It lets you build rules such as accept when confident, review when uncertain, and reject when clearly negative, instead of treating every answer as equally reliable.
We also introduce a caution: a probability is only useful if it is meaningful, which is why later lectures cover calibration and testing. After this lecture you will be able to interpret confidence values and begin using them in decisions.
A very high confidence score feels reassuring, but it does not guarantee that an answer is right. This lecture explains why, and how to avoid the trap of trusting confidence blindly.
We begin with how confidence can mislead. A model may be very sure about an answer that is wrong, particularly when the input is unusual, the question is ambiguous, the training data contained biases, or the situation differs from what the model has seen. High confidence reflects the model's internal certainty, not an external check against the truth.
Next, we introduce calibration. A model is well calibrated if, among all the cases where it says ninety percent, about ninety percent are correct. Many systems are not perfectly calibrated, being overconfident in some regions or categories. You will learn how to examine calibration using your labeled examples by grouping predictions by confidence and comparing the stated confidence with the observed accuracy.
Then we discuss practical consequences. Confidence thresholds should be chosen using evidence from your own data, not assumed from the numbers. High-stakes decisions should have additional safeguards, such as deterministic checks, secondary verification, or human review, even when confidence is high.
We also cover the risk of drift, when the data changes over time. After this lecture you will be able to treat confidence as useful information that must be validated, not as proof.
How confident must a system be before it acts on its own? The answer depends on what happens when it is wrong. This lecture explains how to set decision thresholds based on business risk.
We begin with the cost of errors. Different mistakes have different consequences. Misrouting a general question costs a few minutes, while automatically approving a fraudulent refund or ignoring a security report could be far more expensive. A good threshold reflects those costs rather than a single universal number.
Next, we discuss the tradeoff between acting and asking. A high threshold means fewer automatic decisions and more human review, which reduces errors but increases workload. A low threshold automates more but accepts more mistakes. You will learn to think in terms of false positives and false negatives and to decide which is more harmful in each situation.
Then we show how to choose thresholds using data. Run your labeled examples, see how accuracy and review volume change at different cutoffs, and select a point that meets your accuracy goal at a manageable review rate. We also discuss using different thresholds for different categories or actions.
Finally, we cover documenting and revisiting thresholds as data and business needs change. After this lecture you will be able to choose and justify thresholds that match your organization's risk tolerance.
No decision system should be forced to answer every time. This lecture covers designing fallbacks, abstention, and human review, so that uncertain cases are handled safely.
We begin with abstention, the ability to decline to decide. When confidence is low, the question is ambiguous, or the input is outside what the system handles, the right output is often not a guess but a request for help. You will learn how to define an explicit uncertain result and how to detect cases that deserve it.
Next, we discuss fallbacks. A fallback is what happens when the primary decision is unavailable or unreliable: a service error, a timeout, a low-confidence result, or a conflict between signals. Options include retrying, using a simpler rule, asking a larger model, or sending the item to a person. We emphasize choosing fallbacks that fail safely.
Then we turn to human review. Design the queue so that reviewers see the input, the model's answer, and the confidence, and can record their decision. Those decisions provide valuable labeled data to improve the system. We discuss workload management, service times, and avoiding over-reliance on automation.
Finally, we stress logging every fallback and abstention. After this lecture you will be able to build workflows that handle uncertainty responsibly.
Individual thresholds and fallbacks become powerful when they are combined into a clear policy. This lecture shows how to build confidence-aware decision policies that govern what your system does in each situation.
We begin with the idea of a policy: a set of explicit rules that map decisions and confidence levels to actions. For example, if the category is billing and the confidence is above a high level, route automatically; if it falls in a middle band, send to review; if below a low level, mark as unclear and ask for more information.
Next, we discuss policy design. Consider the type of decision, the cost of errors, the confidence, and any additional signals, such as customer tier or the presence of a risk flag. We show how to represent policies in code as readable configuration, rather than scattering numbers throughout the program, so that they can be reviewed and changed safely.
Then we cover combining the model's output with deterministic rules. Some constraints, such as legal requirements or permission checks, should be enforced by code regardless of the model's confidence.
We also discuss testing policies by simulating them on labeled data and measuring accuracy, automation rate, and review load, and monitoring them after launch. After this lecture you will be able to design transparent policies that make confidence actionable.
In this hands-on lab you will build a confidence-based approval workflow, applying the thresholds, fallbacks, and policy ideas from this section to a realistic business process.
You will begin by choosing a decision to automate, such as approving small refund requests or deciding whether a ticket can be closed automatically. Define what is allowed, what is risky, and what should always be reviewed by a person, and write these rules down as a simple policy.
Next, you will implement the decision step with Jev, using a yes-or-no question with a probability, and add the confidence-based logic: automatic approval above a high threshold, automatic rejection or escalation below a low one, and human review in between. Add a deterministic check for hard limits, such as maximum amounts, that the model cannot override.
Then you will test the workflow on a labeled set of examples. Measure how many items are approved, rejected, and reviewed, how many errors occur in each group, and how the results change when you adjust the thresholds. Create a small table or chart showing the tradeoff between automation and accuracy.
Finally, you will add logging of every decision and write a short justification for your chosen thresholds. By the end of this lab you will have a working approval workflow and the evidence needed to defend it.
Before building automation, you need to understand the workflow you are automating. This lecture explains how enterprise support triage works and where Decision AI can help without introducing new risks.
We begin with the basic flow. A customer contacts the company through email, chat, a web form, or a phone transcript. The request is received, categorized, assigned a priority, routed to the right team, and tracked until it is resolved. Each step involves decisions, and in busy organizations these decisions are made thousands of times a day, often by people working quickly under pressure.
Next, we discuss common problems. Messages are routed to the wrong team, urgent issues sit unnoticed in general queues, customers repeat themselves, and agents spend time on sorting rather than solving. Inconsistent triage leads to slow responses, unhappy customers, and wasted effort.
Then we introduce the BrightDesk triage design. We identify the decisions that make up the workflow: what the customer wants, how urgent and important the request is, which team should handle it, and whether it should be escalated. For each, we consider what information is available, who consumes the result, and what happens if the decision is wrong.
We also discuss service-level targets, escalation rules, and the importance of keeping humans in control of sensitive cases. After this lecture you will understand the triage process and be ready to automate it step by step.
Understanding what a customer actually wants is the first step in handling a request well. This lecture shows how to classify customer intent with Jev.
We begin with the concept of intent. Customers rarely state their needs in tidy terms: a message might complain about a charge, ask how to cancel, report that a feature is broken, or mention several things at once. Intent classification maps this messy language to a small set of actions your organization can handle, such as billing question, technical problem, account access, cancellation, feature request, or general inquiry.
Next, we design the intent categories for BrightDesk using the principles from earlier sections. We write clear definitions, include an option for unclear messages, and decide how to handle messages with multiple intents, either by choosing the primary one or by flagging that more than one applies.
Then we implement the classification. Build the state from the message and relevant metadata, write a focused question, use Choice to get a typed answer, and capture the confidence so that uncertain messages can be reviewed. We discuss handling very short, very long, or non-English messages, and removing noise such as signatures and quoted replies.
We also show how to test the classifier on labeled examples. After this lecture you will be able to build an intent classifier that is accurate, auditable, and ready for routing.
Two tickets with the same topic can deserve very different treatment. This lecture explains how to score urgency and business impact so that the most important work is handled first.
We begin by separating the two ideas. Urgency describes how quickly something needs attention, for example because a customer cannot work or a deadline is near. Business impact describes how much it matters to the organization, for example because a large account, a security issue, or a risk to revenue is involved. A ticket can be urgent but low impact, or important but not time critical, and treating them separately gives better decisions.
Next, we design the scoring questions. Using Jev's Score primitive, we define clear scales with descriptions for low, medium, and high, and we write criteria that reflect BrightDesk's priorities. We discuss which information the score should use, such as the message text, customer tier, and product area, and which signals should be handled by deterministic rules instead.
Then we combine the scores into a priority. Simple approaches, such as a matrix or a weighted formula, are easy to explain and adjust. We also discuss testing the scores against examples reviewed by experienced agents.
Finally, we discuss avoiding bias and keeping decisions explainable. After this lecture you will be able to build a prioritization layer that supports fair, consistent triage.
Once a ticket has been understood and scored, it must go somewhere. This lecture covers routing tickets to teams and escalation queues, turning decisions into actions.
We begin with the routing table. Each combination of intent, priority, and special flags maps to a destination, such as billing support, technical support, account security, sales, or a senior escalation team. We show how to express the table in configuration, rather than burying it in code, so that business owners can review it and changes can be made safely.
Next, we discuss escalation. Some tickets should skip the normal queue: those with high urgency and high impact, mentions of legal or safety issues, repeated contacts about the same problem, or messages from key accounts. We design rules that combine model decisions with deterministic checks, and we make sure that escalation paths are explicit and tested.
Then we address uncertainty. When confidence is low, or when the intent is unclear, the ticket should go to a triage queue staffed by people rather than being forced into a team. We implement this using the confidence policies from earlier sections.
We also discuss assignment details, such as load balancing and service-level timers, and recording the reasoning for each routing decision. After this lecture you will be able to build routing logic that is transparent, auditable, and safe.
A decision system is much easier to trust when people can see what it is doing. This lecture shows how to build a Python-based support decision dashboard for BrightDesk.
We begin with the purpose. A dashboard lets supervisors and engineers see incoming tickets, the decisions made for each, the confidence levels, the routing outcomes, and the volume of items sent for review. It makes problems visible, such as a category that is suddenly misrouted or a queue that is overloaded, and it supports conversations about thresholds and quality.
Next, we outline the design. Decide which questions the dashboard must answer: how many tickets arrived, how they were categorized, how many were automated versus reviewed, how long each stage took, and where errors were found. We discuss choosing a simple Python approach, using data frames, charts, and a lightweight interface, without requiring complex infrastructure.
Then we build it. Load the decision logs, compute summary tables, and create charts for category distribution, confidence histograms, urgency by team, and the review rate over time. We add a detail view that shows the input, the decisions, and the final routing for individual tickets.
We also discuss privacy: show only the information that viewers need, and mask sensitive details. After this lecture you will be able to create a dashboard that makes your decision system observable.
In this hands-on lab you will automate BrightDesk support triage, combining the intent, urgency, impact, routing, and dashboard pieces from this section into a working system.
You will begin with a set of synthetic support tickets that vary in topic, tone, and urgency. Build a function that takes a ticket, sends a combined request to Jev to classify intent and score urgency and business impact, and returns a structured decision with confidence values.
Next, you will implement the routing logic. Create a configuration for the routing table and escalation rules, and combine it with confidence thresholds so that uncertain tickets go to a human triage queue. Add deterministic checks for conditions that must always escalate, such as mentions of security incidents.
Then you will process the full set of tickets, logging every input, decision, confidence, and routing outcome in a structured file. Compare the results with labels you prepared in advance, calculate accuracy for each decision, and examine the misrouted tickets to understand why they failed.
Finally, you will build the dashboard to summarize the run, including the share of automated decisions, the review queue size, and the distribution across teams. Write a short note describing what you would change before using such a system with real customers. By the end of this lab you will have an end-to-end triage prototype.
As AI applications mature, sending every request to the same model becomes wasteful. This lecture explains why applications need model routing and how it improves cost, speed, and quality.
We begin with the problem. A large, capable model can handle difficult tasks but costs more and responds more slowly. A smaller model may be quick and inexpensive and perfectly adequate for simple tasks, such as short questions, formatting, or classification. Using the largest model for everything is like sending every package by the most expensive courier.
Next, we introduce model routing: a decision layer that examines each request and chooses the model best suited to it. We describe the benefits, including lower cost, reduced latency, better use of rate limits, and the ability to reserve powerful models for the tasks that need them. We also discuss the risks, such as misrouting a hard task to a weak model and producing poor answers.
Then we outline the elements of a routing system: a way to assess the task, a set of available models with known properties, a policy that maps assessments to choices, and fallbacks when something fails. We explain how Jev fits as the fast decision component.
Finally, we preview the section's project. After this lecture you will understand the motivation for routing and the design questions you will answer in the lectures ahead.
Effective routing depends on knowing what each available model can do. This lecture covers model capabilities, costs, and latency, and how to compare them in a practical way.
We begin with capabilities. Models differ in how well they handle reasoning, long documents, code, specialized domains, languages, and strict output formats. Rather than relying on reputation, you should describe capabilities in terms of the tasks that matter to your application and verify them with your own tests.
Next, we discuss cost. Providers typically charge according to the amount of text processed, with different prices for input and output, and the price can vary significantly between models. You will learn to estimate the cost of a typical request, multiply it by expected volume, and see how routing even a portion of traffic to a cheaper model changes the total.
Then we examine latency, the time taken to respond. Larger models are often slower, and long outputs take longer still. Latency matters for interactive applications, where users notice delays, and for pipelines with many sequential calls. We discuss measuring latency at different percentiles, not only the average.
Finally, we build a simple model catalog that records these properties, along with limits such as context length and rate limits. After this lecture you will be able to compare models objectively and prepare the inputs for routing policies.
Deciding which model should handle a request begins with understanding how hard the request is. This lecture shows how to use Jev to classify task complexity.
We begin with defining complexity. A simple task might be answering a factual question from a short passage, extracting a field, or reformatting text. A moderate task might require summarizing a document or following a multi-step instruction. A complex task might involve careful reasoning, long context, ambiguous requirements, or high stakes. We discuss how to describe these levels with clear criteria suited to your application.
Next, we implement the classification. Using Choice or Score, ask Jev to rate the complexity of a request, providing the user's message and any relevant context, such as the type of application or the presence of attachments. We write the question so that it focuses on difficulty rather than on answering the request itself, and we discuss including additional signals, such as the need for current information or the risk of the task.
Then we test the classifier. Label a set of requests by complexity, compare the results, and examine cases where the system underestimated difficulty, since those are the most costly. We also look at how confidence can send borderline cases to the safer, more capable option.
After this lecture you will be able to build a complexity classifier that drives routing decisions.
With a complexity assessment in hand, you can route each request to an appropriate model. This lecture explains how to send requests to small and large language models.
We begin with the basic pattern. If a request is simple and the system is confident, send it to a smaller, cheaper, faster model. If it is complex or the system is uncertain, send it to a larger model. We implement this as a function that takes the user's request, obtains the complexity decision, applies the routing rules, and calls the selected model.
Next, we discuss how to make the policy more nuanced. Consider the type of task, as code or reasoning may need stronger models even when short, the sensitivity of the content, the required response format, and the user's service tier. We show how to represent these rules in configuration and how to keep a record of which model handled each request and why.
Then we talk about quality control. Compare the answers from small and large models on a sample of requests to see where the smaller model is adequate, and where it fails. Use those findings to adjust the thresholds and rules. We also discuss monitoring user feedback and escalating when a small model's answer appears poor.
After this lecture you will be able to implement routing between models and evaluate the quality and cost tradeoffs.
A routing system must keep working when things go wrong, and it must respect limits on spending. This lecture covers implementing fallbacks, budgets, and routing policies.
We begin with fallbacks. A model may be unavailable, rate limited, slow, or return an error. The router should retry sensibly, switch to an alternative model, or degrade gracefully with a clear message, rather than failing silently or looping endlessly. We discuss timeouts, retry limits, and avoiding duplicate side effects.
Next, we cover budgets. Set limits on spending per request, per user, per day, or per application, and design behavior for when limits are approached: prefer cheaper models, shorten responses, queue lower priority work, or require approval for expensive calls. You will learn to estimate cost before making a call and to track actual spending afterward.
Then we discuss writing routing policies. A policy brings together complexity, task type, confidence, cost, latency targets, and fallback rules in a form that people can read and review. We suggest keeping the policy in configuration, versioning it, and testing it with simulated traffic.
We also cover logging and alerting so that unusual patterns, such as a sudden shift toward expensive models, are noticed. After this lecture you will be able to create a resilient, budget-aware routing layer.
In this hands-on lab you will build a cost-aware AI model router, bringing together the complexity classification, routing, and policy ideas from this section.
You will begin by creating a small model catalog with at least two models, noting their relative cost, speed, and strengths. If you use real services, keep usage small and watch your spending. Prepare a set of sample requests that range from simple lookups to complex, multi-step tasks.
Next, you will build the complexity classifier with Jev and connect it to a routing function. The function should choose a model according to a policy that considers complexity, confidence, and task type, call the selected model, and return the answer along with the decision details. Add a fallback so that failure of one model sends the request to another.
Then you will add budget controls. Track the estimated cost of each request, apply a daily limit, and change the routing behavior as the limit approaches. Log each request, the chosen model, the reason, the latency, and the cost.
Finally, you will evaluate. Compare the router against two baselines: always using the small model and always using the large model. Measure cost, latency, and answer quality on your sample set, and write a short summary of the tradeoffs. By the end of this lab you will have a working router and evidence of its value.
Agents are applications in which a language model decides which actions to take, and LangChain is one of the most popular frameworks for building them. This lecture introduces LangChain agent architecture so that you can see where Jev decisions fit.
We begin with the basic idea of an agent. A model receives a goal, reasons about it, chooses from a set of tools, such as search, a database query, or an email function, observes the results, and repeats until it finishes. This loop gives agents flexibility, but it also raises concerns about cost, reliability, and safety, since the model controls what happens.
Next, we describe the main components in LangChain. Models provide the reasoning, tools provide capabilities, prompts and messages carry instructions and history, and the agent loop coordinates the process. We explain the concept of middleware, which lets you intercept and modify what happens before or after model calls and tool calls.
Then we discuss where structured decisions help. A classifier can decide which model to use, whether a tool call is allowed, whether a message contains an injection attempt, or when to ask for human approval. Because these decisions are typed and fast, they can be inserted into the loop without redesigning it.
After this lecture you will understand the agent architecture and the points at which Jev can add control.
Jev provides an integration that lets it act as a classifier inside LangChain applications, and this lecture explains the TypeSafeClassifier integration. The aim is to show how a decision component becomes a normal part of a LangChain workflow.
We begin with what the integration offers. It wraps Jev's decision capability in an interface that LangChain components can call, so you can use it wherever your workflow needs a classification, a score, or a yes-or-no judgment. This reduces the glue code you would otherwise write and keeps the typed outputs intact.
Next, we walk through setting it up. Install the required packages, provide credentials through environment variables, create the classifier with the question and options, and call it with the relevant state. We examine the structure of the results and show how to access the decision and its confidence.
Then we discuss how it behaves in practice. We cover handling errors and timeouts, logging decisions, and keeping questions versioned. We also consider how the integration differs from using the SDK directly, and when each is appropriate.
Finally, we run a small example, classifying a message inside a simple chain and using the result to choose the next step. After this lecture you will be able to add a Jev-powered classifier to a LangChain workflow.
Once the classifier is available in LangChain, the next step is to use its decisions to shape the workflow. This lecture shows how to connect Jev decisions to LangChain workflows.
We begin with simple patterns. A decision can select which prompt or model to use, decide whether a request should be answered or declined, or choose between tools. We implement a branching chain in which a Jev decision directs the flow, and we show how to represent the decision and the reasons in the state that passes between steps.
Next, we discuss using several decisions together. For instance, one decision might classify the type of request, another might score its risk, and a third might determine whether sensitive data is present. Combine them in code to select the appropriate path, and make sure the logic for combining them is explicit and testable.
Then we examine passing decisions to an agent. Provide the decision results as context, restrict the tools available according to the classification, and add instructions that reflect the decision. We also cover recording decisions in logs or traces so that you can audit how an agent arrived at its behavior.
Finally, we discuss common pitfalls, such as overcomplicating the chain. After this lecture you will be able to build LangChain workflows that incorporate Jev decisions clearly and reliably.
Middleware allows you to intercept an agent's behavior at key points, and this lecture explores the model router and auto mode middleware. These tools let decisions shape which model is used and how the agent proceeds without rewriting the agent itself.
We begin with the idea of middleware. A middleware component runs before or after the model is called, or around tool calls, and it can inspect, modify, or block what is happening. This is a clean place to apply policies because the agent logic remains unchanged.
Next, we describe the model router middleware. It examines the request, uses a decision component to estimate complexity or type, and selects the model to use for that step. You will see how to configure the available models, the policy for choosing among them, and the fallback behavior when something fails. We link this to the router you built earlier.
Then we discuss auto mode, which allows the system to decide, within limits you define, how much autonomy to grant. We show how decisions can determine when the agent may proceed automatically and when it should pause for confirmation.
We also cover configuration, testing, and observability, and the importance of limiting the scope of automated choices. After this lecture you will understand how to apply middleware to control model selection and agent behavior.
Agents and routers need testing like any other software, and this lecture shows how to test routing decisions and agent fallbacks. Because model behavior is variable, testing requires careful design.
We begin with unit tests for the deterministic parts: the routing table, the policy logic, the budget checks, and the handling of errors. These can be tested thoroughly with mocked decisions, which makes them fast and repeatable. We show how to replace the decision component with a stub that returns known results, so that you can verify what the system does in each case.
Next, we discuss evaluating the decision components themselves. Use a labeled set of requests to measure how often the router chooses the expected model, and review cases of underestimation, in which a hard request went to a weak model. We also measure the end-to-end effect on cost, latency, and answer quality.
Then we cover fallbacks. Simulate failures by making the primary model time out, return an error, or hit a rate limit, and verify that the agent recovers as designed, without repeating actions that have side effects. Test low-confidence situations to confirm that the system asks for help.
We also discuss logging and regression suites. After this lecture you will be able to build a testing strategy that gives you confidence in your routing and fallback behavior.
In this hands-on lab you will create a Jev-enhanced LangChain agent, combining the integration, middleware, and testing concepts from this section.
You will begin by setting up a basic LangChain agent with a few simple tools, such as a knowledge lookup and a function that creates a support ticket. Confirm that it works without any decision components and note its behavior on several sample requests.
Next, you will add the TypeSafeClassifier integration and use it to make decisions inside the workflow. Start with a classifier that determines the request type and use it to choose a prompt or restrict the available tools. Then add a complexity decision and connect it to model routing through middleware, with a fallback model for failures.
Then you will add a confidence policy. When a decision is uncertain, the agent should ask for clarification or hand the case to a person, rather than proceeding. Log each decision, the chosen model, the tools used, and the reasons.
After that, you will test the agent. Use mocked decisions to test the routing logic, run a labeled set of requests to measure routing accuracy, and simulate model failures to verify fallbacks. Compare cost and latency with a baseline agent that always uses the large model.
Finally, you will summarize the results and limitations. By the end of this lab you will have an agent whose behavior is guided by explicit, testable decisions.
LangGraph is a framework for building agent workflows as graphs, and this lecture introduces its core ideas: states, nodes, and edges. Understanding them prepares you to place Jev decisions inside structured, controllable workflows.
We begin with the state. In LangGraph, a shared state object carries information through the workflow, such as the user's message, intermediate results, decisions, and the final answer. You will learn how to define the state with clear fields and types, and why keeping it explicit makes workflows easier to understand and debug.
Next, we cover nodes. Each node is a function that receives the state, performs some work, such as calling a model, running a tool, or making a decision, and returns updates to the state. We show how to keep nodes small and focused, so that each can be tested on its own.
Then we discuss edges. Edges define the order in which nodes run. Simple edges connect one node to the next, while conditional edges choose the next node based on the state. This is how branching, loops, and early exits are expressed.
We also introduce how a graph is compiled and run, and how to inspect the path taken. After this lecture you will be able to describe a workflow as a graph and implement a simple one in LangGraph.
Graphs make it easy to place decisions exactly where they are needed. This lecture shows how to integrate Jev into graph-based workflows.
We begin with the pattern. A decision node reads the relevant part of the state, sends a question to Jev, and writes the typed result back into the state, including the confidence. Subsequent edges read that result to choose the next node. Because the decision is a separate node, you can test it independently, replace it, or add logging without changing the rest of the graph.
Next, we build an example. Create a graph for BrightDesk that receives a message, classifies its intent, scores its risk, and then moves to the appropriate handling node. We show how to define the state fields for decisions, how to write the node function, and how to handle errors and timeouts so that a failure leads to a safe path.
Then we discuss design guidance. Keep decision nodes narrow and well named, pass only the information needed, record the question version used, and store results in a form that supports auditing. We also explain how to make decisions visible in traces so that you can see why the graph took a given route.
After this lecture you will be able to add decision nodes to graphs and use their outputs to control workflow.
Branching is where decisions turn into action. This lecture covers creating conditional decision branches in LangGraph, so that workflows follow different paths based on typed results.
We begin with conditional edges. A routing function inspects the state and returns the name of the next node. We show how to write these functions so that they depend on the decision outputs, such as category, score, or probability, and how to keep them simple, deterministic, and easy to test.
Next, we design a branching structure for BrightDesk. After classifying a ticket, the graph might route billing questions to one handler, technical issues to another, security concerns to a priority path, and uncertain cases to a review branch. We discuss how to include a default branch so that unexpected values never cause the workflow to crash or stall.
Then we address combining several signals. For example, a branch may depend on both the category and the confidence, or on a risk score above a limit. We show how to express these rules clearly, and how to test every branch with synthetic states.
We also discuss visualizing the graph to communicate the logic to colleagues and checking for unreachable nodes. After this lecture you will be able to design and implement conditional branches driven by decisions.
Some decisions should never be made by a machine alone. This lecture shows how to add human-in-the-loop approval nodes to your workflows, so that people remain in control where it matters.
We begin with when to involve a human. Examples include actions that spend money, change customer data, send external communications, or carry legal or safety consequences, and cases where the model's confidence is low. We discuss defining these triggers in policy, rather than leaving them to chance.
Next, we explain how approval works in a graph. The workflow reaches an approval node, pauses and saves its state, presents the proposed action and relevant information to a reviewer, and resumes when a decision is received. We show how checkpoints and persistence allow a workflow to wait without holding resources, and how to implement approve, reject, and edit outcomes.
Then we discuss designing a good review experience. Reviewers should see what the system wants to do, why it wants to do it, what the decision confidence was, and what will happen after they respond. We also cover time limits, escalation when nobody responds, and recording who approved what.
Finally, we explain using review outcomes as feedback. After this lecture you will be able to add approval steps that make workflows safer and more accountable.
A reliable workflow expects failures and plans for them. This lecture covers designing reliable agent workflows with retry and fallback paths.
We begin with the kinds of failure that occur: network errors, rate limits, timeouts, malformed outputs, tool failures, and decisions that are uncertain or inconsistent. Treating these as normal events, not rare surprises, changes how you design a workflow.
Next, we discuss retries. A retry can resolve temporary problems, but retrying blindly can cause delays, cost, or duplicate actions. We introduce limits on attempts, delays that increase between attempts, and the importance of idempotency, which means that repeating an action does not change the result. Actions with side effects, such as sending an email or issuing a refund, need special care.
Then we cover fallback paths. When a step cannot succeed, the graph should move to an alternative: a simpler method, a different model, a default decision, or a human review queue. We show how to represent these in the graph, how to record why a fallback occurred, and how to keep the user informed.
We also discuss timeouts, circuit breakers, and testing failure scenarios deliberately. After this lecture you will be able to design workflows that degrade gracefully and remain trustworthy under stress.
In this hands-on lab you will build a Jev-powered LangGraph workflow, combining states, decision nodes, conditional branches, human approval, and reliability features from this section.
You will begin by defining the state for a BrightDesk workflow, including the incoming message, the decisions made, confidence values, the proposed action, approval status, and an error log. Create the graph skeleton with nodes for receiving a message, classifying intent, scoring risk, handling each category, and finishing.
Next, you will add the Jev decision nodes. Implement the intent and risk decisions, store their results in the state, and handle errors by routing to a safe path. Then create conditional edges that send routine requests to automated handling, risky actions to an approval node, and uncertain cases to a review path.
Then you will implement the human approval node. Pause the workflow when approval is required, present the proposal, and resume with the reviewer's decision. Add retry logic for transient failures and fallback paths for persistent ones, and make sure that no action with side effects can happen twice.
Finally, you will test every branch with synthetic inputs and mocked decisions, inspect the paths taken, and examine the logs. Write a short description of the workflow for a colleague. By the end of this lab you will have a robust, auditable decision workflow.
Agents become powerful when they can call tools, and risky for the same reason. This lecture explains tool calls and agent permissions, laying the groundwork for safe agent design.
We begin with what a tool call is. A model chooses a function to run, such as searching a database, sending a message, updating a record, or deleting a file, and provides arguments for it. The application executes the function and returns the result. The model's choice may be influenced by user input, retrieved documents, or earlier results, which means that the model can be manipulated or can simply make mistakes.
Next, we discuss permissions. Every tool should have a defined scope: who may use it, on what data, with what limits, and under which conditions. We introduce the principle of least privilege, giving an agent only the tools and access it needs for the task at hand, and the importance of enforcing permissions in code rather than in prompts.
Then we examine how tool risk varies. Reading public information is very different from transferring money or deleting records. We describe categorizing tools by their potential impact, and noting the context, such as which user is acting and what data is involved.
After this lecture you will understand where agents can go wrong and be ready to design safeguards around tool use.
Not all actions are equal, and a safe system needs a way to recognize the dangerous ones. This lecture covers identifying risky, destructive, and irreversible actions.
We begin with definitions. Risky actions are those that could cause harm if wrong, such as sharing confidential data or changing access rights. Destructive actions remove or overwrite something, such as deleting records or dropping a database table. Irreversible actions cannot be undone, such as sending an email, making a payment, or publishing content. These categories overlap, and the most concerning actions are often all three.
Next, we discuss how to analyze a tool. Consider what it changes, how widely, how reversible it is, who is affected, and what could go wrong if it is called with the wrong arguments or at the wrong time. We create a simple risk classification for the tools in BrightDesk, from read-only lookups to refunds and account closures.
Then we show how Jev can help. A decision can assess a proposed call, including its arguments and context, and flag whether it appears risky or unusual, for example a bulk deletion or a refund far larger than normal. We stress that such signals supplement, and do not replace, deterministic rules.
After this lecture you will be able to catalog tool risks and use decisions to highlight dangerous calls.
Once risks are identified, you need clear rules for what to do about them. This lecture covers designing allow, review, confirm, and deny policies for tool calls.
We begin with the four outcomes. Allow means the call proceeds automatically. Review means the call is held for a person to examine before execution. Confirm means the user who requested the action must explicitly approve it, often after seeing exactly what will happen. Deny means the call is blocked. We explain when each is appropriate, using the tool's risk, the arguments, the user's role, and the context.
Next, we design a policy for BrightDesk. Reading a knowledge article may always be allowed, creating a ticket may be allowed with logging, issuing a small refund may require confirmation, large refunds may require review, and deleting customer data may be denied unless a specific approval process is followed. We discuss writing these rules as configuration that can be reviewed by security and business stakeholders.
Then we cover how decisions feed the policy. A risk signal can move a call from allow to review, but it should not be able to move a call from deny to allow.
We also discuss clear messages to users when a call is blocked. After this lecture you will be able to create policies that balance usefulness and safety.
A model's judgment about risk is valuable, but it must never be the only safeguard. This lecture shows how to combine Jev risk signals with deterministic authorization.
We begin with the division of responsibility. Deterministic authorization is code that checks facts: whether the user has permission, whether the amount is within limits, whether the resource belongs to the right customer, and whether required approvals exist. It is predictable and cannot be talked out of its rules. Jev risk signals add flexible judgment about things that are hard to codify, such as whether a request looks suspicious or whether the arguments seem inconsistent with the stated purpose.
Next, we design the combined flow. First apply the hard rules, which can deny or restrict a call outright. Then, for calls that pass, obtain risk signals and apply the policy: allow, review, confirm, or deny. The model's output can add caution, but it cannot grant permissions that the rules withhold.
Then we discuss handling disagreements and failures. If the decision service is unavailable, the system should fall back to a conservative path, and if the signal conflicts with the rules, the stricter outcome applies.
We illustrate with examples such as refunds, data exports, and account changes. After this lecture you will be able to build layered defenses in which model judgment strengthens, and never replaces, authorization.
Safety controls are only credible if you can see and verify what they do. This lecture covers logging, auditing, and testing agent tool decisions.
We begin with logging. Record every proposed tool call, its arguments, the context, the risk signals and their confidence, the policy outcome, who approved or denied it, and what finally happened. Good logs allow you to reconstruct events after an incident, answer questions from auditors, and find patterns of misuse or error. We discuss structuring logs consistently, protecting sensitive data within them, and retaining them appropriately.
Next, we discuss auditing. Review samples of decisions regularly, including those that were allowed automatically, to look for missed risks and unnecessary blocks. Track metrics such as the rate of reviews, confirmations, and denials, and how often reviewers overrule the system.
Then we turn to testing. Build a suite of scenarios that includes safe calls, risky calls, destructive calls, manipulated arguments, and attempts to exceed permissions, and verify the outcome for each. Run it whenever policies, questions, or models change, so that regressions are caught early.
We also discuss red-teaming, in which people deliberately try to bypass the gate. After this lecture you will be able to make your tool safety measures observable and testable.
In this hands-on lab you will build an AI agent tool-call safety gate, bringing together the permission, risk, policy, and auditing concepts from this section.
You will begin by defining a set of tools for a BrightDesk agent, such as looking up an order, creating a ticket, issuing a refund, updating an address, and deleting a customer record. For each, record its risk level, whether it is reversible, and its permission requirements.
Next, you will implement the gate as a function that sits between the agent and the tools. It first applies deterministic authorization, then asks Jev to assess the risk of the proposed call using its arguments and the conversation context, and finally applies an allow, review, confirm, or deny policy defined in configuration. Add a confirmation step that shows the user exactly what will happen.
Then you will create a test suite of scenarios, including normal calls, unusually large refunds, bulk operations, calls with suspicious arguments, and requests for tools the user may not use. Run them, compare the outcomes with your expectations, and record how often the gate was too strict or too lenient.
Finally, you will add structured logging and a summary of decisions. By the end of this lab you will have a working safety gate and a method for testing it.
This course contains the use of artificial intelligence.
What if your AI application could do more than generate answers? What if it could decide which model should handle a task, whether a tool call is safe, and when a human needs to step in?
Welcome to Jev Fundamentals: Decision AI for Beginners, a hands-on introduction to Decision AI, AI agents, and intelligent automation. You'll explore how Jev by TypeSafe supports structured decisions inside real-world software, and learn to combine those decisions with clear business rules, confidence thresholds, and human oversight.
Rather than watching disconnected demos, you'll build an evolving case study called BrightDesk DecisionOps. Starting with a simple customer-support classifier, you'll progress toward an AI decision engine that can route requests, evaluate risk, check evidence, and support safer agent workflows.
What You'll Build and Learn
You'll begin with Python, the Jev API, and core decision concepts such as classification, scoring, and probability-based decisions. Then you'll learn how to design useful decision questions, interpret model outputs, set confidence thresholds, and handle uncertain results without treating every prediction as fact.
Next, you'll explore LLM routing and AI model selection. Build workflows that choose between smaller and larger large language models (LLMs) based on task type, cost, and complexity. Integrate decision logic into LangChain and LangGraph, using structured application state, conditional branches, and human-in-the-loop approvals.
You'll also tackle a critical challenge in agentic AI: deciding when an agent should be allowed to act. Build tool-call gating and AI guardrails that flag risky actions while enforcing permissions through deterministic code. Investigate prompt injection detection, AI safety, hallucination detection, citation verification, and retrieval-augmented generation (RAG) evidence checks.
How do you know whether a decision model is actually improving your system? You'll create an AI benchmarking workflow that compares Jev with LLM classifiers and rule-based baselines, measuring accuracy, precision, recall, F1 score, latency, and inference cost. You'll learn why evaluation datasets, false positives, and confidence calibration matter more than flashy performance claims.
Finally, we'll cover production AI engineering: model version pinning, API integration, fallback strategies, observability, audit logging, enterprise data security, privacy, and AI governance. Your capstone brings these skills together in a practical, reviewable Decision AI application.
Who Should Take This Course?
This course is designed for beginners, Python developers, AI engineers, software architects, automation builders, and professionals exploring generative AI or enterprise agent systems. Basic Python familiarity helps; prior Jev experience isn't required.
Most examples use approachable code and synthetic business data. Optional local models can support comparisons, while live Jev exercises require access to TypeSafe's service. Because frameworks evolve, you'll also learn patterns that remain useful when SDKs and APIs change.
You will leave with reusable project ideas for customer support automation, enterprise copilots, document review, and intelligent workflow orchestration. Whether you want to improve existing AI agents or prototype new applications, this course gives you a foundation.
By the end, you won't just know the terminology. You'll have hands-on experience building AI systems that can route intelligently, verify evidence, measure performance, and escalate uncertainty—instead of blindly trusting every model response.