Building an expense-policy AI agent: what we learned reverse-engineering Ramp

By Madalina Turlea·
Building an expense-policy AI agent: what we learned reverse-engineering Ramp

Ramp, the fintech app for business expense management, launched a feature where an employee can text and ask "can I expense this?" and an AI agent answers based on their company's policy. It got very good feedback online, in reviews and LinkedIn posts. We tried to reverse-engineer it, to see what accuracy you could expect if you built the same thing from scratch, which instructions work best, and where it fails.

The setup

We prepared three versions of the system prompt, all referencing the same expense policy. We did not have a real policy on hand, so we generated one with AI and used that same policy across all three prompts, formatted differently each time.

The first version was basic. It used a placeholder for the company name and a placeholder for the policy, with a simple instruction: when an employee asks about an expense, determine if it is allowed based on the policy.

The second version formatted the policy as XML, by asking a chat model to convert the document into XML tags, since Anthropic's prompting guide recommends putting domain knowledge in XML tags so the model reads it better. It added more instruction too: analyse the request, respond with approved, not approved, or needs review, give a brief explanation, and reference the specific policy sections. It did not say when something should be "needs review," leaving the model to figure that out.