Build your own AI agent (Medium)
A tool-calling agent that speaks JSON like real model APIs: search, memory, retries, a context window and a cost meter.
This is the shape of the OpenAI, Anthropic and Gemini tool APIs, and of LangChain-style agents: JSON calls, checked arguments, retrieval and budgets.
About 360 minutes across 10 stages. Skills: JSON tool calling, Schemas, Retrieval (RAG), Retries, Context window, Cost.
The guides are part of licode Club.
Stages
- Read the model's JSON reply.
- Run the tool calls and ask again.
- Check every argument before running a tool.
- Search the documents: the R in RAG.
- Handle many calls, missing ids and runaway models.
- Retry tools that fail for a moment.
- Give the agent long-term memory.
- Fold old messages to fit the context window.
- Add guardrails: switched-off tools and loop blocking.
- Count the words and the cost of every model call.