Build your first AI agent: from idea to a working tool
What separates a chat from an agent, and how to build a simple agent that uses real tools, step by step.
This is sample content that shows how the platform looks. It is not real news.
A chat answers a question. An agent takes a goal, decides the steps, uses tools to carry them out, then checks the result.
The parts of any agent
- A model that reasons and decides.
- Tools: functions it can call, such as search, reading a file or sending a request.
- A loop: it repeats “think → act → observe” until it is done.
- Limits: a maximum number of steps and clear permissions.
A simple example
const tools = {
weather: async (city) => fetch(`/api/weather?city=${city}`).then(r => r.json()),
};
for (let step = 0; step < 5; step++) {
const reply = await model.ask({ goal, history, tools: Object.keys(tools) });
if (reply.done) break;
const result = await tools[reply.tool](reply.input);
history.push({ tool: reply.tool, result });
}
Golden rules
- Start with a single tool and make sure it works.
- Log every step the agent takes so you can see where it went wrong.
- Never let it delete or pay for anything without human approval.
A good agent is not the smartest one. It is the one with the clearest limits.