Overview

7 production-ready patterns built with the OpenAI Agents SDK and Trigger.dev. Clone this repo to experiment with everything from basic calls to workflows with tools, streaming, guardrails, handoffs, and more.

By combining the OpenAI Agents SDK with Trigger.dev, you can create durable agents that can be deployed to production and scaled to any size, with retries, queues, and full observability built-in.

Video

Tech stack

GitHub repo

View the OpenAI Agents SDK TypeScript playground repo

Click here to view the full code for this project in our examples repository on GitHub. You can fork it and use it as a starting point for your own project.

Agent tasks

  • Basic Agent Chat: Personality-based conversations with strategic model selection
  • Agent with Tools: A simple agent that can call tools to get weather data
  • Streaming Agent: Real-time content generation with progress tracking
  • Agent Handoffs: True multi-agent collaboration using the handoff pattern where agents can dynamically transfer control to specialists
  • Parallel Agents: Concurrent agent processing for complex analysis tasks
  • Scheduled Agent: Time-based agent workflows for continuous monitoring
  • Agent with Guardrails: Input guardrails for safe AI interactions

Relevant code

  • basicAgentChat.ts - Strategic model selection (GPT-4, o1-preview, o1-mini, gpt-4o-mini) mapped to personality types with Trigger.dev task orchestration
  • agentWithTools.ts - OpenAI tool calling with Zod validation integrated into Trigger.dev’s retry and error handling mechanisms
  • streamingAgent.ts - Native OpenAI streaming responses with real-time progress tracking via Trigger.dev metadata
  • scheduledAgent.ts - Cron-scheduled OpenAI agents running every 6 hours with automatic trend analysis
  • parallelAgents.ts - Concurrent OpenAI agent execution using Trigger.dev batch operations (batch.triggerByTaskAndWait) for scalable text analysis
  • agentWithGuardrails.ts - OpenAI classification agents as input guardrails with structured validation and exception handling
  • agentHandoff.ts - OpenAI Agents SDK handoff pattern with specialist delegation orchestrated through Trigger.dev workflows

Learn more