Unit Normalization for AI Agents: Convert Feet, Gallons and Cases First
Convert units and currencies in tool outputs before an AI agent reasons over them. Pick one canonical unit per field, keep originals and test conversions.

Unit normalization for AI agents means converting every measurement and currency in a tool's output into one agreed unit before the agent reasons over it. A supplier that counts in cases, a warehouse that counts single items and a field report that uses feet can each be correct on their own, yet an agent that combines them without conversion will produce totals that look right and are wrong. The fix belongs in the tool layer, where each value leaves the system with its unit attached and its original form preserved.
Key takeaways
- Choose one canonical unit for every measure and currency your agent reads, and write it into the tool schema.
- Convert values before the model sees them, so the agent never has to guess what a number means.
- Keep the original value, original unit and conversion source beside the converted value so anyone can audit the result.
- Test conversions against fixed examples and rerun those tests after every change and every vendor update.
- Treat currency conversion as a sourced assumption with a recorded timestamp, never as something the agent improvises.
Why a small unit mismatch becomes a large operating error
Agents rarely fail at simple arithmetic. They fail when two correct numbers are combined under different units. A supplier catalog lists a product by the case, the inventory system counts individual units, a fleet tool reports distance in miles and a site visit note gives dimensions in feet. Each source is right in its own context. When an agent reads all of them in one pass and writes a summary or a purchase suggestion, the error is hard to see, because the output looks plausible and nothing on the page says which unit was used.
People carry unit sense without thinking about it. A person who sees gallons next to a tank size checks it against what they already know about the tank. An agent works with text, and if a figure in liters and a figure in gallons appear in the same column of a summary, it can add them as if they shared a unit. The model is capable. The problem is missing context at the moment it reads the number.
The fix is small and unglamorous, which is why it is often skipped until a wrong figure reaches a customer, a supplier or a bank transfer.
Choose one canonical unit for each measure
Before writing any conversion, decide what the agent will see. A canonical unit is the single unit used for a given measure across every tool the agent touches. For length, choose meters or feet and keep it. For volume, choose liters or gallons. For counts that depend on packaging, store the base unit and the pack size as separate fields, rather than relying on a word like case to carry meaning.
Use these rules to decide the edge cases:
- If the business counts physical goods in packs, store the base unit (each item) and the pack size as separate fields, and convert cases through the pack size, never by assumption.
- If a source reports a measure in a regional or legacy unit, convert it at the tool boundary and keep the original value next to the converted one.
- If two systems disagree about the same measure, do not let the agent choose between them. Flag the mismatch and route it to the owner of the source system.
- If a value has no reliable conversion, return it as unknown with a reason, and let a person decide.
- If the unit is part of the question, such as how many feet of hose are needed for a site, state the unit in the answer, not only in the calculation.
The owner of each canonical unit should be named. In most businesses that is an operations lead for physical measures and finance for currency.
Where conversion belongs: the tool layer, not the prompt
Putting conversion rules in the system prompt is tempting and fragile. Prompts grow over time, they compete with other instructions and the model applies them unevenly when the context is long. Conversion belongs in the code that calls the vendor API and returns a result to the agent. The tool should return one consistent shape every time, such as a field named volume_liters, plus volume_original and volume_original_unit when a conversion happened.
Field names should carry their units. A field called length invites mistakes, while length_m or length_ft makes the unit visible in every call. Declare the allowed units as an enumeration so that an unexpected value fails loudly instead of passing through. Anthropic's engineering guidance on writing tools for agents makes a related point: the responses a tool returns should be easy for the model to interpret correctly. The mechanics of naming and typing are covered in tool schemas with typed fields and clear errors, and structured outputs for business agents explains why a fixed shape matters once other systems accept what the agent produces.
Keep the context small as well. Anthropic's notes on context engineering for agents describe the value of giving a model only the information relevant to the task. Normalized values reduce the need for the agent to carry extra explanations about units in every prompt.
Currency conversion needs a source, a timestamp and a rule
Currency adds another layer because exchange rates change. The agent should never be asked to recall or estimate a rate. The tool should fetch the rate from a named source, record which rate was used and when it was retrieved, and store the original amount and currency next to the converted amount. Decide which currency is the reporting currency and make that decision with finance, not inside the agent.
A few practical rules keep this manageable:
- Name the reporting currency once in the schema, and reject any amount that arrives without a currency code.
- Store the original amount, the original currency, the converted amount, the rate source and the retrieval time together in the same record.
- Keep conversion for reporting separate from anything involving payment. A payment should run in the currency the counterparty invoiced in unless finance has approved a different path.
- Let the agent report a converted figure only with its currency code and rate source visible, so a reader can see how the number was produced.
This separation also limits the blast radius of an error. A wrong converted figure in a summary can be corrected. A wrong amount sent to a payment provider may not be. For payment tools, the boundaries in payment tools for AI agents that start read-only are a useful reference point.
A step-by-step plan for normalizing one tool
Start with one tool that the agent uses for real decisions, not with every system at once. The following plan works for a single integration:
- Inventory every numeric field the tool returns, and write down its unit. Mark any field where the unit is missing or unclear.
- Choose a canonical unit for each measure and currency, and record the owner who approved it.
- Write the conversion in the tool code, and return the converted value together with the original value and original unit.
- Reject or flag any value that arrives without a unit or in a unit outside the allowed list.
- Build a fixed test set with known inputs and expected outputs. Include edge cases such as a pack size of one, an empty field, a unit written in an unexpected case and a value that cannot be converted.
- Run the test set after every change to the tool and after every vendor update. The approach to fixed test sets is described in OpenAI's evals guide, and it applies directly here.
- Review a sample of real agent outputs each week for unit labels, and tighten the schema wherever a mistake appears.
The test set is the most useful artifact in this list. It turns a belief that the conversions work into a record that they still do.
Illustrative scenario: choosing between two suppliers
Illustrative scenario: a business owner asks an agent to recommend which supplier to reorder from for a cleaning product. Supplier A sells by the case, and its catalog stores the pack size in a separate field that the agent rarely reads. Supplier B sells by the single bottle. The warehouse counts stock in bottles, and the storage tank for a bulk version of the product is labeled in gallons. Without normalization, the agent compares a case price with a bottle price and recommends the wrong supplier. With normalization, every line is restated per base unit, the pack size and original unit are visible, and the agent's recommendation names the unit it compared. The owner can then check the reasoning in seconds instead of trusting a number that looks plausible.
The scenario is simple, which is the point. Most unit errors do not look dramatic when they happen. They look like a reasonable recommendation built on a mismatch.
How Be Human handles normalization in managed operations
In a Be Human engagement, unit and currency normalization is part of the first useful role, not a cleanup task for later. The team works with the business owner to name the canonical units and the people who own them, writes those decisions into the tool schemas, and adds conversion tests to the acceptance checks before the agent reads live data. In managed operations, the same tests run after vendor changes, permission review covers any new unit or currency a system begins returning, and incidents where an agent reasoned over a mislabeled value are logged. The corrective change goes into the schema and the test set, not only into the prompt, so the fix holds after the next update.
If you want to find the first task worth handing to an agent, take the free Be Human AI diagnostic.
Frequently asked questions
Do strong models still need unit normalization? Yes, because the problem is not the model's reasoning ability but the information it receives. A capable model can still combine a value in cases with a value in units if the source does not say what each number means. Normalization makes the unit part of the data, so the model does not have to infer it.
Should unit conversion live in the prompt or in the tool? It should live in the tool. Prompt rules are harder to test, tend to grow over time and can be applied inconsistently when the context is long. Converting in the tool code returns one predictable shape, and that shape can be covered by a fixed test set.
How do I handle currency conversion without letting the agent invent a rate? Have the tool fetch the rate from a named source, store the rate, its source and its retrieval time, and return the original and converted amounts together. The agent should only report figures that carry their currency code and rate source. Finance should decide the reporting currency and the rules for payments.
How do I know the conversions still work after a vendor update? Run a fixed set of test inputs with expected outputs after every change and every vendor update, and include edge cases such as empty fields and unexpected units. Review a sample of real agent outputs regularly to catch labels that drift. When a failure appears, correct the schema or the conversion code and add the case to the test set so it cannot return unnoticed.
Your next step
See where an AI agent fits in your company first.
Take the free Be Human AI diagnostic. A few questions about your work show which task to hand to an agent first, what it needs to know and where a person approves.
Be Human editorial guidance. Examples are illustrative unless explicitly attributed. Sources provide background; implementation choices depend on your workflow.


