Back to Courses

Complete AI Mastery Course

Published

A comprehensive 10-module journey from AI foundations to advanced agentic systems and entrepreneurship. Master prompt engineering, automation, coding with AI, and build a future-proof career.

Progress

0%

Pricing & Access

Students pay this to access the course. Leave "Paid course" off for free/enrolled-only access.

CPD Accreditation

Required for CPD — what a learner can do after the course. One outcome per line.

CPD hours (auto-computed)

0 CPD Hours

CPD status

Not submitted

Submitting sends this course for CPD verification. Once approved and the fee is paid, the CPD logo appears on this course's certificates.

Interactive10 min

Building Your First AI Agent: Tools and Frameworks

A practical guide to building a first agent: the model-tools-memory-loop anatomy, choosing a framework, writing strong tool descriptions, setting stop conditions, and prioritising observability and cost control.

{"contentFormat":"slides.v1","completion":{"requireAllSlides":true,"requireQuiz":true},"slides":[{"kind":"title","eyebrow":"Module 7: Agentic AI and Autonomous Systems","title":"Building Your First AI Agent: Tools and Frameworks","body":"Move from theory to practice. Learn the anatomy of an agent, choose the right framework, and build a simple, safe agent with free tools. No expert programming required.","outcomes":["Identify the four core components of a buildable agent","Compare frameworks: LangChain, LangGraph, CrewAI, AutoGen, and provider-native tool use","Write effective tool descriptions that guide model behavior","Set goals, stop conditions, and cost controls for reliable operation","Build a minimal single-tool agent step by step"],"narration":"Welcome to Module 7. In this lesson, you'll learn how to build your first AI agent. We'll cover the essential components, compare popular frameworks, and walk through a hands-on example. Let's get started."},{"kind":"content","heading":"The Anatomy of a Buildable Agent","body":"Every agent combines four components plus a loop:\n\n- Model: A capable LLM (e.g., GPT-4o, Claude 3.5) accessed via API or run locally.\n- Tools: Functions the model can call. Each tool needs a name, description, and defined inputs. Modern APIs use function calling.\n- Memory: At minimum, the conversation history; optionally a vector store for long-term recall.\n- Loop: Code that feeds context, executes tool calls, returns results, and repeats until a stop condition.\n\nAnalogy: Setting up a new employee's desk – skills (model), tools (functions), notebook (memory), shift routine (loop with stop condition).","callout":{"variant":"insight","title":"Key Insight","text":"The model decides which tool to call purely from your description. Writing clear, specific tool descriptions is the highest-leverage part of building an agent."},"narration":"An agent has four parts: a model, tools, memory, and a loop. The model uses tool descriptions to decide when to call a function. Good descriptions are critical."},{"kind":"content","heading":"Choosing a Framework (as of 2026)","body":"You can write the loop yourself, but frameworks save time. Here are the main options:\n\n| Framework | Best For | Notes |\n|-----------|----------|-------|\n| LangChain | Broad toolkit, flexible | Well-documented; can be heavy for small projects |\n| LangGraph | Explicit graph control, reliability | Fine-grained loops, human-in-the-loop |\n| CrewAI | Multi-agent teams | Role-based, fast to prototype |\n| AutoGen | Conversation-driven multi-agent | Strong for agent-agent and human-agent messaging |\n| Provider-native (OpenAI, Anthropic) | Learning mechanics, minimal dependencies | Use SDK tool calling directly |\n\nGuidance: For your first agent, start with provider-native tool calling or a lightweight framework. Avoid large multi-agent systems initially.","callout":{"variant":"tip","title":"Recommendation","text":"Start with provider-native tool calling to understand the mechanics. Then move to LangGraph if you need explicit control or CrewAI for multi-agent scenarios."},"narration":"You can build an agent with just an SDK, or use frameworks like LangChain, LangGraph, CrewAI, or AutoGen. For your first agent, keep it simple."},{"kind":"content","heading":"Writing Effective Tool Descriptions","body":"The model relies on your description to decide when to call a tool. Follow these principles:\n\n- Be specific: \"Look up the current exchange rate between two three-letter currency codes\" is better than \"currency tool.\"\n- State inputs and outputs clearly: Include parameter types and expected return format.\n- Say when not to use it: E.g., \"Do not use for historical data.\"\n\nExample (OpenAI function calling):\n\n

json\n{\n  \"name\": \"get_weather\",\n  \"description\": \"Get current temperature and conditions for a given city. Use when user asks about weather.\",\n  \"parameters\": {\n    \"type\": \"object\",\n    \"properties\": {\n      \"city\": {\n        \"type\": \"string\",\n        \"description\": \"City name, e.g., Nairobi\"\n      }\n    },\n    \"required\": [\"city\"]\n  }\n}\n
\n\nMinimal code snippet (Python with OpenAI):\n\n
python\nimport openai\n\ntools = [\n    {\n        \"type\": \"function\",\n        \"function\": {\n            \"name\": \"get_weather\",\n            \"description\": \"Get current temperature and conditions for a given city.\",\n            \"parameters\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"city\": {\"type\": \"string\", \"description\": \"City name\"}\n                },\n                \"required\": [\"city\"]\n            }\n        }\n    }\n]\n\nmessages = [{\"role\": \"user\", \"content\": \"What's the weather in Jakarta?\"}]\nresponse = openai.chat.completions.create(\n    model=\"gpt-4o\",\n    messages=messages,\n    tools=tools\n)\n# Check if tool call is requested\nif response.choices[0].message.tool_calls:\n    # Execute function and append result\n    pass\n
","callout":{"variant":"exercise","title":"Try It Yourself","text":"Write a tool description for a function that looks up product stock by SKU. Be specific about inputs and when to use it."},"narration":"Tool descriptions are crucial. Be specific, state inputs and outputs, and mention when not to use the tool. The code example shows how to define a tool with OpenAI."},{"kind":"content","heading":"Reliability, Cost, and Observability","body":"Building a reliable agent requires planning for failure and controlling costs.\n\n- Observability first: Log every thought, tool call, and result. You cannot debug an agent you cannot see.\n- Cost control: Each loop step is a paid model call. Set a step cap (e.g., max 5 steps) and, if possible, a spending cap via API limits.\n- Stop conditions: Define a concrete goal (e.g., \"user question answered\") and a hard fallback (max steps).\n- Graceful failure: If the agent cannot complete the task, it should say so clearly rather than invent an answer.\n\nReal-World Examples:\n\n- Small shop in Nigeria: A single-tool agent for product lookup on WhatsApp. One tool, one goal, fully observable.\n- Student in Indonesia: A study agent with web search and note-saver, capped at 8 steps to keep costs near zero.\n- Consultant in UK: Uses LangGraph with a human-in-the-loop node for approval before sending emails.","callout":{"variant":"warning","title":"Common Pitfall","text":"No step limit can lead to runaway loops and high costs. Always set a maximum step count and a clear success condition."},"narration":"Observability, cost control, and clear stop conditions are essential. Learn from real-world examples: start small, cap steps, and log everything."},{"kind":"quiz","heading":"Check Your Understanding","questions":[{"question":"Which component of an agent is responsible for deciding when to call a tool?","options":["Memory","The loop","The model","The tool itself"],"questionId":"cmrf73kb8002mpd27yrrri5ki"},{"question":"What is the recommended first step for building your first agent?","options":["Use a multi-agent framework like CrewAI","Start with provider-native tool calling or a lightweight framework","Build a complex system with five agents and ten tools","Skip tool descriptions to save time"],"questionId":"cmrf73kb8002npd27zhjbh2v7"},{"question":"How can you prevent an agent from looping indefinitely and burning money?","options":["Use a more expensive model","Set a maximum step count and a clear success condition","Disable logging","Remove the stop condition"],"questionId":"cmrf73kb8002opd27gxxuqgfy"}],"narration":"Let's test your understanding with a quick quiz. Answer the questions to reinforce the key concepts.","quizId":"qz_cmk7lm8oh002zg4p89hpln47g"},{"kind":"summary","heading":"Key Takeaways","takeaways":["An agent consists of a model, tools, memory, and a loop.","Tool descriptions are critical: be specific, state inputs/outputs, and mention when not to use.","Start with provider-native tool calling or a lightweight framework for your first agent.","Always set a step cap and success condition to control costs and prevent runaway loops.","Observability (logging) is essential for debugging and reliability.","Build for graceful failure: a clear 'I couldn't complete this' is better than a confident wrong answer."],"narration":"To summarize: know the four components, write good tool descriptions, start simple, control costs, and log everything. Build small, iterate, and grow from success."}]}