0

Agents as Tools

awesome-llm-apps9_2_agents_as_tools

Demonstrates advanced orchestration patterns where specialized agents are used as function tools by orchestrator agents.

Sign in to save downloads to your library and vote.

Preview

Agents as Tools

Demonstrates advanced orchestration patterns where specialized agents are used as function tools by orchestrator agents.

๐ŸŽฏ What This Demonstrates

  • @function_tool with Agents: Converting agents to reusable tools
  • Content Creation Pipeline: Research โ†’ Writing โ†’ Editing workflow
  • Custom Configuration: Per-agent settings and parameters
  • Intelligent Orchestration: LLM-driven workflow coordination

๐Ÿš€ Quick Start

  1. Install OpenAI Agents SDK:

    pip install openai-agents
    
  2. Set up environment:

    cp ../env.example .env
    # Edit .env and add your OpenAI API key
    
  3. Run the agent:

    import asyncio
    from agent import main
    
    # Test agent orchestration patterns
    asyncio.run(main())
    

๐Ÿ’ก Key Concepts

  • Agent Tool Creation: Using @function_tool with Runner.run()
  • Workflow Orchestration: Coordinating multiple specialized agents
  • Custom Configuration: Per-tool settings (max_turns, temperature)
  • Intelligent Coordination: LLM decides when and how to use tools

๐Ÿงช Available Tools

Research Tool

@function_tool
async def research_tool(topic: str) -> str:
    result = await Runner.run(
        research_agent,
        input=f"Research this topic thoroughly: {topic}",
        max_turns=3
    )
    return str(result.final_output)

Writing Tool

@function_tool  
async def writing_tool(content: str, style: str = "professional") -> str:
    prompt = f"Write engaging {style} content based on this research: {content}"
    result = await Runner.run(writing_agent, input=prompt, max_turns=2)
    return str(result.final_output)

Editing Tool

@function_tool
async def editing_tool(content: str) -> str:
    result = await Runner.run(
        editing_agent,
        input=f"Edit and improve this content: {content}"
    )
    return str(result.final_output)

๐Ÿ’ป Orchestration Patterns

Basic Content Workflow

  1. Research: Gather comprehensive information
  2. Write: Create well-structured content
  3. Edit: Polish and improve final output

Advanced Orchestration

  • Conditional Logic: Adapt workflow based on requirements
  • Style Selection: Choose appropriate writing approach
  • Quality Control: Multi-stage review and improvement

Manual vs Automatic Comparison

  • Direct Agent Calls: Manual orchestration
  • Tool-Based: Automatic LLM coordination
  • Performance: Compare execution patterns

๐Ÿ”— Next Steps

Ingestion metadata

Source catalog
awesome-llm-apps
Repository
Shubhamsaboo/awesome-llm-apps ยท main
File path
ai_agent_framework_crash_course/openai_sdk_crash_course/9_multi_agent_orchestration/9_2_agents_as_tools/README.md
Last refreshed
7/23/2026, 10:39:09 PM (4h ago)
Refresh schedule
Daily ยท 03:00 UTC
Dedupe status
Unique ยท deduped by (source, url)