
Building Smarter AI Decisions with Python
By the end of this course, you'll be able to:
Implement structured AI decisions using Python.
Understand Predicate, Choice, and Score decision types.
Evaluate AI-generated decisions and apply validation rules.
Build a practical agent-routing demonstration.
Apply these concepts to real-world AI automation workflows
What You'll Learn
Understand the difference between conversational AI and structured AI decision-making.
Learn what bounded decisions are and why predefined answers matter.
Explore the architecture of an AI-powered decision workflow.
Understand why AI recommendations must be validated before executing business actions.
Discover how authorization checks, confidence thresholds, and human review improve workflow reliability.
Learn the fundamentals of the OpenAI Decisions API, including evidence, named questions, and typed responses.
Understand how GPT-6 Luna fits into the Decisions API examples covered in this course
Learn OpenAI Decisions API with Python: Predicate, Choice, Score, confidence thresholds, structured AI decisions, and intelligent agent routing for Agentic AI applications.
In this lecture, you'll learn how to use the Predicate decision type in the OpenAI Decisions API to evaluate whether a specific condition is likely to be true or false.
Unlike traditional chatbots that generate text responses, Predicate returns a structured probability representing how strongly the model believes a condition is true based on the provided evidence.
Using a real-world customer support example, we'll explore how Predicate can help identify active service outages, detect urgent situations, and support automated decision-making.
What You'll Learn
Understand what a Predicate decision is and when to use it.
Learn how Predicate evaluates conditions using evidence and instructions.
Interpret probability values between 0 and 1.
Understand the difference between probability and a guaranteed true-or-false result.
Implement a Predicate decision using Python and the OpenAI Decisions API.
Apply probability thresholds and business rules to determine the next action.
We'll evaluate a customer message such as:
“Our checkout system is down worldwide, and customers cannot place orders.”
The Predicate decision will estimate the likelihood that the message describes an active widespread outage.
By the end of this lecture, you'll be able to build and interpret Predicate-based decisions in Python and understand how they can support customer service automation, incident detection, and Agentic AI workflows.
In this lecture, you'll learn how to use the Choice decision type in the OpenAI Decisions API to select the most appropriate option from a predefined list of choices.
Unlike traditional chatbots that generate free-form responses, Choice produces a structured decision that Python applications can easily interpret, validate, and integrate into automated workflows.
Using a practical customer support example, we'll demonstrate how the Decisions API can classify customer messages and identify the appropriate support department.
What You'll Learn
Understand what the Choice decision type is and when to use it.
Define a list of valid choices using Python.
Send customer messages to the OpenAI Decisions API for classification.
Interpret the selected choice, confidence value, and probability distribution.
Understand how to handle ambiguous classifications and low-confidence results.
Apply Choice decisions to customer support routing and Agentic AI applications.
We'll classify a customer message such as:
“I was charged twice for my monthly subscription.”
The API will evaluate predefined options such as Billing, Technical Support, Sales, and General Support, then select the most appropriate department.
We'll also explore how the probability distribution helps us understand alternative choices and why application-level validation is important before automating routing.
By the end of this lecture, you'll be able to implement Choice-based decisions using Python and apply them to real-world classification, ticket routing, and intelligent agent selection workflows.
In this lecture, you'll learn how to use the Score decision type in the OpenAI Decisions API to evaluate business impact, incident severity, and priority using predefined, ordered scoring levels.
Unlike Predicate, which estimates whether a condition is true, or Choice, which selects from a list of options, Score evaluates evidence against an ordered rubric and returns a numerical score along with a probability distribution.
Using a real-world customer support scenario, we'll demonstrate how to assess the severity of incidents using Python and GPT-6 Luna.
What You'll Learn
Understand what the Score decision type is and when to use it.
Define ordered severity levels such as Low, Moderate, High, and Critical.
Create scoring questions with clear instructions and evaluation criteria.
Implement Score decisions using Python and the OpenAI Decisions API.
Interpret numerical scores, confidence values, and probability distributions.
Understand how probability-weighted scores are calculated.
Apply business rules and confidence thresholds before triggering automated actions.
Explore practical applications in incident management, customer support, and Agentic AI workflows.
We'll evaluate a customer incident such as:
“Our checkout system is down worldwide, and customers cannot place orders.”
The Decisions API will assess the incident using four severity levels:
Low (0): Minor or cosmetic issues.
Moderate (1): Issues affecting a limited number of users.
High (2): Major functionality is affected.
Critical (3): Widespread outages causing significant business disruption.
We'll examine how the API assigns probabilities to these levels and calculates a final business impact score.
In this lecture, you'll learn how to combine multiple decision types in a single OpenAI Decisions API request using Python and GPT-6 Luna.
Instead of making separate API calls for every decision, we'll explore how to evaluate multiple questions together using Predicate, Choice, and Score.
Through practical customer support examples, you'll see how a single request can classify customer messages, detect potential service outages, and assess business impact.
What You'll Learn
Understand how to ask multiple questions in a single Decisions API request.
Combine Predicate, Choice, and Score decision types.
Define multiple named questions using Python.
Process multiple customer messages using a Python loop.
Interpret structured answers, confidence values, probability distributions, and scores.
Understand the difference between multiple decisions and multiple API calls.
Apply multiple decision types to real-world business automation scenarios.
Practical Example
We'll process customer messages such as:
"I was charged twice."
"Checkout is down for all customers."
"Tell me about enterprise plans."
For each message, the Decisions API will answer three questions:
Which support team should handle the request?
Does the message describe an active widespread outage?
What is the business impact score?
We'll examine how the same decision questions produce different results depending on the customer message.
By the end of this lecture, you'll be able to combine multiple decision types in one API request and use the structured results to support intelligent customer service workflows and Agentic AI applications.
In this lecture, you'll learn how to use the OpenAI Decisions API as an intelligent agent router in multi-agent AI systems.
When an application has multiple specialist agents, selecting the appropriate agent for a user request becomes an important part of the orchestration process.
We'll demonstrate how to use the Choice decision type to select the most suitable agent from a predefined list, while keeping execution and business rules under application control.
What You'll Learn
Understand the role of agent selection in Agentic AI systems.
Use the Choice decision type to route tasks to specialist AI agents.
Define an approved list of available agents using Python.
Dynamically generate decision choices from available agents.
Interpret the selected agent, confidence value, and probability distribution.
Validate AI routing decisions against an approved agent list.
Implement confidence thresholds and manual-review fallback logic.
Understand the difference between agent selection and agent execution.
Practical Example
We'll use the following user request:
“Summarize the main changes between these two contract drafts.”
Our multi-agent system contains four specialist agents:
Document Agent: Document analysis, summarization, and comparison.
Research Agent: Information gathering and research.
Email Agent: Email drafting and communication.
Spreadsheet Agent: Spreadsheet processing and data analysis.
The Decisions API will evaluate the request and select the most appropriate specialist.
Offline Evaluation Using Python
In this lesson, we demonstrate how to evaluate AI model performance offline using Python and a predefined dataset. We compare predicted results against actual outcomes to measure accuracy, coverage, and the impact of different confidence thresholds. By adjusting these thresholds, we can analyze the trade-off between prediction reliability and the number of requests handled automatically. This approach helps identify an appropriate confidence threshold before deploying an AI-powered decision system into production.
In this example, we estimate the input token cost of processing 100,000 API requests, with each request consuming 400 tokens. This results in 40 million input tokens. Assuming 25% of tokens are cached, we calculate the cost separately for regular and cached tokens using their respective pricing rates. Based on our assumed pricing, the total estimated cost is $3.10. This demonstrates how prompt caching can help reduce API costs at scale.
Agentic AI applications often involve multiple specialized agents, tools, workflows, and orchestration components. One of the key challenges is deciding which agent should handle a task, whether an action requires escalation, and how to evaluate the importance or urgency of a request.
We'll explore how the Decisions API can act as a structured decision-making component within an Agentic AI workflow, while the orchestrator remains responsible for planning, coordination, execution, and managing the overall process.
In this lecture, we will explore the official OpenAI Decisions API documentation and understand how to use it as a reference when building structured AI decision-making applications with Python.
We will walk through the API's core concepts, supported decision types, request and response structures, and practical examples.
What You'll Learn:
How to navigate the official OpenAI Decisions API documentation.
Understand the POST /v1/decisions endpoint and GPT-6 Luna model.
Explore the three decision types: Predicate, Choice, and Score.
Understand request parameters, input data, and decision questions.
Interpret structured responses, probabilities, scores, and confidence values.
Learn how multiple questions can be evaluated in a single API request.
Discover how the Decisions API fits into Agentic AI architectures and intelligent agent routing.
Understand the difference between AI-generated decisions and application-controlled execution.
Official Documentation:
https://developers.openai.com/api/docs/guides/decisions
Congratulations on completing the OpenAI Decisions API Masterclass!
Final Takeaway
The OpenAI Decisions API helps applications make structured AI-powered decisions, while your application remains responsible for validating those decisions and controlling actions.
Thank you for taking this course!
Learn how to build intelligent, structured AI decision-making applications using the OpenAI Decisions API, GPT-6 Luna, and Python.
Not every AI application needs to generate lengthy text responses. Sometimes, businesses simply need to make accurate, structured decisions.
For example:
Which support team should handle a customer request?
Is a customer reporting an active service outage?
How serious is a business incident?
Which AI agent should handle a particular task?
When should an automated workflow require human review?
In this hands-on course, you'll discover how the OpenAI Decisions API can help solve these challenges using structured decision-making instead of traditional free-form LLM responses.
You'll learn the three core decision types—Predicate, Choice, and Score—and implement them using Python and practical examples.
We'll start with the fundamentals, explore API requests and structured JSON responses, and gradually move toward real-world applications such as customer support classification, incident severity assessment, confidence-based decision validation, and intelligent AI agent routing.
By the end of the course, you'll understand how to integrate AI-powered decisions into Agentic AI applications while keeping business rules, authorization, and workflow execution under application control.
What You'll Learn
1. OpenAI Decisions API Fundamentals
Understand what the Decisions API is, how it works, and how structured decision-making differs from traditional LLM-generated responses.
2. Predicate — Evaluate Conditions
Learn how to evaluate whether a condition is likely to be true, interpret probabilities, and implement practical use cases such as outage detection.
3. Choice — Classification and Routing
Use predefined options to classify customer messages, select support departments, and make structured routing decisions.
4. Score — Business Impact Assessment
Evaluate incidents using ordered severity levels such as Low, Moderate, High, and Critical. Learn how to interpret numerical scores, confidence values, and probability distributions.
5. Multiple Decisions in a Single API Request
Combine Predicate, Choice, and Score questions in a single request to evaluate multiple aspects of a customer message.
6. Understanding Confidence and Probabilities
Learn how to interpret AI-generated confidence values, evaluate predictions, and understand the relationship between confidence thresholds, automation coverage, and accuracy.
7. Intelligent AI Agent Routing
Build a practical agent-selection demonstration that routes user requests to specialized agents, including Document, Research, Email, and Spreadsheet agents.
8. Decisions API in Agentic AI Architecture
Understand where structured decision-making fits within multi-agent systems and how it can complement orchestration frameworks such as LangGraph and Google ADK.
Hands-On Python Examples
This course includes practical demonstrations covering:
Making Decisions API requests using Python.
Working with structured JSON responses.
Detecting potential service outages.
Classifying customer support tickets.
Calculating business impact scores.
Combining multiple decision questions.
Selecting specialist AI agents.
Evaluating confidence thresholds and selective accuracy.