0

Execution Methods

awesome-llm-apps4_1_execution_methods

Demonstrates the three execution methods available in the OpenAI Agents SDK: sync, async, and streaming.

Sign in to save downloads to your library and vote.

Preview

Execution Methods

Demonstrates the three execution methods available in the OpenAI Agents SDK: sync, async, and streaming.

๐ŸŽฏ What This Demonstrates

  • Runner.run(): Asynchronous execution for non-blocking operations
  • Runner.run_sync(): Synchronous execution for simple blocking calls
  • Runner.run_streamed(): Streaming execution for real-time responses
  • Performance Comparison: When to use each method

๐Ÿš€ 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
    
    # Test sync execution
    result = root_agent.sync_execution_example()
    print(result)
    

๐Ÿ’ก Key Concepts

  • Sync Execution: Blocks until completion, simple to use
  • Async Execution: Non-blocking, enables concurrency
  • Streaming Execution: Real-time response processing
  • Use Case Selection: Choose based on application needs

๐Ÿ”— 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/4_running_agents/4_1_execution_methods/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)