Repository navigation
feat(api): agent({ runtime: 'gmi' }) routing, the remaining gmi() surface and its guide - #159
Conversation
…mi' }) The remaining end-to-end cases of the GMI path, written against agent() rather than gmi(): a primary that fails to start, a fallback hop with a smaller context window, a provider change between the steps of one turn, a failed step after a tool ran, a stream that breaks after its first delta, the return to the primary on the next turn, cognitive memory recall, cognitive memory beside a memoryProvider, embeddings for an Anthropic chat model, and a memory with no embedding source failing on the first call. A routing case checks that runtime: 'gmi' builds the agent on the GMI path and runtime: 'legacy' keeps the helper. agent() does not route on runtime yet, so these fail.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe ChangesGMI runtime
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Feature Merge Risk: ⚪ Minimal · up to The reviewed changes strengthen GMI memory test coverage, and no actionable merge-blocking risk is identified; normal checks are sufficient. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Reviewer's GuideThe PR makes File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
PR Summary by Qodotest(api): cover agent GMI routing, fallback, and memory
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
agent() checks runtime before anything else: with runtime: 'gmi' it returns gmi(opts), so the agent gets the GMI path's construction checks and diagnostics, and Agent.session's options (the session's user id) reach the GMI session. Without runtime, or with runtime: 'legacy', it keeps the legacy path. gmi, createGmi, resolveCognition, personaFromAgentOptions and createAgentCognitiveMemory are exported from @framers/agentos/api and from the package root, with GmiOptions, GmiHandle, CognitionProfile, CognitionConfig, CognitionInputs, MetapromptPreset, ResolvedCognition, AgentCognitiveMemory and AgentCognitiveMemoryOptions; the package root also exports AgentSessionOptions. The session end-to-end tests now build their agents with agent().
…provider Building cognitive memory now embeds one fixed text through the chosen provider, so an embedCalls count above zero holds even when memory never embeds anything afterwards. The provider stub records each text it embeds, and the two cases look for their own words: the deploy-key fact for the OpenAI chat model, the user's turn for the Anthropic chat model whose memory embeds through OpenAI.
Summary
agent({ runtime: 'gmi' })builds the agent withgmi()(#135), so every session of the agent is served by a Generalized Mind Instance built in process from the agent's options.agent()withoutruntime, or withruntime: 'legacy', keeps its current path.The branch lands in steps:
agent()checksruntimebefore anything else, so an agent on the GMI path gets the GMI path's construction checks and diagnostics, not the legacy helper's.gmi,createGmi,resolveCognition,personaFromAgentOptions,createAgentCognitiveMemoryand the typesGmiOptions,GmiHandle,CognitionProfile,CognitionConfig,CognitionInputs,ResolvedCognition,MetapromptPreset,AgentCognitiveMemoryandAgentCognitiveMemoryOptionsare exported from@framers/agentos/apiand from the package root; the package root also exportsAgentSessionOptions.docs/GMI.md,docs/API_PATHS.md,README.md) and the release notes in this description.Linked issues
Follows #129 and #135.
Type of change
How this was verified
CI (
Test & Lint).src/api/__tests__/gmi-runtime.session.test.ts,gmi-runtime.fallback.test.tsandgmi-runtime.memory.test.tsrunagent({ runtime: 'gmi' })end to end over the real provider manager, completion gateway, GMI, prompt engine, tool orchestrator, cognitive memory and session store, with the OpenAI and Anthropic provider classes stubbed at their module boundary. The existingagent(),streamTextand GMI tests run unchanged. The first commit adds the end-to-end cases and fails; the routing commit turns them green.Migration notes
None.
runtime: 'gmi'is opt-in;agent()without it behaves as before.Checklist
!before the colon for a change that breaks users (feat!:orfeat(api)!:).Summary by Sourcery
Add opt-in GMI routing to
agent()with the remaining GMI surface, provider and memory behavior, public exports, and end-to-end coverage.New Features:
agent({ runtime: 'gmi' })through an in-process Generalized Mind Instance while preserving the existing default and legacy agent paths.Bug Fixes:
Enhancements:
Tests:
Summary by CodeRabbit
agent()API can now use the GMI runtime through a runtime option, allowing you to create agents through the existing entry point.