-
Notifications
You must be signed in to change notification settings - Fork 33
fix(tools): separate tools job #222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughThis PR removes MCP server inputs and parsing from agent creation and update paths, narrowing create/update schemas and simplifying createAgentTool to require only an agent profile (promptsId obtained internally). Changes
Sequence Diagram(s)sequenceDiagram
participant UI as User/API
participant Supervisor as createAgentTool
participant Prompts as PromptsService
participant DB as AgentStore
Note over UI,Supervisor: New create flow (MCP fields removed)
UI->>Supervisor: POST createAgent(profile: Profile)
Supervisor->>Prompts: ensurePromptsId(userId)
Prompts-->>Supervisor: promptsId
Supervisor->>DB: createAgent({ profile, prompts_id: promptsId, defaults })
DB-->>Supervisor: agentCreated
Supervisor-->>UI: 201 Created (agent)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (1)
packages/agent/src/agents/operators/supervisor/tools/createAgentTool.ts (1)
226-249: Remove the unusedprovidedIdparameter to simplify the function signature.The verification confirms that
ensurePromptsIdis only ever called with a single parameter (userId) at line 108. TheprovidedIdparameter is never passed anywhere in the codebase, making it safe to remove:async function ensurePromptsId(userId: string): Promise<{ id: string; created: boolean }> { const existing = await agents.getExistingPromptsForUser(userId); if (existing) { return { id: existing.id, created: false }; } const promptId = await agents.createDefaultPrompts( userId, TASK_EXECUTOR_SYSTEM_PROMPT, TASK_MANAGER_SYSTEM_PROMPT, TASK_VERIFIER_SYSTEM_PROMPT, TASK_MEMORY_MANAGER_SYSTEM_PROMPT, false ); return { id: promptId, created: true }; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/agent/src/agents/operators/supervisor/tools/createAgentTool.ts(3 hunks)packages/agent/src/agents/operators/supervisor/tools/schemas/createAgent.schema.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
packages/agent/src/agents/operators/supervisor/tools/schemas/createAgent.schema.ts (1)
packages/agent/src/agents/operators/supervisor/tools/schemas/common.schemas.ts (1)
AgentProfileSchema(7-32)
packages/agent/src/agents/operators/supervisor/tools/createAgentTool.ts (1)
packages/core/src/common/agent.ts (1)
Input(156-159)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: validate-build
🔇 Additional comments (4)
packages/agent/src/agents/operators/supervisor/tools/createAgentTool.ts (3)
29-31: LGTM! Clear documentation of simplified behavior.The updated description accurately reflects that the tool now only accepts profile configuration and applies defaults for everything else, with a helpful pointer to use
update_agentfor post-creation modifications.
107-113: LGTM! Prompts initialization properly simplified.The prompts are now always derived internally via
ensurePromptsId(userId), which aligns with the PR objective of removing configuration from the input and using defaults.
166-189: ✓ Verification complete—no issues found.
normalizeNumericValuesproperly transformsPartial<AgentConfig.Input>into a completeAgentConfig.Inputwith all required fields (graph,memory,rag,mcp_servers, andprofile) initialized from defaults and then normalized. The return typeNormalizationResult.normalizedConfigis correctly typed asAgentConfig.Input, ensuring type safety. The simplification inbuildAgentConfigFromInputis sound.packages/agent/src/agents/operators/supervisor/tools/schemas/createAgent.schema.ts (1)
5-11: LGTM! Clean, minimal schema with strict validation.The schema is well-designed:
- Reduced to only the required
profilefield, aligning with the PR objective- The
.strict()mode ensures no extraneous fields can be passed, providing clear boundaries- The profile description clearly indicates it's required
| import { AgentProfileSchema } from './common.schemas.js'; | ||
|
|
||
| // Main schema for creating an agent (profile required, other fields optional) | ||
| // Main schema for creating an agent (only profile and prompts_id allowed) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update comment to reflect actual schema.
The comment states "only profile and prompts_id allowed" but the schema only includes the profile field. The prompts_id is now derived internally (see createAgentTool.ts line 113) and is not part of the input schema.
Apply this diff to correct the comment:
-// Main schema for creating an agent (only profile and prompts_id allowed)
+// Main schema for creating an agent (only profile allowed)📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // Main schema for creating an agent (only profile and prompts_id allowed) | |
| // Main schema for creating an agent (only profile allowed) |
🤖 Prompt for AI Agents
In
packages/agent/src/agents/operators/supervisor/tools/schemas/createAgent.schema.ts
around line 4, update the top comment which incorrectly says "only profile and
prompts_id allowed" to reflect the actual schema (which only includes the
profile field) by removing the mention of prompts_id and/or noting that
prompts_id is derived internally in createAgentTool.ts; modify the comment text
to accurately describe that the input schema accepts only the profile and that
prompts_id is not part of the input.
Summary by CodeRabbit
Refactor
Documentation