0

Function Tools Agent

awesome-llm-apps3_1_function_tools

Demonstrates custom function tools creation using the @function_tool decorator.

Sign in to save downloads to your library and vote.

Preview

Function Tools Agent

Demonstrates custom function tools creation using the @function_tool decorator.

๐ŸŽฏ What This Demonstrates

  • Custom Function Tools: Creating tools with @function_tool decorator
  • Tool Descriptions: Providing clear docstrings for LLM understanding
  • Parameter Handling: Type hints and default parameters
  • Error Handling: Graceful tool failure management

๐Ÿš€ 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:

    from agents import Runner
    from agent import root_agent
    
    result = Runner.run_sync(root_agent, "What time is it in New York?")
    print(result.final_output)
    

๐Ÿ’ก Key Concepts

  • @function_tool Decorator: Converting Python functions to agent tools
  • Tool Docstrings: How LLM understands when to use tools
  • Type Hints: Parameter validation and documentation
  • Tool Registration: Adding tools to agent configuration

๐Ÿงช Available Tools

get_current_time(timezone: str = "UTC")

  • Returns current time in specified timezone
  • Handles timezone validation and error cases

greet_user(name: str)

  • Simple greeting tool demonstrating basic tool usage
  • Shows parameter passing from LLM to tool

๐Ÿ”— 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/3_tool_using_agent/3_1_function_tools/README.md
Last refreshed
10/24/2026, 3:00:14 AM (5h ago)
Refresh schedule
Daily ยท 03:00 UTC
Dedupe status
Unique ยท deduped by (source, url)