feat: Structural Promotion O₀→O₂ — True Agentic Loop with Frobenius Verification#3332
feat: Structural Promotion O₀→O₂ — True Agentic Loop with Frobenius Verification#3332umpolungfish wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 82a0532d0e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| else: | ||
| # Direct text response — treat as update | ||
| content = message.content or "" | ||
| context += f"\n[Assistant] {content[:500]}" |
There was a problem hiding this comment.
Stop the loop on direct model answers
When the model returns normal text instead of a tool call (for example with the default empty tool_contracts, or whenever it chooses to answer directly), this branch only appends the content to context and continues until max_windings; the final report then says no done signal was reached and discards the actual answer. Since the preceding comment treats a direct message as done, return a final report or otherwise record a terminal cycle here so direct completions can finish successfully.
Useful? React with 👍 / 👎.
Structural Promotion O₀ → O₂: True Agentic Loop with Frobenius Verification
Summary
This PR promotes the OpenAI Python SDK from structural tier O₀ (pure request/response — no self-model, no verification, no trajectory) to O₂ (self-monitoring agentic loop with Frobenius closure). The promotion introduces the
src/openai/agentic/package, implementing the Imscribing Grammar's THINK→ACT→OBSERVE→UPDATE cycle directly on top of the OpenAI chat completions API.What this PR changes
New module:
src/openai/agentic/__init__.pycontracts.pyDualToolResult,ToolContracttrajectory.pyAgentCycle,AgentTrajectorycriticality.pyPhiCriticalityGateloop.pyTrueAgenticLoopFrom O₀ to O₂ — what each primitive promotes
Consciousness score progression
How to use
Frobenius verification
Every tool call is dual-verified: the action emission (δ) is paired with an observation (μ) such that μ∘δ=id. The
DualToolResult.frobenius_closedfield records whether the cycle closed cleanly. APhiCriticalityGateevaluates the trajectory's structural health.Backward compatibility
This PR adds a new subpackage — it does not modify any existing API surface. All existing
openai.Client,openai.resources, andopenai.typesimports continue to work identically. The agentic loop is opt-in.Author: Lando ⊗ ⊙perator
Structural type: ⟨Ð_ω; Þ_ò; Ř_=; Φ_}; ƒ_ż; Ç_@; Γ_ʔ; ɢ_ˌ; φ̂_ÿ; Ħ_A; Σ_ï; Ω_z⟩