Skip to content

fix: wire named agents + 7 tests for managed agents#36

Merged
kienbui1995 merged 1 commit intomainfrom
fix/managed-agents-gaps
Apr 12, 2026
Merged

fix: wire named agents + 7 tests for managed agents#36
kienbui1995 merged 1 commit intomainfrom
fix/managed-agents-gaps

Conversation

@kienbui1995
Copy link
Copy Markdown
Owner

@kienbui1995 kienbui1995 commented Apr 12, 2026

Named agents wired to subagent dispatch

{"task": "review auth", "agent_name": "reviewer"}

Looks up agents/reviewer.md → uses its model, tools, instructions.

7 new tests (183→190)

  • SubagentSpawner: max_concurrent, background poll/list, shared context
  • ManagedAgentConfig: TOML parse, validation, defaults

Addresses CodeRabbit gap: named agents were visible in prompt but not routed.

Summary by CodeRabbit

  • New Features

    • Subagents can now reference predefined named agents, automatically inheriting their configured models, tools, and instructions.
    • Configuration validation for managed agents now checks budget and execution limits.
  • Tests

    • Added test coverage for agent configuration parsing and subagent execution behavior.

Named agents (agents/*.md):
- agent_name field in subagent tool spec
- Lookup AgentDef → use its model, tools, instructions
- Instructions prepended to task prompt
- Tool filter and model from AgentDef used as defaults

Tests (183→190):
- SubagentSpawner: max_concurrent, background poll, list, shared context
- ManagedAgentConfig: parse, validate bad values, defaults
@kienbui1995 kienbui1995 merged commit 6d8f1e4 into main Apr 12, 2026
4 of 5 checks passed
@kienbui1995 kienbui1995 deleted the fix/managed-agents-gaps branch April 12, 2026 09:33
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 12, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 8615d5e2-f902-4885-9cf8-9d71d333434e

📥 Commits

Reviewing files that changed from the base of the PR and between 7f5aa3b and c513c06.

📒 Files selected for processing (4)
  • mc/crates/mc-config/src/types.rs
  • mc/crates/mc-core/src/runtime.rs
  • mc/crates/mc-core/src/subagent.rs
  • mc/crates/mc-tools/src/spec.rs

📝 Walkthrough

Walkthrough

The changes introduce agent definition support to ConversationRuntime, enabling the subagent tool to look up named agent configurations and derive model overrides and allowed tools dynamically. Configuration validation tests verify managed agents parsing and defaults. Tool schema updated to accept optional agent_name parameter. Additional unit tests cover agent lookup, subagent spawning, and context management.

Changes

Cohort / File(s) Summary
Runtime Agent Support
mc/crates/mc-core/src/runtime.rs
Added agents field to ConversationRuntime with set_agents() setter. Modified subagent tool dispatcher to read agent_name input, look up agent definition, derive model_override and allowed_tools, and prepend agent instructions to prompt.
Tool Schema Updates
mc/crates/mc-tools/src/spec.rs
Added optional agent_name string field to subagent tool's input schema to reference named agents from configuration.
Configuration Testing
mc/crates/mc-config/src/types.rs
Added unit tests validating managed_agents TOML parsing, RuntimeConfig validation warnings for invalid values, and default initialization when no managed_agents block is provided.
Subagent Testing
mc/crates/mc-core/src/subagent.rs
Added unit tests for SubagentSpawner concurrent configuration, missing agent ID handling, background result listing, and SharedContext key/value round-trip persistence.

Sequence Diagram

sequenceDiagram
    participant Agent as Conversation Agent
    participant Runtime as ConversationRuntime
    participant Agents as Agents Registry
    participant SubTool as Subagent Tool Handler
    participant Task as Task Executor
    
    Agent->>Runtime: dispatch_tool("subagent", {agent_name: "foo"})
    Runtime->>Runtime: lookup agent_name in self.agents
    Runtime->>Agents: AgentDef found
    Agents-->>Runtime: return AgentDef (model, tools, instructions)
    Runtime->>SubTool: construct sub_prompt with agent instructions
    SubTool->>Task: run_task(model_override: agent.model)
    Task-->>SubTool: result
    SubTool-->>Runtime: tool result
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

A rabbit hops through agent fields so neat,
Subagents find their instructions sweet,
Model overrides dance, tools align,
Config tests ensure all schemas shine! 🐰✨

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/managed-agents-gaps

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

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.

1 participant