Phase 2: Tool Design & Function Calling · 55 min · Python · OpenAI SDK
Tool Composition & Dynamic Registration
If the model calls the same 3 tools in the same order every time, that sequence belongs in a single meta-tool.
Hiring signal: Senior AI engineers design tool systems that are extensible without redeployment. At Intercom and Salesforce, tool libraries are maintained by multiple teams — namespacing and dynamic registration are how they avoid stepping on each other. Knowing these patterns signals production engineering maturity.
What you will learn
- Implement tool composition: tools that call other tools (meta-tool pattern)
- Build a dynamic tool registry that can register/deregister tools at runtime
- Design tool namespaces that prevent name collisions in multi-domain agents
The Problem
You built a research agent with 10 tools. Now you need to extend it for a new domain. If each tool was defined by hand as a separate function, you need to edit and redeploy the agent. With tool composition and dynamic registration, you define new tools in a registry and the agent picks them up automatically — no redeployment needed.
The same principle applies to tool count: an agent shown 20 tools has lower selection accuracy than one shown 6 relevant tools. Dynamic context-based filtering shows the model only the tools relevant to the current task.
Tool Composition: Meta-Tools
A meta-tool wraps a sequence of lower-level tool calls into a single interface presented to the model. Instead of the model calling search_web → summarize_results → save_to_memory as three separate decisions, it calls research_topic(topic) once, and your code orchestrates the three steps internally.
When to use a meta-tool:
- The same sequence of tool calls repeats across many agent tasks
- The sequence is deterministic (doesn't depend on intermediate results)
- The intermediate steps add decision noise without adding decision value
When NOT to use a meta-tool:
- The sequence needs to vary based on intermediate results (the model needs to see each step)
- Different steps require different error handling strategies
- The caller needs visibility into the intermediate results
An agent calls search_web, summarize_text, and save_to_notes every time it researches a topic. What's the best refactoring?
If the model reliably calls 3 tools in a fixed sequence, that sequence is deterministic and belongs in a meta-tool. This reduces the model's decision surface (from 3 choices to 1), reduces selection errors, speeds up execution (internal optimization possible), and simplifies the system prompt. The system prompt approach doesn't reduce the tool call count.
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Dynamic Tool Registry, Tool Namespacing, Build It, What to Practice — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy