<aside> 💡 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.
</aside>
<aside> ⚠️ 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.
</aside>
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.
Watch the video · More free guides · Follow @manrajtalks for the next one.