A structured output agent demonstrating Pydantic schema-based responses for customer support ticket creation.
Sign in to save downloads to your library and vote.
Preview
Support Ticket Agent
A structured output agent demonstrating Pydantic schema-based responses for customer support ticket creation.
๐ฏ What This Demonstrates
- Structured Output: Using Pydantic models to define response schemas
- Enum Types: Priority levels with controlled values
- Optional Fields: Flexible schema with required and optional properties
- Field Validation: Input validation and description metadata
๐ Quick Start
-
Install OpenAI Agents SDK:
pip install openai-agents -
Set up environment:
cp ../env.example .env # Edit .env and add your OpenAI API key -
Run the agent:
from agents import Runner from agent import root_agent result = Runner.run_sync(root_agent, "I can't log into my account and it's urgent!") print(result.final_output) # Returns SupportTicket object
๐ก Key Concepts
- Pydantic Models: Defining structured response schemas
- Enum Validation: Priority levels (low, medium, high, critical)
- Field Descriptions: Helping the LLM understand field requirements
- Optional Fields: Handling optional vs required data
๐งช Example Usage
# The agent will return a SupportTicket object like:
{
"title": "Account Login Issue",
"description": "User unable to access account",
"priority": "high",
"category": "account_access",
"steps_to_reproduce": ["Go to login page", "Enter credentials", "Error occurs"],
"estimated_resolution_time": "2-4 hours"
}
๐ Next Steps
- Product Review Agent - Complex structured output
- Email Generator Agent - Simple structured output
- Tutorial 3: Tool Using Agent - Adding tools to agents
Ingestion metadata
- Source catalog
- awesome-llm-apps
- Repository
- Shubhamsaboo/awesome-llm-apps ยท main
- File path
- ai_agent_framework_crash_course/openai_sdk_crash_course/2_structured_output_agent/2_1_support_ticket_agent/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)