<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>

The three stages of an AI agent

How to set it up

  1. Pick an agent tool you can use, such as ChatGPT (Codex), Claude Code or an open-source agent framework.
  2. Choose a public weather API and get its access key.
  3. Connect the weather API to the agent as a tool, so the agent can call it.
  4. Make sure the agent knows today's date, so it can work out what "today" or "tomorrow" means.
  5. Give the agent a plain-language input, such as "What is the weather today in <your city>?".
  6. Let the agent decide for itself to call the weather API, rather than you fetching the data by hand.
  7. Check that the agent comes back with the API's answer and states it in plain words.

<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>

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.

Watch the video · More free guides · Follow @manrajtalks for the next one.