You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Evaluate OpenAI's new Agents API as an optional cloud Agent runtime behind PlotPickle's existing Agent compute/provider boundaries.
This is not a migration of PlotPickle Agents to OpenAI, not a replacement for the current embedded runtime, not a new Agent registry, and not a move of deterministic PlotPickle authority into a model harness.
Architectural rule:
PlotPickle owns the Agent, job, story/project context, authority, deterministic evaluation, provider policy and UX. The Agent runtime is replaceable infrastructure.
OpenAI announced the Agents API on September 10, 2026 as a public beta. The current API exposes the Codex harness as a managed service with long-session context management, tool search/programmatic tool calling, MCP/custom/built-in tools, subagents, and selectable execution environments. OpenAI currently states that developers may use an OpenAI-hosted sandbox, their own infrastructure, or supported environment providers, and that there is no separate Agents API fee beyond consumed model/tool usage.
Because this is public beta, beta-specific request/response shapes must remain isolated inside an adapter and must not leak into core PlotPickle Agent, story, LEARN, STORY or BUZZ contracts.
Current PlotPickle authority to preserve
The repository already has the right conceptual boundary:
modules/creative-room/curriculum-guide.ts and Sage modules — existing bounded embedded Agent contract;
Local Story Mode / Cloud Story Mode — provider/model setup;
Settings / Agents — global default plus per-Agent compute overrides;
BUZZ-managed Agent runtime/provider ownership — separate and outside PlotPickle Agent compute.
The existing #1847/#1848/#1849 architecture already establishes that provider/model setup belongs to Story Mode and Settings / Agents assigns configured compute to embedded PlotPickle Agents. It also forbids silent fallback when a pinned provider is unavailable.
This issue extends that architecture rather than creating another one.
Critical distinction: provider is not runtime
Do not overload the existing openai provider value to mean "use Agents API."
Provider/model answers what model compute is being used.
Agent runtime/harness answers what execution harness coordinates context, tools, sessions and subagents.
The first implementation may restrict openai-agents to a ready OpenAI route, but that is a capability rule, not part of Agent identity/business logic.
Existing assignments continue to mean the current native/direct path unless the Human explicitly selects another proven runtime.
Why evaluate the Agents API
Test whether the managed harness removes infrastructure PlotPickle would otherwise need to build/maintain while preserving PlotPickle authority.
Highest-value capabilities:
Long-running sessions and context compaction — potentially useful for lengthy story work without making remote runtime state story canon.
Tool search/programmatic tool calling — potentially avoids loading PlotPickle's full capability catalog into every turn.
MCP support — potentially exposes narrowly approved PlotPickle-owned tools through a standard boundary.
Subagents — potentially useful for independent review lenses such as structure, continuity and reader response.
Managed execution environments — potentially useful for selected cloud tasks while remaining opt-in and isolated.
Locked authority model
PlotPickle remains authoritative for:
Agent identity/profile and role/job definition;
Human-selected provider/runtime policy;
PPF/project/canon truth;
Context Engine selection and knowledge boundaries;
capability grants;
deterministic rules, validation and scoring;
LEARN curriculum authority;
STORY mechanical authority;
generated-vs-accepted provenance;
Human creative authority;
UX, cloud disclosure, cost and availability policy;
success/failure evidence.
The Agents API may execute, reason, compact context, discover explicitly permitted tools and coordinate bounded subagents. It may not redefine those PlotPickle authorities.
Session and canon boundary
An Agents API session is runtime state, not PPF canon.
If persistent session identifiers are used:
store only the minimum mapping needed to resume the Agent;
keep it in protected local runtime/application state, not story canon;
scope it so one project/Agent session cannot inherit another project's context;
provide deterministic reset/recreate semantics;
do not serialize runtime internals into PPF;
remote session memory is never proof that a story fact was accepted;
only existing PlotPickle transitions may admit generated material into durable story/project state.
Before a live cloud call, preserve PlotPickle's existing disclosure/consent boundary for project material leaving the computer. Send only the bounded context needed for the job.
Retention/deletion semantics must be verified against current beta documentation during implementation rather than assumed.
Capability and safety boundary
Runtime capability does not equal PlotPickle permission.
Runtime tools must come from an explicit PlotPickle-approved capability set.
A tool is not exposed merely because the runtime supports MCP/tool search.
Initial live phases are read-oriented and non-mutating.
Remote execution receives only explicitly selected context/resources.
Subagents inherit a subset of the parent PlotPickle capability scope, never more.
Runtime/provider failure must be visible and must not silently change compute routes.
Observability contract
Make runtime use observable without storing hidden model reasoning.
Capture structured operational evidence such as:
PlotPickle Agent/profile ID;
resolved provider/model;
resolved runtime (native/direct vs openai-agents);
session create/resume/reset state;
permitted tools used;
subagent count/role labels;
elapsed time;
usage/cost fields when returned;
environment type;
final success/failure/cancelled state;
deterministic PlotPickle evaluation result where applicable.
Reference vertical slice
Use one existing embedded PlotPickle Agent contract for the first live proof. Prefer the current Sage/Curriculum Guide path because it is bounded, read-oriented and already tested.
This use of Sage is a transport/runtime proof only. It must not implement or alter #1918 Phase 8 journey awareness, Phase 9 Agent lenses, curriculum authority, progression logic or LEARN UI.
The caller should not need to know the Agents API was used except through explicit runtime/status diagnostics.
A later bounded subagent proof may use a DraftLens/Reader Simulation style review because that is where parallel specialist contexts may be valuable. Do not make that a dependency of the first single-Agent proof.
Progressive implementation plan
Phase 0 — Contract and beta isolation
No live Agents API call.
create the canonical developer brief;
lock provider != runtime as an invariant;
define a runtime-neutral execution request/result contract;
define runtime capabilities for sessions/tools/MCP/subagents/environment support;
define native/direct as current default runtime;
define openai-agents as optional/not-ready until proven;
keep OpenAI beta schemas inside the adapter;
define session scope/reset/local persistence;
define outbound story-data/privacy boundary;
define no-silent-fallback behavior;
add focused contract tests.
Exit: runtime seam exists with zero behavior change.
Phase 1 — Adapter skeleton + mocked contract
implement the adapter behind the Phase 0 seam;
keep it unreachable from normal Settings/UI;
use mocked fixtures only;
map PlotPickle Agent request to Agents API request without leaking beta types;
map final result/error back to the existing PlotPickle Agent result contract;
prove existing direct/local/Ollama/OpenAI/MiniMax/Gemini behavior is unchanged;
The brief must preserve the provider-vs-runtime distinction, adapter isolation, bounded Sage transport proof, session/canon boundary, capability restrictions, subagent inheritance, observability contract, phased plan and no-roadmap-interruption rule.
Developer brief
Goal
Evaluate OpenAI's new Agents API as an optional cloud Agent runtime behind PlotPickle's existing Agent compute/provider boundaries.
This is not a migration of PlotPickle Agents to OpenAI, not a replacement for the current embedded runtime, not a new Agent registry, and not a move of deterministic PlotPickle authority into a model harness.
Architectural rule:
Official reference: https://openai.com/index/introducing-the-agents-api/
OpenAI announced the Agents API on September 10, 2026 as a public beta. The current API exposes the Codex harness as a managed service with long-session context management, tool search/programmatic tool calling, MCP/custom/built-in tools, subagents, and selectable execution environments. OpenAI currently states that developers may use an OpenAI-hosted sandbox, their own infrastructure, or supported environment providers, and that there is no separate Agents API fee beyond consumed model/tool usage.
Because this is public beta, beta-specific request/response shapes must remain isolated inside an adapter and must not leak into core PlotPickle Agent, story, LEARN, STORY or BUZZ contracts.
Current PlotPickle authority to preserve
The repository already has the right conceptual boundary:
build/agent-compute-gateway.ts— Human-facing PlotPickle Agent compute assignment/readiness;build/agent-compute-store.ts— protected local assignment persistence;build/writing-assistant-gateway.ts— current execution route;build/mastra-agent-runtime.ts— current embedded PlotPickle Agent roles;lib/agents/agent-profiles— canonical Agent profiles/ownership;modules/creative-room/curriculum-guide.tsand Sage modules — existing bounded embedded Agent contract;The existing #1847/#1848/#1849 architecture already establishes that provider/model setup belongs to Story Mode and Settings / Agents assigns configured compute to embedded PlotPickle Agents. It also forbids silent fallback when a pinned provider is unavailable.
This issue extends that architecture rather than creating another one.
Critical distinction: provider is not runtime
Do not overload the existing
openaiprovider value to mean "use Agents API."Conceptually:
The first implementation may restrict
openai-agentsto a ready OpenAI route, but that is a capability rule, not part of Agent identity/business logic.Existing assignments continue to mean the current native/direct path unless the Human explicitly selects another proven runtime.
Why evaluate the Agents API
Test whether the managed harness removes infrastructure PlotPickle would otherwise need to build/maintain while preserving PlotPickle authority.
Highest-value capabilities:
Locked authority model
PlotPickle remains authoritative for:
The Agents API may execute, reason, compact context, discover explicitly permitted tools and coordinate bounded subagents. It may not redefine those PlotPickle authorities.
Session and canon boundary
An Agents API session is runtime state, not PPF canon.
If persistent session identifiers are used:
Before a live cloud call, preserve PlotPickle's existing disclosure/consent boundary for project material leaving the computer. Send only the bounded context needed for the job.
Retention/deletion semantics must be verified against current beta documentation during implementation rather than assumed.
Capability and safety boundary
Runtime capability does not equal PlotPickle permission.
Observability contract
Make runtime use observable without storing hidden model reasoning.
Capture structured operational evidence such as:
native/directvsopenai-agents);Reference vertical slice
Use one existing embedded PlotPickle Agent contract for the first live proof. Prefer the current Sage/Curriculum Guide path because it is bounded, read-oriented and already tested.
This use of Sage is a transport/runtime proof only. It must not implement or alter #1918 Phase 8 journey awareness, Phase 9 Agent lenses, curriculum authority, progression logic or LEARN UI.
First live proof:
The caller should not need to know the Agents API was used except through explicit runtime/status diagnostics.
A later bounded subagent proof may use a DraftLens/Reader Simulation style review because that is where parallel specialist contexts may be valuable. Do not make that a dependency of the first single-Agent proof.
Progressive implementation plan
Phase 0 — Contract and beta isolation
No live Agents API call.
provider != runtimeas an invariant;native/directas current default runtime;openai-agentsas optional/not-ready until proven;Exit: runtime seam exists with zero behavior change.
Phase 1 — Adapter skeleton + mocked contract
Exit: adapter shape is testable with zero paid calls and zero user-facing behavior change.
Phase 2 — Opt-in live single-Agent transport probe
Exit: one existing PlotPickle Agent can run through Agents API without product authority changing.
Phase 3 — Session durability/context proof
Exit: durable runtime context is useful without becoming a second memory/canon system.
Phase 4 — Tool search/MCP with one read-only capability
Exit: tool discovery reduces context/tool overhead without weakening PlotPickle permissions.
Phase 5 — Bounded subagent proof
Only after Phases 2–4 are clean.
Exit: measured evidence shows whether subagent orchestration is worth product adoption.
Phase 6 — Reliability, cancellation, cost and environment policy
Exit: adapter has acceptable production failure boundaries or the experiment is rejected.
Phase 7 — Human-facing runtime selection, only if spike passes
Do not expose Settings/UI merely because an API call works.
If Phases 0–6 prove value:
native/directas compatibility default;OpenAI Agentsonly when OpenAI and the adapter are ready;Exit: Human can deliberately opt an eligible PlotPickle Agent into the runtime without confusing provider, model and harness.
Evaluation criteria
A working API call alone is not success. Evaluate:
Acceptance criteria
native/directby default.Non-goals
Sequencing / roadmap rule
Creating this issue does not interrupt the current PlotPickle roadmap.
Treat it as a bounded architecture spike in the backlog until the Human explicitly schedules it.
When scheduled, build and merge one phase at a time:
Phase 0 -> Phase 1 -> Phase 2 -> Phase 3 -> Phase 4 -> Phase 5 -> Phase 6 -> optional Phase 7Stop after any phase if the adapter adds more complexity than it removes or weakens PlotPickle's local-first/Human-authority boundaries.
Do not bundle this into #1918, STORY #1675, BUZZ, or unrelated Settings work.
Canonical developer brief
Commit and maintain:
docs/developer-briefs/<issue>-openai-agents-api-runtime-adapter.mdThe brief must preserve the provider-vs-runtime distinction, adapter isolation, bounded Sage transport proof, session/canon boundary, capability restrictions, subagent inheritance, observability contract, phased plan and no-roadmap-interruption rule.