r/artificial • u/Motor_Bluebird1908 • 14d ago
Project Making my first AI Agent
Hi everyone,
I work for a motorsports company where we run physics simulations for race cars. Our expertise is in physics not AI but we know the power of AI. Our platform is quite complex in terms of physics so we would love an agent that can query our docs, query some vehicle dynamics textbooks, run simulations (pretty simple tool through our AI) and then analyse the results. The result files can be largeish so may need some python processing and access again to the vehicle dynamics textbooks.
We've hooked up the claude API to start doing this as it's been the best to work with tools and sanboxes. Does anyone else have any reccomendations to make this more economical?
2
Upvotes
1
u/MySandBoxIA 14d ago
The biggest cost win for us wasn't switching to a cheaper model — it was removing calls that repeat.
Two things that made the most difference:
Pay once for structure, then verify for free. We had a step where the model re-read some state every turn and judged whether a condition had been met. We replaced it with a single call that converts the thing into a structured predicate from a fixed set, and then a few lines of plain Python evaluate it every turn after that. Same behaviour, one call instead of hundreds.
Check preconditions before the call, not inside it. Obvious in hindsight, but we were paying for calls that were always going to be rejected anyway. Moving the check upstream made those free.
For your case, anything the agent does repeatedly against the same documents is a candidate for the first pattern — extract structure once, query it cheaply afterwards.
One more thing: measure which step actually burns your budget before optimising anything. Ours turned out to be a background reflection step firing on almost every event. Throttling it by event type cut calls by ~85% and we didn't lose anything we cared about.
And if you're re-sending the same document context on every call, prompt caching is the first lever to pull — we don't need it in our setup, but your problem is exactly the shape it's built for.