Skip to content

Conversation

@HxSimo
Copy link
Collaborator

@HxSimo HxSimo commented Oct 27, 2025

Summary by CodeRabbit

  • Refactor

    • Agent creation simplified: only profile is required; prompts are auto-initialized at creation (no prompts input accepted) and other settings default and must be changed later.
    • MCP server configuration removed from create/update payloads and is now managed via dedicated MCP server tools.
  • Documentation

    • Notes clarifying that MCP servers cannot be set during creation or via the standard update schema.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 27, 2025

Walkthrough

This 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

Cohort / File(s) Summary
Create tool (agent)
packages/agent/src/agents/operators/supervisor/tools/createAgentTool.ts
Removed McpServerConfig import and all MCP-server parsing/handling; buildAgentConfigFromInput now only includes profile and prompts_id (prompts initialized internally via ensurePromptsId); removed parseMcpServers helper; updated descriptions/notes to reflect defaults.
Create schema
packages/agent/src/agents/operators/supervisor/tools/schemas/createAgent.schema.ts
Narrowed CreateAgentSchema to only include profile (required); removed mcp_servers, memory, rag, prompts_id, and graph fields and related imports; CreateAgentInput now inferred from reduced schema.
Update schema
packages/agent/src/agents/operators/supervisor/tools/schemas/updateAgent.schema.ts
Removed updates.mcp_servers support and related imports/constants; added note that MCP servers are managed via dedicated add/update/remove tools; UpdateAgentInput updated accordingly.

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)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

  • Changes are focused and homogeneous (schema narrowing and removal of MCP parsing).
  • Review attention: ensure no remaining MCP references in related call sites and that prompts initialization aligns with auth/user context.

Possibly related PRs

Suggested reviewers

  • 0xhijo

Poem

🐰 I hopped through code to trim the hedge,

Took MCP fields off the agent's ledge.
Profile stays, prompts found within,
Cleaner paths for builds to begin. 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title Check ❓ Inconclusive The pull request title "fix(tools): separate tools job" is vague and uses generic language that fails to clearly convey the main changes in the changeset. While the title mentions "tools," the phrase "separate tools job" is imprecise and doesn't indicate what aspect of the tools is being changed or why. The actual changes involve significant refactoring to constrain agent creation to profile-only configuration, removing MCP server support from creation/update tools, and deferring complex configurations to separate operations. A developer reviewing commit history would struggle to understand the scope and purpose of these changes based on the title alone. Consider revising the title to be more specific and descriptive of the actual changes, such as "refactor(tools): restrict create agent to profile-only configuration" or "fix(createAgent): defer mcp servers to separate tools." This would help teammates quickly understand that the changeset constrains what can be configured during initial agent creation versus what requires separate update operations.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/create_agent_tool

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@HxSimo HxSimo changed the title createTools only default config fix(tools): separate tools job Oct 27, 2025
@HxSimo HxSimo marked this pull request as ready for review October 27, 2025 23:04
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 unused providedId parameter to simplify the function signature.

The verification confirms that ensurePromptsId is only ever called with a single parameter (userId) at line 108. The providedId parameter 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

📥 Commits

Reviewing files that changed from the base of the PR and between 08b7a7f and 81339e7.

📒 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_agent for 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.

normalizeNumericValues properly transforms Partial<AgentConfig.Input> into a complete AgentConfig.Input with all required fields (graph, memory, rag, mcp_servers, and profile) initialized from defaults and then normalized. The return type NormalizationResult.normalizedConfig is correctly typed as AgentConfig.Input, ensuring type safety. The simplification in buildAgentConfigFromInput is 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 profile field, 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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
// 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.

@0xhijo 0xhijo merged commit ec30c55 into main Oct 30, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants