AI-266: Add @temporalio/openai-agents sample suite#479
Conversation
|
Semgrep found 14
Risk: Affected versions of nanoid are vulnerable to Exposure of Sensitive Information to an Unauthorized Actor / Incorrect Type Conversion or Cast. nanoid is vulnerable to information exposure (CVE-2021-23566). Passing a non-integer object with a crafted valueOf() method as the size argument to nanoid(), or to the generators returned by customAlphabet() and customRandom(), tricks the internal random-byte pool into reusing previously generated bytes, allowing a prior ID to be reproduced. Upgrade to nanoid >= 3.1.31. Fix: Upgrade this library to at least version 3.1.31 at samples-typescript/pnpm-lock.yaml:13366. Reference(s): GHSA-qrpm-p2h7-hrv2, CVE-2021-23566 |
Fourteen self-contained samples demonstrating how to run OpenAI Agents SDK agents as Temporal Workflows with the @temporalio/openai-agents integration: the basic building blocks, handoffs, agent patterns, sessions, human approval, hosted/Nexus/MCP tools, tracing, model providers, reasoning content, a research bot, and a customer-service chat. Each sample is a standalone package with a fake-model Worker test that runs without an API key, and the suite is wired into the pnpm workspace, CI, and the samples list.
643db6d to
d33a6dc
Compare
Move each scenario from openai-agents/<feature>/src/ to openai-agents/src/<feature>/, letting the package use the shared tsconfig (removed from TSCONFIG_EXCLUDE). Rename two scenarios to feature-based names: research-bot -> multi-agent, customer-service -> stateful-conversation. Add an Ollama start snippet to the model-providers README.
# Conflicts: # pnpm-lock.yaml
There was a problem hiding this comment.
Pull request overview
Adds a new openai-agents/ sample suite demonstrating how to run OpenAI Agents SDK agents durably via Temporal using @temporalio/openai-agents, and wires it into the repository’s sample index and CI.
Changes:
- Add the
openai-agents/project (multiple scenario sub-samples with Workers/clients/tests and supporting MCP servers). - Update root docs and sample registry to surface the new “AI / LLM” section and the OpenAI Agents suite.
- Update pnpm workspace/lockfile and CI to install, build, and test the new sample.
Reviewed changes
Copilot reviewed 116 out of 117 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| README.md | Adds “AI / LLM” section and links to the OpenAI Agents samples. |
| pnpm-workspace.yaml | Adds a workspace glob for openai-agents/*. |
| pnpm-lock.yaml | Adds dependencies for the new openai-agents importer and updates related transitive deps. |
| .scripts/list-of-samples.json | Registers openai-agents in the sample list. |
| .scripts/copy-shared-files.mjs | Excludes openai-agents from shared ESLint config copying. |
| .github/workflows/ci.yml | Adds openai-agents to the CI build/test loop. |
| openai-agents/README.md | Documents the suite and links to each scenario. |
| openai-agents/package.json | Defines dependencies/devDependencies and build/lint/test scripts for the suite. |
| openai-agents/tsconfig.json | TypeScript config for building the suite. |
| openai-agents/.prettierrc | Prettier config for the suite. |
| openai-agents/.prettierignore | Ignores build output for formatting. |
| openai-agents/.post-create | Post-create setup instructions for the suite. |
| openai-agents/.nvmrc | Pins Node major version for local dev. |
| openai-agents/.npmrc | Disables package-lock generation. |
| openai-agents/.gitignore | Ignores lib/ and node_modules/. |
| openai-agents/.eslintrc.js | ESLint rules + workflow import restrictions for the suite. |
| openai-agents/.eslintignore | Ignores generated and config files for ESLint. |
| openai-agents/src/basic/README.md | Scenario docs for “basic”. |
| openai-agents/src/basic/activities.ts | Basic sample Activities. |
| openai-agents/src/basic/workflows.ts | Basic sample Workflows (tools, context, structured output, etc.). |
| openai-agents/src/basic/worker.ts | Worker entrypoint for “basic”. |
| openai-agents/src/basic/client.ts | Client entrypoint for “basic”. |
| openai-agents/src/basic/mocha/fake-model.ts | Offline fake model for “basic” tests. |
| openai-agents/src/basic/mocha/workflows.test.ts | Tests for “basic” scenarios. |
| openai-agents/src/handoffs/README.md | Scenario docs for “handoffs”. |
| openai-agents/src/handoffs/activities.ts | Handoffs sample Activities. |
| openai-agents/src/handoffs/workflows.ts | Handoffs sample Workflows. |
| openai-agents/src/handoffs/worker.ts | Worker entrypoint for “handoffs”. |
| openai-agents/src/handoffs/client.ts | Client entrypoint for “handoffs”. |
| openai-agents/src/handoffs/mocha/fake-model.ts | Offline fake model for “handoffs” tests. |
| openai-agents/src/handoffs/mocha/workflows.test.ts | Tests for “handoffs” scenarios. |
| openai-agents/src/agent-patterns/README.md | Scenario docs for “agent-patterns”. |
| openai-agents/src/agent-patterns/workflows.ts | Pattern Workflows (parallelization, judge loops, guardrails, etc.). |
| openai-agents/src/agent-patterns/worker.ts | Worker entrypoint for “agent-patterns”. |
| openai-agents/src/agent-patterns/client.ts | Client entrypoint for “agent-patterns”. |
| openai-agents/src/agent-patterns/mocha/fake-model.ts | Offline fake model for “agent-patterns” tests. |
| openai-agents/src/agent-patterns/mocha/workflows.test.ts | Tests for “agent-patterns”. |
| openai-agents/src/sessions/README.md | Scenario docs for “sessions”. |
| openai-agents/src/sessions/activities.ts | Sessions sample Activities. |
| openai-agents/src/sessions/workflows.ts | Session-based Workflows + continue-as-new carryover. |
| openai-agents/src/sessions/worker.ts | Worker entrypoint for “sessions”. |
| openai-agents/src/sessions/client.ts | Client entrypoint for “sessions”. |
| openai-agents/src/sessions/mocha/fake-model.ts | Offline fake model for “sessions” tests. |
| openai-agents/src/sessions/mocha/workflows.test.ts | Tests for “sessions”. |
| openai-agents/src/human-approval/README.md | Scenario docs for “human-approval”. |
| openai-agents/src/human-approval/activities.ts | Placeholder Activities for worker wiring. |
| openai-agents/src/human-approval/workflows.ts | Approval/interruptions + continue-as-new workflow. |
| openai-agents/src/human-approval/worker.ts | Worker entrypoint for “human-approval”. |
| openai-agents/src/human-approval/client.ts | Client entrypoint for “human-approval”. |
| openai-agents/src/human-approval/mocha/fake-model.ts | Offline fake model for “human-approval” tests. |
| openai-agents/src/human-approval/mocha/workflows.test.ts | Tests for “human-approval”. |
| openai-agents/src/tools/README.md | Scenario docs for hosted tools. |
| openai-agents/src/tools/workflows.ts | Hosted tools Workflows (web search / image gen / code interpreter). |
| openai-agents/src/tools/worker.ts | Worker entrypoint for hosted tools. |
| openai-agents/src/tools/client.ts | Client entrypoint for hosted tools. |
| openai-agents/src/tools/mocha/fake-model.ts | Offline fake model for hosted tools tests. |
| openai-agents/src/tools/mocha/workflows.test.ts | Tests for hosted tools wiring. |
| openai-agents/src/tracing/README.md | Scenario docs for tracing modes. |
| openai-agents/src/tracing/recording-processor.ts | Custom TracingProcessor used by sample/test. |
| openai-agents/src/tracing/workflows.ts | Workflow exercising traced agent + tool span. |
| openai-agents/src/tracing/worker.ts | Worker entrypoint configuring tracing modes. |
| openai-agents/src/tracing/client.ts | Client entrypoint for tracing scenario. |
| openai-agents/src/tracing/mocha/fake-model.ts | Offline fake model for tracing tests. |
| openai-agents/src/tracing/mocha/workflows.test.ts | Tests for custom tracing processor capture. |
| openai-agents/src/model-providers/README.md | Scenario docs for custom model provider. |
| openai-agents/src/model-providers/workflows.ts | Workflow demonstrating per-run model override with injected provider. |
| openai-agents/src/model-providers/worker.ts | Worker entrypoint for custom provider scenario. |
| openai-agents/src/model-providers/client.ts | Client entrypoint for custom provider scenario. |
| openai-agents/src/model-providers/mocha/fake-model.ts | Offline fake model for model-provider tests. |
| openai-agents/src/model-providers/mocha/workflows.test.ts | Tests for injected provider usage/model selection. |
| openai-agents/src/reasoning-content/README.md | Scenario docs for reasoning summaries via Responses API. |
| openai-agents/src/reasoning-content/activities.ts | Activity calling openai Responses API and extracting reasoning summary + content. |
| openai-agents/src/reasoning-content/workflows.ts | Workflow that proxies the reasoning Activity. |
| openai-agents/src/reasoning-content/worker.ts | Worker entrypoint for reasoning-content scenario. |
| openai-agents/src/reasoning-content/client.ts | Client entrypoint for reasoning-content scenario. |
| openai-agents/src/reasoning-content/mocha/workflows.test.ts | Offline test via injected client factory stub. |
| openai-agents/src/mcp/README.md | Scenario docs for local MCP servers (stdio/http/sse/prompt/stateful). |
| openai-agents/src/mcp/activities.ts | Activity fetching prompt content from MCP prompt server. |
| openai-agents/src/mcp/workflows.ts | Workflows demonstrating MCP server usage patterns. |
| openai-agents/src/mcp/worker.ts | Worker that starts MCP servers and registers providers. |
| openai-agents/src/mcp/client.ts | Client entrypoint for MCP scenarios. |
| openai-agents/src/mcp/mocha/fake-model.ts | Offline fake model for MCP tests. |
| openai-agents/src/mcp/mocha/workflows.test.ts | Tests verifying MCP tool/prompt results flow back to the model. |
| openai-agents/src/mcp/servers/tools-server.ts | Streamable HTTP MCP tools server implementation. |
| openai-agents/src/mcp/servers/sse-server.ts | SSE MCP tools server implementation. |
| openai-agents/src/mcp/servers/prompt-server.ts | Streamable HTTP MCP prompt server implementation. |
| openai-agents/src/mcp/servers/notes-server.ts | In-workflow stateful MCP notes server implementation. |
| openai-agents/src/mcp/servers/filesystem-server.ts | Stdio MCP filesystem server implementation. |
| openai-agents/src/mcp/servers/sample-files/hello.txt | Sample data for filesystem MCP server. |
| openai-agents/src/mcp/servers/sample-files/notes.txt | Sample data for filesystem MCP server. |
| openai-agents/src/hosted-mcp/README.md | Scenario docs for hosted MCP tools. |
| openai-agents/src/hosted-mcp/workflows.ts | Workflows demonstrating hosted MCP tool usage with/without approval. |
| openai-agents/src/hosted-mcp/worker.ts | Worker entrypoint for hosted-mcp scenario. |
| openai-agents/src/hosted-mcp/client.ts | Client entrypoint for hosted-mcp scenario. |
| openai-agents/src/hosted-mcp/mocha/fake-model.ts | Offline fake model for hosted-mcp tests. |
| openai-agents/src/hosted-mcp/mocha/workflows.test.ts | Tests verifying hosted tool is wired and approval signal gating works. |
| openai-agents/src/multi-agent/README.md | Scenario docs for research bot (planner/search/writer). |
| openai-agents/src/multi-agent/workflows.ts | Multi-agent research workflow using Promise.all. |
| openai-agents/src/multi-agent/worker.ts | Worker entrypoint for multi-agent scenario. |
| openai-agents/src/multi-agent/client.ts | Client entrypoint for multi-agent scenario. |
| openai-agents/src/multi-agent/mocha/fake-model.ts | Offline fake model for multi-agent tests. |
| openai-agents/src/multi-agent/mocha/workflows.test.ts | Tests for multi-agent orchestration. |
| openai-agents/src/stateful-conversation/README.md | Scenario docs for update/query-driven chat workflow. |
| openai-agents/src/stateful-conversation/agents.ts | Agent/tool definitions for the stateful conversation scenario. |
| openai-agents/src/stateful-conversation/workflows.ts | Long-running update/query workflow + continue-as-new state carryover. |
| openai-agents/src/stateful-conversation/worker.ts | Worker entrypoint for stateful conversation. |
| openai-agents/src/stateful-conversation/client.ts | Interactive chat client for stateful conversation. |
| openai-agents/src/stateful-conversation/mocha/fake-model.ts | Offline fake model for stateful conversation tests. |
| openai-agents/src/stateful-conversation/mocha/workflows.test.ts | Tests for updates/handoff/history query behavior. |
| openai-agents/src/nexus-tools/README.md | Scenario docs for Nexus operation tools. |
| openai-agents/src/nexus-tools/api.ts | Nexus RPC service definition for weather operation. |
| openai-agents/src/nexus-tools/handler.ts | Service handler implementation registered with the Worker. |
| openai-agents/src/nexus-tools/workflows.ts | Workflow exposing Nexus operation as an agent tool. |
| openai-agents/src/nexus-tools/worker.ts | Worker entrypoint for nexus-tools scenario. |
| openai-agents/src/nexus-tools/client.ts | Client that ensures endpoint and starts the workflow. |
| openai-agents/src/nexus-tools/mocha/fake-model.ts | Offline fake model for nexus-tools tests. |
| openai-agents/src/nexus-tools/mocha/workflows.test.ts | Tests verifying Nexus op results reach the model. |
Files not reviewed (1)
- pnpm-lock.yaml: Generated file
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The shared post-create pointed users at `npm run start.watch`/`npm run workflow`, which don't exist in openai-agents' per-scenario layout. Exclude it from the shared copy and ship instructions matching how the sample runs.
Adds fourteen self-contained samples under
openai-agents/— the basic building blocks, handoffs, agent patterns, sessions, human approval, hosted/Nexus/MCP tools, tracing, model providers, reasoning content, a research bot, and a customer-service chat. Each is a standalone package with a fake-model Worker test that runs without an API key, and the suite is wired into the pnpm workspace, CI, and the samples list.