> ## Documentation Index
> Fetch the complete documentation index at: https://docs.atonom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt reduction

> Move logic out of the prompt and into A-script so tokens can be used for other directions for the agent.

Prompts are read on every interaction that is made with an agent. Whether it be a routing table, a schedule, a list of names that mean the same thing, or a lookup procedure, they are all in that prompt and spend tokens even when that part of the prompt isn’t used.

A-script is a small Lua program your agent can call as a tool. You take rules and deterministic logic from your prompt and turn them into A-Scripts. As you give it inputs, it will run the logic, and return a result the agent uses on the next turn. The logic stays in the script. The prompt keeps one short instruction: when to call it, what to pass, and what to do with the result.

Reducing prompts frees tokens. Those freed tokens provide more flexibility and direction for your agent. You can use the freed tokens to describe who the agent is, what a good outcome looks like, and how to handle the conversation.

# What to move into a script

Move work you can describe as: take an input, transform it, return an output. The input can come from the person in the conversation or from the agent, such as a value an earlier tool returned. The output can be a yes or no, a record, or an instruction that is deterministic. Keep that output small.

These are the rules that usually take the most room. Each example is the kind of prompt you would move into an A-script.

**A table or a short procedure.** Allowed values, a schedule, which option a choice maps to. Example prompt:

> Only transfer calls during open office hours. We are open Monday through Friday, 9am to 5pm in the caller's local time. Closed on New Year's Day, Memorial Day, July 4, Labor Day, Thanksgiving, and Christmas. Outside those hours, offer a callback. In the EU, use 8am to 4pm and add Boxing Day.

**A lookup.** The request stays in the script. Return the few fields the next step needs, because extra fields spend tokens on the next turn. Example prompt:

> When they give an order number, look it up. If you find it, tell them the status, the carrier, and the delivery date. Do not mention the warehouse, the internal ID, or the payment method. If the number is missing or nothing matches, ask for the number again.

**A match.** Several names that mean one value, a comparison, a normalization. The list of names stays in the script. Example prompt:

> Treat "cell," "mobile," and "cell phone" as a phone number. Treat "invoice," "bill," and "statement" as billing. Treat "can't log in," "password," and "locked out" as access. If they use a name you do not recognize, ask them to say it another way before you continue.

**A sequence.** One script can look up a record, apply a rule, and return the next step, so the prompt does not carry all three. Example prompt:

> Look up the account from the email they gave you. If the plan is active and they asked about billing, send them to billing. If it is active and they asked about access, send them to access. If the plan is not active, send them to general support. If you cannot find the account, ask for the email and start over.

Leave voice, tone, and what the agent is allowed to say in the prompt. That is the direction the freed tokens are for. If two people on your team would not agree on the answer, it is not ready to be a script. Describe that judgment in the prompt, where you still have room for it.

# How the prompt stays short

Name the tool, the moment to call it, the fields to pass, and how to treat the result. Leave the logic in the script. If the logic is written in both places, you spend the tokens anyway, and the script is no longer the source of truth.

**Don'ts**

> Check the schedule before you offer a live handoff. Open Monday to Friday, 9 to 5, closed on these holidays, and use the other list outside this region. If the status is active or trial, continue. Invoice and billing go to billing. Login and access go to access. Anything else, ask which they mean.

**Do's**

> Before you offer a live handoff, call `office_hours` with `region`. If it returns false, offer a callback. If it returns true, continue.

The first prompt spends tokens on the hours, the holiday list, and the region rules on every turn. The second leaves that schedule in the script and only says when to call it. Changing the rule means changing the script. The prompt stays the same, and those tokens stay available for you to use.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.