0
Phase 4

Multi Tool

~3 min read

Concept & How It Works

    Why Does It Exist?

    Real tasks require multiple capabilities: search the web, then query a database, then format results, then send an email. Multi-tool orchestration is what separates a demo agent (one tool) from a production agent (coordinated tool suite).

    Real-World Analogy

    Multi-tool orchestration is like a chef using knife, stove, and oven in sequence — not just having tools available, but knowing which to use when and how outputs flow between them.
    Loading diagram...

    Visual Workflows

    What is Multi Tool?

    Loading diagram...

    Example

    Scenario

    Task: 'Find our top customer this month and draft a thank-you email.' Step 1: query_database('top customer Q4') → {name: 'Acme Corp'}. Step 2: search_web('Acme Corp recent news') → news summary. Step 3: draft_email(name, news) → email draft. Three tools, sequential chain.

    Solution

    In Agent Foundations, apply Multi Tool to this scenario: Task: 'Find our top customer this month and draft a thank-you email. Identify the inputs, run the technique, validate the output, and note one thing you would monitor in production.

    Practice Task

    Do this before moving to the next module — reading alone is not enough.

    Open the Code Walkthrough below and run it locally. Change one parameter related to Multi Tool (e.g. model, temperature, top_k, or tool name), observe the difference in output, and write 2–3 sentences explaining what changed.

    Code Walkthrough

    Highlighted lines show where Multi Tool happens in the code.

    Multi Tool
    1import asyncio  # import dependencies2
    3async def execute_tools_parallel(tool_calls: list) -> list:  # key line for Multi Tool4    async def run_one(tc):5        fn = TOOL_REGISTRY[tc.function.name]  # key line for Multi Tool6        args = json.loads(tc.function.arguments)7        return await asyncio.to_thread(fn, **args)  # return the result8    return await asyncio.gather(*[run_one(tc) for tc in tool_calls])  # return the result9
    10async def execute_tools_sequential(steps: list[dict]) -> list:  # key line for Multi Tool11    results = []12    for step in steps:13        context = {"previous_results": results}14        result = await asyncio.to_thread(15            TOOL_REGISTRY[step["tool"]], **step["args"], **context  # key line for Multi Tool16        )17        results.append(result)18    return results  # return the result

    Commands to Remember

    Commands to Remember

    • pip install openai # minimal agent = LLM API + Python loop
    • python agent.py # run your agent script
    • pip install python-dotenv # load API keys from .env

    Common Mistakes

    • Too many tools — LLM selects wrong ones
    • Sequential execution of independent tools — wasted latency
    • No fallback when primary tool fails
    • Not passing context between chained tools
    • No analytics on which tools fail most

    Cheat Sheet

    Quick recap — the most important points from this module.

    Cheat Sheet

    quick ref
    • Independent = parallel
    • Dependent = sequential
    • 3-5 tools per agent
    • Fallback chains per tool
    • >15 tools = router agent
    • Track usage + failures