What are utility-based agents?
Aug 26, 2026
/
By Alma
/
8 min Read
Utility-based agents are AI agents that use a scoring formula called a utility function to compare possible outcomes and choose the action expected to produce the best result.
They’re useful when several actions can reach the same goal but lead to different trade-offs, or when the outcome of an action isn’t certain. The agent observes the current situation, predicts what could happen next, scores those outcomes, and acts on the highest-scoring valid option.
Knowing how that process works makes it easier to see when a utility-based agent is useful, what kinds of decisions it handles well, and where the extra complexity becomes a drawback.
What are utility-based agents?
Utility-based agents are a type of AI agent built around a scoring system that ranks outcomes and selects the strongest option.
Here, utility simply means how desirable an outcome is. A utility function can score travel time, energy use, safety, customer satisfaction, or several factors at once, then combine them into one number the agent can compare.
For example, a route-planning agent has three ways to reach the same destination. One route is fastest, one has cheaper tolls, and one has the most predictable travel time.

All three work, but the utility function allows the agent to choose the combination of trade-offs that best fits its priorities.
Utility scoring doesn’t replace the goal. It gives the agent a way to rank different outcomes or paths that can achieve it.
When the outcome isn’t certain, the agent also considers probability. Say the fastest route has a 40% chance of heavy traffic. Expected utility combines how desirable an outcome is with how likely it is to happen, so the agent may choose a slightly slower route that’s much more reliable.
That means utility-based agents don’t simply choose the option with the best possible outcome – they also consider how likely that outcome is.
Key components of a utility-based agent
You can break a utility-based agent’s decision process into five main parts: a utility function, sensors, an internal model, an action selection mechanism, and actuators.

Utility function
The utility function assigns a score to each possible outcome so the agent can compare its options.
A route planner, for example, might score travel time, toll cost, fuel use, and reliability. Give reliability more weight, and predictable routes become more attractive. Give speed more weight, and faster routes start winning instead.
What you leave out matters too. If fuel cost isn’t part of the function, the agent won’t consider it. If speed carries too much weight, it may keep choosing the fastest route even when a slightly slower one is much cheaper and more reliable.
Sensors
Sensors collect the information the agent needs about its current environment.
A self-driving car gets that information from hardware such as cameras and lidar, a laser-based system that measures distances to nearby objects. A software agent gets its inputs from sources such as APIs, databases, clicks, watch time, or ratings.
Bad input leads to bad decisions. A route planner using yesterday’s traffic data will score its options based on conditions that no longer exist, even if its utility function is otherwise well designed.
Internal model
The internal model tracks what the agent knows about its environment and predicts what could happen after each action.
New sensor data updates that picture. The agent can then compare possibilities such as: if I take action A, this result is likely; if I take action B, there are two possible outcomes with different probabilities.
A route planner’s model might include live traffic, road closures, and current travel-time estimates. That lets it judge what each route looks like now rather than relying on older conditions.
The model doesn’t improve on its own. Unless the system includes a separate learning mechanism, it can update based on new observations but won’t automatically improve the assumptions or rules underlying its predictions.
Action selection mechanism
The action selection mechanism compares the available actions and chooses the best valid option.
It takes the outcomes predicted by the internal model, scores them with the utility function, and accounts for uncertainty. If the system also has hard constraints, it removes any action that breaks those rules before comparing the remaining options.
Suppose a delivery agent finds a route with the highest utility score, but that route passes through a restricted area. If avoiding that area is a hard constraint, the agent removes the route from consideration and chooses the next-best valid option.
The more options the agent has to evaluate, the more work this takes. Comparing five routes is much easier than comparing thousands of possible actions, especially when each action can lead to several different outcomes.
Actuators
Actuators carry out whatever action the agent chooses.
In a self-driving car, they control steering or braking. A software agent might send an API request, update a database, or display a recommendation. A smart thermostat changes the temperature setting.
The result then feeds into the next decision. Sensors collect new data, the agent checks what changed, and the cycle starts again.
Actions don’t always work as expected, so higher-risk systems also need safeguards. Permission checks can block unauthorized actions, failure detection can catch actions that didn’t complete properly, and human approval can be required before an irreversible action proceeds.
How utility-based agents make decisions
Utility-based agents make decisions by repeating four steps: perceive the situation, generate options, score the outcomes, and act on the best one.
- Perceive. Sensors collect fresh data and update the internal model.
- Generate options. The agent identifies the actions it can take and predicts what each one could produce.
- Score the outcomes. The utility function rates each predicted result and accounts for probability when the outcome isn’t certain.
- Pick and act. The agent chooses the valid option with the highest expected utility and executes it.
New sensor data restarts the cycle.
For example, a smart home energy agent checks occupancy, room temperature, electricity prices, and the weather forecast. It then compares options such as lowering the thermostat by two degrees, switching to a timed schedule, or leaving the current setting alone.
Each option gets scored on comfort, cost, and energy use. If electricity prices rise or everyone leaves the house, the next scoring cycle may produce a different choice.

Real-world examples of utility-based agents
Utility-based reasoning can be used in route planning, smart home energy management, recommendation systems, and autonomous vehicles.
- Route planning. A utility-based route planner scores routes based on travel time, tolls, fuel consumption, and reliability rather than accepting any route that reaches the destination. Changing one preference, such as avoiding tolls, can change which route wins.
- Smart home energy management. A utility-based energy manager balances comfort, electricity cost, occupancy, and energy use when adjusting heating, cooling, or appliances. A change in prices or occupancy can trigger a different decision.
- Recommendation systems. A utility-based recommendation system ranks products, videos, or articles by factors such as predicted satisfaction, relevance, and timing. Instead of showing anything that passes a minimum threshold, it can rank the strongest matches first.
- Autonomous vehicles. Utility-based reasoning can help an autonomous vehicle compare maneuvers using factors such as collision risk, legal rules, travel progress, and passenger comfort. When another driver’s behavior is uncertain, the scoring process helps weigh progress against safety.
These AI agent examples show the same decision pattern: a system uses utility-based reasoning by predicting the possible outcomes of its actions, scoring how desirable those outcomes are, and using those scores to choose what to do.
Utility-based agents vs. goal-based agents
A goal-based agent focuses on whether an action will achieve the desired goal: “Will this action get me there?” A utility-based agent goes one step further by comparing the actions that can achieve that goal and choosing the one with the best overall outcome: “Of the actions that get me there, which is best?”

Imagine a navigation agent that needs to reach an airport. Several routes may reach the destination, but they differ in travel time, cost, and reliability. A utility-based agent uses those differences to score the routes and choose the one that best matches its priorities.
Dimension | Goal-based agent | Utility-based agent |
Decision basis | Checks whether an action helps achieve the goal | Scores how desirable each predicted outcome is |
Several ways to reach the goal | Can compare different paths through planning, but the goal itself doesn’t rank successful outcomes | Uses utility scores to rank successful outcomes |
Competing priorities | Needs separate rules or planning logic to balance factors such as cost, speed, and safety | Combines those factors in the utility function and compares them in one score |
Uncertain outcomes | Can plan toward the goal, but doesn’t inherently compare options by both likelihood and desirability | Uses expected utility to weigh how good an outcome is against how likely it is |
Design complexity | Simpler when success is mainly about reaching a clear end state | More complex because the agent has to predict, score, and compare possible outcomes |
Use a goal-based agent when reaching the goal is the primary requirement, and the differences between successful outcomes don’t matter much.
Use a utility-based agent when several outcomes can achieve the goal, but factors such as cost, risk, speed, or reliability determine which one is preferable.
Benefits of utility-based agents
The main benefit of utility-based agents is that they can compare several acceptable outcomes instead of treating every successful option as equally good.
- They balance several priorities at once. The utility function combines factors such as speed, cost, safety, and reliability into one score, so the agent doesn’t have to optimize one priority in isolation. A delivery agent, for example, can choose a slightly slower route if it saves fuel and reduces risk.
- They rank successful outcomes. Instead of stopping once an option meets the goal, the agent can compare how well each option performs against its priorities. A recommendation system might find dozens of relevant items, then rank them by timing, preference, and predicted satisfaction.
- They handle uncertainty. Expected utility allows the agent to consider both how desirable an outcome is and how likely it is to occur. A route that’s excellent when traffic is clear but unreliable most days may score lower than a slightly slower route with a much more predictable travel time.
Limitations of utility-based agents
The main limitations of utility-based agents are the additional computation required to compare outcomes, the lack of automatic learning, and the difficulty of designing a utility function that reflects the right priorities.
- They require more computation. The agent doesn’t just check whether an action works. It predicts what could happen after each option, estimates how likely those outcomes are, scores them, and compares the results. The more actions and possible outcomes it has to evaluate, the more processing the decision requires.
- They don’t learn from results by default. A utility-based agent can use new sensor data to make its next decision, but that doesn’t mean it learns from whether its previous decision was good or bad. To do that, the system needs a learning component that uses feedback or past outcomes to update the internal model, the utility function’s weights, or both. Without it, the same assumptions and scoring rules stay in place until someone changes them.
- The utility function can be difficult to design well. The agent’s decisions depend on what the scoring formula rewards, so a poorly designed function can consistently favor the wrong outcomes.
Why utility functions are hard to design

Designing the utility function means deciding what the agent should care about and how important each factor should be.
If an important factor is missing, the agent ignores it. A delivery agent that doesn’t include weather in its scoring may choose a route through a snowstorm.
If one factor is given too much importance, it can dominate the decision. For example, if speed matters much more than fuel use, the agent may keep choosing the fastest route even when a slightly slower one uses far less fuel.
The challenge becomes harder when the system must account for human priorities such as fairness, privacy, comfort, and acceptable risk. These don’t always translate neatly into a numerical score.
For instance, a hiring system that rewards rapid hiring and lower salary expectations could rank candidates exactly as intended while omitting qualities the hiring team actually cares about.
Not every priority should be included in the utility score. Keep safety, legal, and other non-negotiable requirements as hard constraints instead. If an action breaks one of those rules, reject it before scoring the remaining options. That prevents a high score for speed, convenience, or cost from outweighing an unacceptable risk.
Is a utility-based agent the right choice for you?
Choose a utility-based agent when several actions can achieve the goal, but some outcomes are better than others.
For example, three delivery routes may all reach the customer, but one is faster, one uses less fuel, and one is more reliable. A utility-based agent is useful when those differences should affect which route it chooses.
Utility scoring is one way to decide what an agent should do next, but it isn’t required for how AI agents work in general. If reaching the goal is enough, a simple rule or goal-based approach may be easier to build and maintain.
If a utility-based agent does make sense for your task, start by deciding what it should compare. For a delivery agent, that could be travel time, fuel use, and reliability. Then decide how important each factor should be. Keep rules that must never be broken, such as avoiding restricted roads, outside the score.
Next, test situations where those priorities conflict. What happens if the fastest route uses much more fuel? Should the agent still choose the cheapest route if it’s frequently delayed? What should it do if live traffic data is unavailable? These tests show whether the scoring rules produce the decisions you actually want.
Building this type of agent means defining, testing, and maintaining that decision logic yourself. If you mainly need AI for specific business tasks rather than a custom agent, Hostinger Agents provides ready-to-use agents for SEO, marketing, content, and other day-to-day needs.

All of the tutorial content on this website is subject to Hostinger's rigorous editorial standards and values.