Skip to content

Commit 1dbcf66

Browse files
authored
Added openai agents sdk for typescript playground docs (#2194)
* Added openai agents sdk typescript playground docs and updated guardrails * Removed broken link and import * Typo fix
1 parent 6f68526 commit 1dbcf66

File tree

4 files changed

+95
-30
lines changed

4 files changed

+95
-30
lines changed

docs/docs.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -326,15 +326,7 @@
326326
}
327327
]
328328
},
329-
{
330-
"group": "Python guides",
331-
"pages": [
332-
"guides/python/python-image-processing",
333-
"guides/python/python-doc-to-markdown",
334-
"guides/python/python-crawl4ai",
335-
"guides/python/python-pdf-form-extractor"
336-
]
337-
},
329+
338330
{
339331
"group": "Example projects",
340332
"pages": [
@@ -343,13 +335,23 @@
343335
"guides/example-projects/human-in-the-loop-workflow",
344336
"guides/example-projects/meme-generator-human-in-the-loop",
345337
"guides/example-projects/openai-agent-sdk-guardrails",
338+
"guides/example-projects/openai-agents-sdk-typescript-playground",
346339
"guides/example-projects/realtime-csv-importer",
347340
"guides/example-projects/realtime-fal-ai",
348341
"guides/example-projects/turborepo-monorepo-prisma",
349342
"guides/example-projects/vercel-ai-sdk-deep-research",
350343
"guides/example-projects/vercel-ai-sdk-image-generator"
351344
]
352345
},
346+
{
347+
"group": "Python guides",
348+
"pages": [
349+
"guides/python/python-image-processing",
350+
"guides/python/python-doc-to-markdown",
351+
"guides/python/python-crawl4ai",
352+
"guides/python/python-pdf-form-extractor"
353+
]
354+
},
353355
{
354356
"group": "Example tasks",
355357
"pages": [

docs/guides/example-projects/openai-agent-sdk-guardrails.mdx

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,16 @@
11
---
2-
title: "OpenAI Agent SDK guardrails examples"
3-
sidebarTitle: "OpenAI Agent SDK guardrails"
4-
description: "This example project demonstrates how to implement different types of guardrails using the OpenAI Agent SDK with Trigger.dev for AI safety and control."
2+
title: "OpenAI Agents SDK for Python guardrails"
3+
sidebarTitle: "OpenAI Agents SDK for Python guardrails"
4+
description: "This example project demonstrates how to implement different types of guardrails using the OpenAI Agent SDK for Python with Trigger.dev."
55
---
66

7-
import RealtimeLearnMore from "/snippets/realtime-learn-more.mdx";
8-
9-
<Info>The OpenAI Agent SDK is a Python library. </Info>
10-
117
## Overview
128

139
This demo is a practical guide that demonstrates:
1410

1511
- **Three types of AI guardrails**: Input validation, output checking, and real-time streaming monitoring
16-
- Integration of the [OpenAI Agent SDK](https://openai.github.io/openai-agents-python/) with [Trigger.dev](https://trigger.dev) for production AI workflows
12+
- Integration of the [OpenAI Agent SDK for Python](https://openai.github.io/openai-agents-python/) with [Trigger.dev](https://trigger.dev) for production AI workflows
13+
- Triggering Python scripts from tasks using our [Python build extension](/config/extensions/pythonExtension)
1714
- **Educational examples** of implementing guardrails for AI safety and control mechanisms
1815
- Real-world scenarios like math tutoring agents with content validation and complexity monitoring
1916

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
title: "OpenAI Agents SDK for Typescript + Trigger.dev playground"
3+
sidebarTitle: "OpenAI Agents SDK for Typescript playground"
4+
description: "Build production-ready AI agents with OpenAI Agents SDK for Typescript and Trigger.dev. Explore 7 examples covering streaming, multi-agent systems, and tool integration."
5+
tag: "v4"
6+
---
7+
8+
## Overview
9+
10+
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.
11+
12+
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.
13+
14+
## Video
15+
16+
<video
17+
controls
18+
className="w-full aspect-video"
19+
src="https://github.com/user-attachments/assets/d3a1c709-412f-48e8-a4aa-f0ef50dce5c8"
20+
></video>
21+
22+
## Tech stack
23+
24+
- [Node.js](https://nodejs.org) runtime environment
25+
- [OpenAI Agents SDK for Typescript](https://openai.github.io/openai-agents-js/) for creating and managing AI agents
26+
- [Trigger.dev](https://trigger.dev) for task orchestration, batching, scheduling, and workflow management
27+
- [Zod](https://zod.dev) for payload validation
28+
29+
## GitHub repo
30+
31+
<Card
32+
title="View the OpenAI Agents SDK TypeScript playground repo"
33+
icon="GitHub"
34+
href="https://github.com/triggerdotdev/examples/tree/main/openai-agents-sdk-with-trigger-playground"
35+
>
36+
Click here to view the full code for this project in our examples repository on GitHub. You can
37+
fork it and use it as a starting point for your own project.
38+
</Card>
39+
40+
## Agent tasks
41+
42+
- **Basic Agent Chat**: Personality-based conversations with strategic model selection
43+
- **Agent with Tools**: A simple agent that can call tools to get weather data
44+
- **Streaming Agent**: Real-time content generation with progress tracking
45+
- **Agent Handoffs**: True multi-agent collaboration using the [handoff pattern](https://openai.github.io/openai-agents-js/guides/handoffs/) where agents can dynamically transfer control to specialists
46+
- **Parallel Agents**: Concurrent agent processing for complex analysis tasks
47+
- **Scheduled Agent**: Time-based agent workflows for continuous monitoring
48+
- **Agent with Guardrails**: Input guardrails for safe AI interactions
49+
50+
## Relevant code
51+
52+
- **[basicAgentChat.ts](https://github.com/triggerdotdev/examples/blob/main/openai-agents-sdk-with-trigger-playground/src/trigger/basicAgentChat.ts)** - Strategic model selection (GPT-4, o1-preview, o1-mini, gpt-4o-mini) mapped to personality types with Trigger.dev task orchestration
53+
- **[agentWithTools.ts](https://github.com/triggerdotdev/examples/blob/main/openai-agents-sdk-with-trigger-playground/src/trigger/agentWithTools.ts)** - OpenAI tool calling with Zod validation integrated into Trigger.dev's retry and error handling mechanisms
54+
- **[streamingAgent.ts](https://github.com/triggerdotdev/examples/blob/main/openai-agents-sdk-with-trigger-playground/src/trigger/streamingAgent.ts)** - Native OpenAI streaming responses with real-time progress tracking via Trigger.dev metadata
55+
- **[scheduledAgent.ts](https://github.com/triggerdotdev/examples/blob/main/openai-agents-sdk-with-trigger-playground/src/trigger/scheduledAgent.ts)** - Cron-scheduled OpenAI agents running every 6 hours with automatic trend analysis
56+
- **[parallelAgents.ts](https://github.com/triggerdotdev/examples/blob/main/openai-agents-sdk-with-trigger-playground/src/trigger/parallelAgents.ts)** - Concurrent OpenAI agent execution using Trigger.dev batch operations (`batch.triggerByTaskAndWait`) for scalable text analysis
57+
- **[agentWithGuardrails.ts](https://github.com/triggerdotdev/examples/blob/main/openai-agents-sdk-with-trigger-playground/src/trigger/agentWithGuardrails.ts)** - OpenAI classification agents as input guardrails with structured validation and exception handling
58+
- **[agentHandoff.ts](https://github.com/triggerdotdev/examples/blob/main/openai-agents-sdk-with-trigger-playground/src/trigger/agentHandoff.ts)** - OpenAI Agents SDK handoff pattern with specialist delegation orchestrated through Trigger.dev workflows
59+
60+
## Learn more
61+
62+
- [OpenAI Agents SDK docs](https://openai.github.io/openai-agents-js/) - learn about creating and managing AI agents
63+
- [OpenAI Agents SDK handoffs](https://openai.github.io/openai-agents-js/guides/handoffs/) - learn about agent-to-agent delegation patterns
64+
- [Batch triggering](/triggering#batch-trigger) - learn about parallel task execution
65+
- [Scheduled tasks (cron)](/tasks/scheduled#scheduled-tasks-cron) - learn about cron-based task scheduling

docs/guides/introduction.mdx

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,21 @@ Get set up fast using our detailed walk-through guides.
4141

4242
## Example projects
4343

44-
Example projects are full projects with example repos you can fork and use. These are a great way of learning how to encorporate Trigger.dev into your project.
44+
Example projects are full projects with example repos you can fork and use. These are a great way of learning how to use Trigger.dev in your projects.
4545

46-
| Example project | Description | Framework | GitHub |
47-
| :---------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- | :-------- | :------------------------------------------------------------------------------------------------------------ |
48-
| [Batch LLM Evaluator](/guides/example-projects/batch-llm-evaluator) | Evaluate multiple LLM models and stream the results to the frontend. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/batch-llm-evaluator) |
49-
| [Claude thinking chatbot](/guides/example-projects/claude-thinking-chatbot) | Use Vercel's AI SDK and Anthropic's Claude 3.7 model to create a thinking chatbot. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/claude-thinking-chatbot) |
50-
| [Human-in-the-loop workflow](/guides/example-projects/human-in-the-loop-workflow) | Create audio summaries of newspaper articles using a human-in-the-loop workflow built with ReactFlow and Trigger.dev waitpoint tokens. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/article-summary-workflow) |
51-
| [OpenAI Agent SDK guardrails](/guides/example-projects/openai-agent-sdk-guardrails) | Use the OpenAI Agent SDK to create a guardrails system for your AI agents. || [View the repo](https://github.com/triggerdotdev/examples/tree/main/openai-agent-sdk-guardrails-examples) |
52-
| [Python web crawler](/guides/python/python-crawl4ai) | Use Python, Crawl4AI and Playwright to create a headless web crawler with Trigger.dev. || [View the repo](https://github.com/triggerdotdev/examples/tree/main/python-crawl4ai) |
53-
| [Realtime CSV Importer](/guides/example-projects/realtime-csv-importer) | Upload a CSV file and see the progress of the task streamed to the frontend. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/realtime-csv-importer) |
54-
| [Realtime Fal.ai image generation](/guides/example-projects/realtime-fal-ai) | Generate an image from a prompt using Fal.ai and show the progress of the task on the frontend using Realtime. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/realtime-fal-ai-image-generation) |
55-
| [Turborepo monorepo with Prisma](/guides/example-projects/turborepo-monorepo-prisma) | Use Prisma in a Turborepo monorepo with Trigger.dev. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/monorepos/turborepo-prisma-tasks-package) |
56-
| [Vercel AI SDK image generator](/guides/example-projects/vercel-ai-sdk-image-generator) | Use the Vercel AI SDK to generate images from a prompt. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/vercel-ai-sdk-image-generator) |
57-
| [Vercel AI SDK deep research agent](/guides/example-projects/vercel-ai-sdk-deep-research) | Use the Vercel AI SDK to generate comprehensive PDF reports using a deep research agent. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/vercel-ai-sdk-deep-research-agent) |
46+
| Example project | Description | Framework | GitHub |
47+
| :-------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------- | :-------- | :------------------------------------------------------------------------------------------------------------- |
48+
| [Batch LLM Evaluator](/guides/example-projects/batch-llm-evaluator) | Evaluate multiple LLM models and stream the results to the frontend. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/batch-llm-evaluator) |
49+
| [Claude thinking chatbot](/guides/example-projects/claude-thinking-chatbot) | Use Vercel's AI SDK and Anthropic's Claude 3.7 model to create a thinking chatbot. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/claude-thinking-chatbot) |
50+
| [Human-in-the-loop workflow](/guides/example-projects/human-in-the-loop-workflow) | Create audio summaries of newspaper articles using a human-in-the-loop workflow built with ReactFlow and Trigger.dev waitpoint tokens. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/article-summary-workflow) |
51+
| [OpenAI Agents SDK for Python guardrails](/guides/example-projects/openai-agent-sdk-guardrails) | Use the OpenAI Agents SDK for Python to create a guardrails system for your AI agents. || [View the repo](https://github.com/triggerdotdev/examples/tree/main/openai-agent-sdk-guardrails-examples) |
52+
| [OpenAI Agents SDK for TypeScript playground](/guides/example-projects/openai-agents-sdk-typescript-playground) | A playground containing 7 AI agents using the OpenAI Agents SDK for TypeScript with Trigger.dev. || [View the repo](https://github.com/triggerdotdev/examples/tree/main/openai-agents-sdk-with-trigger-playground) |
53+
| [Python web crawler](/guides/python/python-crawl4ai) | Use Python, Crawl4AI and Playwright to create a headless web crawler with Trigger.dev. || [View the repo](https://github.com/triggerdotdev/examples/tree/main/python-crawl4ai) |
54+
| [Realtime CSV Importer](/guides/example-projects/realtime-csv-importer) | Upload a CSV file and see the progress of the task streamed to the frontend. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/realtime-csv-importer) |
55+
| [Realtime Fal.ai image generation](/guides/example-projects/realtime-fal-ai) | Generate an image from a prompt using Fal.ai and show the progress of the task on the frontend using Realtime. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/realtime-fal-ai-image-generation) |
56+
| [Turborepo monorepo with Prisma](/guides/example-projects/turborepo-monorepo-prisma) | Use Prisma in a Turborepo monorepo with Trigger.dev. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/monorepos/turborepo-prisma-tasks-package) |
57+
| [Vercel AI SDK image generator](/guides/example-projects/vercel-ai-sdk-image-generator) | Use the Vercel AI SDK to generate images from a prompt. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/vercel-ai-sdk-image-generator) |
58+
| [Vercel AI SDK deep research agent](/guides/example-projects/vercel-ai-sdk-deep-research) | Use the Vercel AI SDK to generate comprehensive PDF reports using a deep research agent. | Next.js | [View the repo](https://github.com/triggerdotdev/examples/tree/main/vercel-ai-sdk-deep-research-agent) |
5859

5960
## Example tasks
6061

0 commit comments

Comments
 (0)