Repository navigation
feat(showcase): add OpenAI Agents SDK (Python) integration - #8242
Conversation
A FastAPI server for the OpenAI Agents SDK (Python), one AG-UI endpoint per demo, served by the ag-ui-openai-agents adapter from PyPI. Each demo is a plain module-level Agent wrapped in OpenAIAgentsAgent. Two small subclasses cover what the adapter leaves to the app: SchedulerAgent hands the picked time to the paused tool, and DocumentStreamingAgent streams the document argument into state while the model writes it. Includes the package manifest, Dockerfile and Python tests (a scripted model drives the real SDK and adapter).
The Next.js frontend: the shared demo pages, one CopilotKit runtime route per agent group mapping each agent name to its path on the agent server, and the interrupt pages answering approvals with {approved, ...pick}.
Playwright specs for the package and per-slug aimock fixtures for every D6 pill. The interrupt cancel legs are keyed on the tool result saying "not approved".
Adds the slug to the shared package registry, local ports (3122), compose, the canonical CopilotKit pins, the demo region guard and the A2UI recovery probe prompts, plus its shell logo. The script tests' expected counts follow.
Adds the package to the showcase build check and to the on-demand e2e workflow, where its agent server reads the aimock base URL from OPENAI_BASE_URL.
|
Important Review skippedIgnore keyword(s) in the title. ⛔ Ignored keywords: 4
Please check the settings in the CodeRabbit UI or the
|
Production Digest-Pinning AuditAll 43 services digest-pinned. Run 2026-11-10 06:00:25 PST — 0 finding(s). |
|
Size Change: 0 B Total Size: 2.47 MB ℹ️ View Unchanged
|
Adds the package's next.config.ts to the build config allowlist and its framework (openai-agents) to the compatibility mapping, with the AG-UI adapter excluded the way google-antigravity's is. The dashboard's mapping tests and the shell-docs count of bundled declarative-hashbrown demos follow.
Follows a358fa0, which moved the OpenAI-backed integrations to gpt-6-luna. OPENAI_MODEL now defaults to gpt-6-luna. The chat agents, the sub-agents and the A2UI render call run it with reasoning off (chat_settings() / CHAT_REASONING in _common.py), and the reasoning demos keep low effort with summaries. A different OPENAI_MODEL keeps the API's default effort, since not every model takes one.
The staging service exists (showcase-openai-agents-python, staging instance only, configured like showcase-ag2 with OPENAI_BASE_URL on the env-local aimock). This wires it in: - showcase_build.yml: dispatch option, path filter and ALL_SERVICES row, so pushes to main build the image and redeploy the staging instance. - railway-envs.ts: a staging-only SSOT entry, plus the regenerated JSON and golden fixture. - Fleet-count tests move by one (52 services, one more CI-built and redeployed staging target). Adding a service changes DISPOSABLE_LIFECYCLE_POLICY, whose permanent services come from SERVICES. railway-lifecycle-records.test.ts fails on purpose until that policy change is reviewed; it is left unchanged here.
|
@contextablemark I need your call on the lifecycle policy before this can merge. 301cfa5 adds
Nothing else in the policy changes: same project, same forbidden environments, same approved images. The one difference is the added permanent service.
What I need from you:
With this change and no records file, |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/learning
@copilotkit/mcp-apps-renderer
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-components
@copilotkit/web-inspector
commit: |
|
@mme thanks, this was exactly the right call to raise. Revised again on 2026-11-10. This assumes #8287 merges before this PR. #8287 now also contains #8290, which was merged into #8287's branch rather than into
Answers:
Once you push, I'll review. |
…8290) ## Why The staging rich-thread runner (the PNI-596 test rig) is parked. In 9 dispatches it has never passed, and nothing depends on it. Today, every new Showcase service changes the disposable-lifecycle policy hash. While the Showcase checks read the runner's registry, each new service needs a hand-reviewed reader transition plus a one-off runner deploy. That is what #8242 is currently stuck on. Disconnecting the readers removes that coupling. Tracked in PNI-786 (parent PNI-783). ## What changes - **Normal reader steps no longer get the registry binding.** That binding is `SHOWCASE_DISPOSABLE_RUN_RECORDS_FILE` / `_TOKEN` and `SHOWCASE_REGISTRY_CONSUMER`. The affected steps are: - the image gate in `showcase_build.yml` and `showcase_eval-webhook_build.yml`; - the promote steps in `showcase_promote.yml` and `docs_promote.yml`. These readers now run in static-fleet mode, the documented "neither configured" path. The both-or-neither guards that are no longer needed are removed. - **The opt-in `validate_registry_only` dispatch step stays connected**, so the registry can still be checked before reconnecting. The repo variable and secret stay configured for it; nothing is deleted. - **New test in `registry-validation-workflows.test.ts`:** in these four workflows, only that validation step may reference the binding. Against main's workflows the test fails 4/4, so reconnecting a normal reader has to be a deliberate, reviewed change. - **Image gate: no exception in runner environments** (from CodeRabbit review). Without registry evidence the gate can't see recorded runs. The `starter-*` exception would then accept an unregistered starter inside a runner environment and skip its image check. `verify-railway-image-refs.ts` now also fetches environment names and grants no exception in any `rich-…` environment, whether or not the registry is connected. 4 new tests. Run offline against a 2026-11-10 snapshot of the Railway project, it reports only main's existing `showcase-openai-agents-python` failure, which #8287 fixes. This overlaps #8287 in the same function: whichever PR merges second gets rebased, and the same rule applies to #8287's broader exception. - **`showcase/scripts/railway-lifecycle.md`** gets a "Registry disconnected" section and a banner. The section covers the precondition, the staging-harness step and how to reconnect. **Safety.** Static mode grants no disposable exemptions. A leftover runner service would therefore show up as unknown and fail, so this is stricter, never looser. Precondition, checked read-only at 2026-11-10 06:52Z: all three `rich-*` Railway environments have zero service instances. ## Not in this PR: staging harness (manual, after merge) The staging `harness` Railway service reads the same three variables from its own Railway config, so a PR can't change it. They'll be removed together and the harness redeployed, step by step, after this merges. With the registry configured, a failed or mismatched read aborts all staging discovery. So the harness must be disconnected before #8242 changes the policy hash, unless #8242 carries its reader transition. ## Merge order - Independent of #8287 (the unregistered-service warning). - Once this merges and the harness is disconnected, #8242 no longer needs its `4ded…` → `5c3b…` reader transition. ## Verification - `registry-validation-workflows.test.ts` passes 9/9. The new cases fail against main's workflows. - The full `@copilotkit/showcase-scripts:test` suite passes through Nx (102 files, 3141 tests). - actionlint finds nothing new: the same 15 findings as main in these four files. - oxlint and oxfmt are clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **Updates** * Showcase image verification and promotion workflows now use static-fleet mode, disconnected from disposable-runner registry evidence. * In named Railway runner environments, unregistered starter services now fail image verification, even when a tolerated staging instance exists. The starter-service exception remains available outside runner environments. * **Documentation** * Lifecycle guidance explains the disconnection, staging-harness status, runner-environment limitations, the zero-service precondition, and steps for reconnecting. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
…opilotKit#8287) > **This PR now also contains CopilotKit#8290.** CopilotKit#8290 was stacked on this branch and merged into it on 2026-11-10, so it reaches `main` only through this PR. This PR covers PNI-785 and the workflow part of PNI-786 (parent PNI-783). ## Why Adding a Showcase service normally means creating the Railway service first and adding it to `SERVICES` afterwards. The image gate fails that in-between state as "untracked". On 2026-11-09, `showcase-openai-agents-python` was created in staging before CopilotKit#8242 registered it. That turned main red ([run 42607303530](https://github.com/CopilotKit/CopilotKit/actions/runs/42607303530)), which skipped staging redeploys and blocked other work. Separately, every new Showcase service changes the disposable-lifecycle policy hash. While the Showcase checks read the parked rich-thread runner's registry, each new service needs a hand-reviewed reader transition plus a one-off runner deploy, and that is what CopilotKit#8242 is stuck on. The runner (the PNI-596 test rig) has 0 successful runs in 9 dispatches, and nothing depends on it. ## What changes **1. Unregistered staging/prod services warn instead of failing** (`verify-railway-image-refs.ts`, PNI-785) - A service with an instance in staging or prod but no `SERVICES` entry prints `⚠ WARN unregistered Railway service "<name>" (<id>) in <env>` plus a GitHub `::warning::`. It passes with no image check. - Its copies in other environments pass too, because docs-preview (`CopilotKit-pr-*`) environments copy staging. - These still fail: - a service with no staging or prod instance; - a registered name with a different ID, or a registered ID under a new name; - a recorded disposable environment, or a service a disposable run claims; - invalid lifecycle evidence; - image violations on registered services. - `showcase/RAILWAY.md` now says registering a service is safe in either order. **2. Workflow readers disconnected from the runner registry** (PNI-786, from CopilotKit#8290) - The image gate in `showcase_build.yml` and `showcase_eval-webhook_build.yml`, and the normal promote steps in `showcase_promote.yml` and `docs_promote.yml`, no longer receive these settings: - `SHOWCASE_DISPOSABLE_RUN_RECORDS_FILE` - `SHOWCASE_DISPOSABLE_RUN_RECORDS_TOKEN` - `SHOWCASE_REGISTRY_CONSUMER` - Those readers now run in the documented not-connected (static-fleet) mode. Static mode grants no disposable exemptions, so it is stricter, never looser. - The opt-in `validate_registry_only` dispatch step stays connected. The repo variable and secret stay configured for it; nothing is deleted. - A test in `registry-validation-workflows.test.ts` enforces that only that step uses the binding. - `showcase/scripts/railway-lifecycle.md` gets a "Registry disconnected" section: the precondition, the staging-harness step, and how to reconnect. **3. No exception inside runner environments** (from CodeRabbit review on CopilotKit#8290) - Without registry evidence, the gate can't see recorded runs. So it now also fetches environment names and grants no exception (neither the `starter-*` one nor the new one) in any `rich-…` environment, whether or not the registry is connected. No lifecycle-policy or hash change. ## Staging harness: already disconnected (outside this PR) The staging `harness` Railway service read the same three variables from its own Railway settings. On 2026-11-10 at 07:32Z, they were removed together and the harness was redeployed with the same image. Smoke at 07:35Z: 22/24 passing, which matches the baseline, with `discoveryFailed=false` and no lifecycle lines. The pre-change values and restore source are in PNI-786. So once this merges, no Showcase reader reads the runner registry. CopilotKit#8242 still needs its `4ded…` → `5c3b…` transition, but only because its own lifecycle tests pin the committed policy hash. Precondition, checked read-only at 2026-11-10 07:30Z: all three `rich-*` environments have zero service instances. ## Verification - `@copilotkit/showcase-scripts:test` passes through Nx (102 files, 3154 tests). - Mutation checks: - The new workflow test fails 4/4 against main's workflows. - Removing the runner-environment rule fails 4 tests. - I ran the gate offline against a 2026-11-10 Railway project snapshot: - main's gate fails with `untracked: showcase-openai-agents-python`, matching CI; - this branch passes, with one warning for that service in staging and two docs-preview environments. - oxlint and oxfmt are clean. - actionlint adds no findings beyond main's in the four workflows. - The only `tsc` errors are in `shell-dashboard/scripts/compatibility-audit/xml.ts`, and they are also on main. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Adding showcase-openai-agents-python to SERVICES changes the committed lifecycle policy hash to 5c3ba2cd. The staging runner still publishes 4ded223b, the policy before docs-preview was protected. Replace the reviewed 4ded -> d3a7 pair with 4ded -> 5c3b instead of adding a second pair: no committed policy produces d3a7 any more, so a publisher still serving it is refused rather than chained. Tests cover name, ID, image and forbidden-environment protection for both docs-preview and showcase-openai-agents-python during the transition, refusal of a d3a7 publisher, and refusal of the reverse direction. The runbook section describes the new pair, and both the comment and the runbook say the exception goes with the registry reader code now that the runner is parked.
|
@contextablemark Pushed 2959bfe, on top of a merge of main that includes #8287.
Ready for your review. |
contextablemark
left a comment
There was a problem hiding this comment.
Thanks, this looks good. You swapped out the old exception instead of stacking a second one on it, which is what I was hoping for, and the tests cover both services plus the cases that should still be refused. I ran it locally against current main and everything passes. Now that the registry is disconnected, this exception mostly just keeps the test honest, so we can delete it along with the reader code later on.
## What does this PR do? Adds docs pages for the **OpenAI Agents SDK (Python)** integration, following the generated-docs pattern of the Google Antigravity pages (a9ec528). It's stacked on CopilotKit#8242, which adds the showcase package. The base is that PR's branch, so this diff shows only the docs. - **Docs mode.** The manifest's `docs_mode` goes from `hidden` to `generated`, so the integration shows up on the docs site under `/openai-agents-python`. - **Landing page.** The record is in `shell-docs/src/data/frameworks/openai-agents-python.ts` and registered in `index.ts`. It highlights generative UI, human-in-the-loop (`needs_approval`) and shared state, plus the runtime route. - **Quickstart.** `content/docs/integrations/openai-agents-python/quickstart.mdx` takes an existing agent all the way to a working chat: `OpenAIAgentsAgent` plus `add_openai_agents_fastapi_endpoint`, the runtime route and the React mount. There's no CLI starter, so there's no "start from scratch" path. A callout notes that `@ag-ui/openai-agents` exports the same client as `OpenAIAgentsHttpAgent`. - **Setup snippets.** `integrations/openai-agents-python/docs/setup/` has one snippet for each of the 11 concepts the shared pages render: agent setup, frontend tools, human-in-the-loop, shared state, state streaming, agent context, agent config, programmatic control, sub-agents, tool rendering and Channels. Each embeds live code from the package through `@region` markers. - **New regions.** Two regions back the snippets: - `shared-state-instructions` (`with_state`, the dynamic instructions that show the model the state); - `interrupt-resume-payload` (`SchedulerAgent`, which hands an approved tool the time the user picked). - **Feature links.** `docs-links.json` maps all 39 features to their pages, replacing the placeholder that said no docs existed. - **Logo.** The OpenAI mark, from Lobe Icons (`@lobehub/icons-static-svg` 1.102.0, MIT). It is added as `OpenAIIcon` in the framework icons, registered under the `openai` key and for the `openai-agents-python` slug, so the landing header and the framework switcher show it. The docs logo file uses the same mark, dark on light and white in dark mode. The snippets describe the adapter as released in `ag-ui-openai-agents` 0.1.0: - page tools become client tools on a per-request copy of the agent; - `useAgentContext` entries are appended to the instructions; - `shared_state()` streams `STATE_SNAPSHOT`s; - `needs_approval=True` becomes a `tool_approval` interrupt with a stateless resume. ## Known gaps - **Showcase logo.** The showcase site's copy of the logo (`shell/public/logos`, from CopilotKit#8242) is still the "OA" placeholder. - **Live demos.** The landing page has no live-demo iframe until the package is deployed (`deployed: false`). ## Related PRs and Issues - Showcase package (base of this PR): CopilotKit#8242 - Adapter: ag-ui-protocol/ag-ui#2210 ## Test plan - [x] `bundle-setup-content`: all 11 concepts bundle with no unresolved `<DemoCode>` and no leaked `@region` markers. A new test in `setup-content.test.ts` checks the key code in each snippet. - [x] shell-docs vitest: 587/587. Two counts follow the new framework: channel setups go from 20 to 21, plus the new bundling test. - [x] shell-docs `tsc --noEmit` - [x] Local `next dev`: the OpenAI mark renders in the landing header and in the framework switcher, and `/logos/openai-agents-python.svg` is served as `image/svg+xml`. - [x] shell-dashboard `npm test`: 1866 passed - [x] Local `next dev`: the landing page, quickstart and the shared concept pages render with our snippets. All 30 distinct `shell_docs_path`s in `docs-links.json` return 200 under `/openai-agents-python`. - [x] `pytest tests/python`: 20 passed (the region markers are comments only) - [x] `showcase/scripts` vitest: 3180/3180 - [ ] CI ## Checklist - [x] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` and the description has a `BREAKING CHANGE:` line (not breaking) - [x] "Allow edits by maintainers" is checked <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Added an OpenAI Agents SDK (Python) integration overview with supported capabilities, a connection example, and links to setup guides. * Listed the integration in the framework directory with its own icon. * **Documentation** * Added a quickstart and setup guides covering agent configuration, context, Channels, frontend tools, approvals, programmatic control, shared state, streaming, sub-agents, and tool rendering. * Added documentation links for integration features. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
What does this PR do?
Adds the OpenAI Agents SDK (Python) showcase package,
showcase/integrations/openai-agents-python. It runs on the AG-UI adapterag-ui-openai-agents0.1.0 from PyPI, released today from ag-ui-protocol/ag-ui#2210.POST /<name>. Each demo is a plain module-levelAgentwrapped in the adapter'sOpenAIAgentsAgent. The Next runtime routes map each agent name to its path. Inboundx-*mock and diagnostic headers are copied onto every model call, andx-aimock-contextis fixed to the slug.cli-startis the only feature not supported, because there is no CLI starter yet.resumeentries, gives tools the run's state throughshared_state(), keeps reasoning inMESSAGES_SNAPSHOT, and passes the page's tools to the model as client tools.OpenAIAgentsAgentcover what the adapter leaves to the app:SchedulerAgent(gen-ui-interrupt, interrupt-headless) hands the picked time from the resume payload to the pausedschedule_meetingcall.DocumentStreamingAgent(shared-state-streaming) streams thewrite_documentargument into state while the model writes it.gpt-6-luna. The chat agents, the sub-agents and the A2UI render call run with reasoning off (chat_settings()in_common.py), and the reasoning demos keep low effort with summaries.deployed: falseuntil a prod instance exists. The Railway serviceshowcase-openai-agents-pythonexists in staging, configured likeshowcase-ag2withOPENAI_BASE_URLon the env-local aimock. A later commit wires it intoshowcase_build.ymlandrailway-envs.ts, so a push to main builds the image and redeploys it.Commits are split by area: agent server, demo app, e2e and D6 fixtures, registration, CI, docs. Later commits add what the first CI run caught (the config allowlist entry, the compatibility mapping and two count tests), the switch to GPT-6 Luna, the Railway staging wiring and the lifecycle policy bridge.
Known gaps
google-antigravity. On that version, 4 declarative-gen-ui Playwright tests fail because they need thedata-message-roleattribute from a newer react-core.Related PRs and Issues
ag-ui-openai-agents0.1.0 on PyPI)Test plan
bin/showcase test openai-agents-python --d6 --isolate --rebuildon the rebased branch: 43/43 status records green (42 cells plus the slug aggregate); all 149 aimock calls matched a fixtureAIMOCK_STRICT_TURN_INDEX=1, uvicorn on the PyPI adapter,next start): 188 passed, 2 skipped, 4 failed. All 4 failures are the declarative-gen-uidata-message-roletests described above.showcase/scriptsvitest after merging main (with fix(showcase): warn on unregistered services, unbind runner registry #8287) and adding the lifecycle bridge: 3214/3214. Putting the oldd3a7…validator back turns 12 tests red. oxfmt, oxlint and harnesstscare clean.validate-manifests,validate-routesnpm test: 1866 passed (the compatibility mapping gainsopenai-agents, with the adapter excluded).github/scripts/check-config-allowlist.sh: the package'snext.config.tsis on the allowlistpytest tests/python: 20 passed againstag-ui-openai-agents==0.1.0from PyPIgpt-6-lunawithreasoning: {effort: "none"}for chat agents, sub-agents and the A2UI call, andeffort: "low", summary: "auto"for the reasoning demo. aimock's journal doesn't recordreasoning, so this was checked against a stub transport.verify-railway-image-refs.tsagainst live Railway with no records file: 87 env-scoped instances verified.emit-railway-envs-json --checkandsync-promote-service-options --checkare up to date.Checklist
!and the description has aBREAKING CHANGE:line (not breaking)