Stop telling your AI agent where to look.
Stop telling your AI agent where to look. Still wondering what is an AI agent? Put one question to it about tomorrow's weather. It pins down the day, picks the connection, fetches the forecast and reports back: 4 steps you never had to type.
Your part is 2 things: the job, and the connection it can use.
Save this for your next set of instructions. Which bit of AI agent advice would you call out? Tell me below.
I'm Manraj Sidhu, AI developer, and this is the real build.
Follow @manrajtalks
How to build it
This page gives you the step-by-step guide to what an AI agent is, using one everyday weather example: how it takes your input, decides where to get the answer, and comes back with it.
The three stages of an AI agent
An AI agent is an AI tool that takes your input, then takes actions off the back of it. The input can be a prompt or a description you have given it.
Stage 1, you give it an input: for example, you ask for the weather today.
Stage 2, it decides where to get the information: the agent knows what today is and the date, and it has a connection to a weather app or weather API.
Stage 3, it goes to the API, comes back and answers: it grabs the information through that connection and gives you the answer.
Going to the API and coming back is done agentically. You have given the agent the freedom to think about and work out where to get the information, and to fetch it itself. All you asked for was the weather.
How to set it up
Pick an agent tool you can use, such as ChatGPT (Codex), Claude Code or an open-source agent framework.
Choose a public weather API and get its access key.
Connect the weather API to the agent as a tool, so the agent can call it.
Make sure the agent knows today's date, so it can work out what "today" or "tomorrow" means.
Give the agent a plain-language input, such as "What is the weather today in <your city>?".
Let the agent decide for itself to call the weather API, rather than you fetching the data by hand.
Check that the agent comes back with the API's answer and states it in plain words.
Watch out: an agent only acts through the connections you give it, so without a connected weather API it can only guess at the weather rather than fetch it.
Prompt to build your own
You are helping me build a simple AI agent that answers weather questions by calling a weather API itself.
What to build: an agent that takes a plain-language request from me, works out the date it needs, decides to call a weather API, fetches the result and replies with a short answer in plain English.
Tools I have: <ChatGPT (Codex) or Claude Code>, and an API key for <weather API provider>.
Constraints:
- Give the agent the weather API as a tool it can call, and tell it today's date at the start of every request.
- The agent must choose when to call the API; I should not have to fetch the data myself.
- Keep the API key out of the code and out of anything I share, and load it from an environment variable.
- Handle a failed call by telling me the API could not be reached, rather than inventing a forecast.
Show the three stages in the output: my input, which source the agent chose, and the final answer.
Return: the full code, the exact steps to run it on my machine, and one example request such as "What is the weather in <my city> tomorrow?" with the expected output.