BlogCRM and integrations

External APIs in an Agent Scenario: Exchange Rates, Package Status, Weather – How It Works Technically

A model doesn't know today's exchange rate and can't see where a customer's package is. Here's how an agent technically fetches live data via an external API call – and what can go wrong.

A customer types into your chatbot: "what's today's exchange rate" or "where's my package." The model answering in that chat does not actually know either answer on its own – its knowledge is frozen at training time, while an exchange rate changes daily and a shipment moves by the hour. If the agent "guesses" a number or a status at that moment, that is not a training flaw – it is a gap in how the scenario was built. This article covers how an agent technically gets live data in the middle of a conversation: what a call to an external API looks like, what parts it is made of, and what to ask a contractor so the agent checks a real number instead of inventing one.

What "the agent calls an external API" actually means

A model has two sources of truth. The first is what it learned during training: grammar, general facts, how to phrase a reply. The second is whatever it is handed inside the current conversation: the customer's message, the chat history, and – if the scenario is built for it – the result of a function call. A function call (the documentation calls this function calling or tool use) is a mechanism where the model does not answer with text right away. Instead it signals: "I need this specific data, here is the function name and the parameters." Your code then takes over: it takes those parameters, makes a real request to an external service – a bank, a courier, a weather service – gets back a JSON response, and feeds that back to the model as a new fact. Only after that does the model write the actual reply to the customer.

The direction is the opposite of a webhook, which we covered in our piece on how systems pass data to each other: a webhook is when another system tells you about an event on its own, without waiting to be asked. A call to an external API inside a conversation runs the other way – the agent goes and asks at the moment it needs the answer, because there is no way to know in advance when a customer will ask about a rate or a parcel.

What one outbound call is made of

Whether it is an exchange rate or a tracking status, every such call is assembled from the same pieces.

PartWhat it isExample for an exchange rate
TriggerThe phrase or intent that makes the model decide it needs live data"What's the rate?", "how much is that in dollars"
ParametersWhat exactly the model extracted from the message for the requestThe currency code for the dollar, date – today
RequestThe real HTTP request your code sends to the outside serviceA call to the central bank's JSON endpoint
ResponseWhat the service returned – and what happens if it did not answerA rate figure, or a timeout
SubstitutionHow the result flows back into the conversationThe model receives the figure and phrases the answer in its own words

If the scenario is built on an automation platform, the same call shows up as an "HTTP Request" node in a chain – we compared such platforms in our article on choosing between n8n, Make and Zapier. The principle does not change: someone has to actually send the request and parse the response – the model itself does not do that part.

Exchange rates: the agent calculates off a real rate, it does not guess

The Central Bank of Uzbekistan publishes official exchange rates in an open JSON format with no access key required, as described on its page for webmasters at cbu.uz. An agent that needs to quote a customer a price in local currency at today's rate calls that endpoint on each request or once a day, and converts the amount against the current figure rather than a number baked into the prompt a month ago.

Customer: If I pay in local currency, how much is that today?

Agent: Let me convert that at today's central bank rate and send you the exact figure right here in the chat. The rate can shift slightly before payment, so the manager will confirm the exact amount before issuing the invoice.

That last sentence in the example is not an afterthought: an honestly built agent does not present a converted figure as a final price when there is a time gap between the conversation and the actual payment.

Package status: the agent asks the carrier instead of saying "let me check"

Most courier companies and marketplaces expose their own API or a tracking widget keyed to a tracking number. An agent wired to that API gets structured data rather than a text blurb scraped off a page: the current stage, the city, the expected date. That closes the most common support gap – a customer writes "where's my package" and a human has to switch systems, look up the number, and copy the status over by hand.

Customer: Where is order 4521?

Agent: The package cleared the Tashkent sorting hub today at 9:40am and is expected at the Chilanzar pickup point by 6pm tomorrow. If it hasn't arrived by evening, let me know and I'll open a ticket with the carrier.

What matters here is that the agent does not invent intermediate statuses that aren't in the carrier's response. If the API only returns "in transit" with no city, the agent should say exactly that rather than padding the answer with detail for the sake of sounding convincing.

Weather: a small example with an outsized effect

Weather looks like a trivial example, but for a business running deliveries, outdoor events, or venue bookings, it directly shapes a customer's decision. Open-Meteo returns a forecast by coordinates with no API key required and is free for light, non-commercial load, which is why it shows up often in pilot scenarios.

Customer: We wanted to do a tasting in the courtyard on Saturday – is that going to work?

Agent: Saturday's forecast is partly cloudy with no rain, around 18°C during the day. For the evening I'd keep a backup plan in case of wind after 8pm – chance of rain later in the evening is around 15%.

This is a case where live data closes a question that used to be answered only by a human who manually opened a weather forecast in another tab.

What stays with you, not the AI

ProcessWhat the AI doesWhat stays with a human
Converting a price at the current ratePulls the live rate, computes the amount, states it to the customerConfirms the final figure before the invoice goes out
Package statusQueries the carrier by tracking number and relays the statusHandles disputed cases – loss, damage, returns
Weather forecast for a bookingShows the forecast and states the chance of rain honestlyDecides whether to reschedule an event or a booking
Choosing which API to connect–Evaluates a contractor's reliability, rate limits and per-call cost

What breaks: rate limits, timeouts and stale data

Calling an external API is one more point of failure in the scenario, and it tends to fail in predictable ways.

Rate limits

Free and quasi-free APIs almost always cap you per day or per minute. If an agent hits a weather service on every single message instead of caching it for a few minutes, the limit will run out before the workday does. The fix is caching: hold the response for 10–30 minutes instead of hitting the limit with identical repeat requests.

Timeouts and empty responses

An external service can fail to answer in reasonable time or return an error. The agent needs a pre-written, honest fallback for that case – "I can't pull the current rate right now, I'll check and get back to you" – rather than passing off the last known figure as fresh.

Wrong parameters

A model can misread the currency code from a phrase like "the buck rate" or misparse a tracking number from a message with a typo. Validating the parameter format before the request goes out is a job for your code, not the model.

Access keys and per-call cost

If the service is paid, its limits need to be budgeted into the scenario too. If the service you actually need has no API at all, you're left with either scraping the page, which is unreliable, or the approach we covered in our article on connecting AI to an old CRM with no API – the same logic applies to any external service without one.

FAQ

Does the agent need direct internet access?

No. The model itself never reaches the network – your code makes the request to the external service on the model's instruction, and the result comes back as text. That is both safer and easier to control.

Can you wire up ten external APIs at once?

Technically yes, but each one adds its own point of failure and its own rate limit. In practice it's better to add them one at a time and watch how each behaves in production – limits, response speed, error format – before adding the next.

What if a service has no public API?

Then there are two options: negotiate separate access with the provider, or gather the data another way – for example, a scheduled file export. Both are more expensive and less reliable than a ready-made API, which is worth weighing when you're choosing partners.

How do you verify the agent isn't making numbers up?

Ask the contractor to show you the call log: what was sent to the external service and what came back. If a figure in the agent's reply isn't in that log, the source wasn't the API – it was the model guessing.

Should the agent tell the customer the data was fetched live?

Not strictly necessary from a technical standpoint, but it helps trust: a phrase like "at today's central bank rate" or "according to the carrier" costs a few words and explains why the figure is accurate rather than invented.

If you're building a scenario where an agent needs live data from several external services, we cover more of this in the integrations section of the blog and on the AI agents page. To talk through a specific scenario, reach out through the contact form.

After the article

Want this in your business?

Describe your task in the brief and we’ll reply with where you should start. The first meeting takes 30 minutes.

Or message me directly:WhatsApp ↗Telegram ↗

Meeting brief

Monthly marketing budget
Where to reach you
When works for you? (optional)

We’ll confirm the exact time by message.