refactor(server): migrate to Agents SDK backend#12
Conversation
📝 WalkthroughWalkthroughThe pull request migrates the LLM backend from the OpenAI Responses API to the OpenAI Agents SDK. Changes include replacing OpenAILLMService with a new OpenAIAgentsLLMService that dynamically loads the agents SDK and executes agents with a capped turn limit. The package.json dependency is updated from "openai" to "@openai/agents". The main application entry point is modified to instantiate the new service. Documentation files are updated to reflect the architectural shift and include guidance on initializing git submodules. Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/server/src/services/openai-agents-llm.ts (1)
74-74: Add a timeout viaAbortSignalto bound wall-clock runtime forsdk.run().
maxTurnsalone doesn't prevent slow network or tool steps from extending request duration indefinitely. UseAbortSignal.timeout()to enforce a timeout:Example implementation
const result = await sdk.run(agent, invocation.userContent, { maxTurns: MAX_AGENT_TURNS, signal: AbortSignal.timeout(10_000), // 10s timeout });Adjust the timeout value based on expected runtime for your agents.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/server/src/services/openai-agents-llm.ts` at line 74, The call to sdk.run(agent, invocation.userContent, { maxTurns: MAX_AGENT_TURNS }) needs a wall-clock timeout; update the options passed to sdk.run (in the same scope where agent, invocation.userContent and MAX_AGENT_TURNS are used) to include a signal created via AbortSignal.timeout(<ms>) (e.g., 10_000 ms) so the request is aborted after the desired duration; ensure any surrounding try/catch around sdk.run handles the abort error appropriately.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/server/src/services/openai-agents-llm.ts`:
- Line 74: The call to sdk.run(agent, invocation.userContent, { maxTurns:
MAX_AGENT_TURNS }) needs a wall-clock timeout; update the options passed to
sdk.run (in the same scope where agent, invocation.userContent and
MAX_AGENT_TURNS are used) to include a signal created via
AbortSignal.timeout(<ms>) (e.g., 10_000 ms) so the request is aborted after the
desired duration; ensure any surrounding try/catch around sdk.run handles the
abort error appropriately.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (7)
AGENTS.mdCLAUDE.mdREADME.mdapps/server/package.jsonapps/server/src/index.tsapps/server/src/services/openai-agents-llm.tsapps/server/src/services/openai-llm.ts
💤 Files with no reviewable changes (1)
- apps/server/src/services/openai-llm.ts
Purpose
Migrate server-side agent execution to OpenAI Agents SDK as the single backend path and remove legacy Responses adapter code.
What changed
Risk / Impact
Linked issue
Validation