Skip to content

feat(agent): add code-specialized bootstrap entrypoint#174

Merged
yacosta738 merged 1 commit into
mainfrom
feature/dallay-143-feature-deliver-code-specialized-agent-example-using-code
Mar 8, 2026
Merged

feat(agent): add code-specialized bootstrap entrypoint#174
yacosta738 merged 1 commit into
mainfrom
feature/dallay-143-feature-deliver-code-specialized-agent-example-using-code

Conversation

@yacosta738
Copy link
Copy Markdown
Contributor

This pull request introduces a new, profile-based mechanism for instantiating specialized agents—specifically, a "code" profile—without duplicating bootstrap logic. It refactors the agent and bootstrap initialization flow to support this, adds new entrypoints for profile-based agent creation, and updates documentation and tests to reflect these changes.

Agent Initialization and Profile Support

  • Added new methods to the Agent struct: from_config_with_profile and code_from_config, allowing creation of agents with a specific capability profile (e.g., "code"), reusing existing bootstrap logic. Also refactored agent construction to use a new from_bootstrap_with_provider helper for improved composability. [1] [2] [3]

  • Updated BootstrapContext with from_config_with_profile and from_effective_config methods, enabling profile-specific context initialization without duplicating configuration logic.

Testing

  • Added a new async test to verify that a "code" profile agent is correctly bootstrapped with the appropriate tools and provider, ensuring specialized agents behave as intended. [1] [2]

Documentation

  • Updated both English and Spanish architecture docs to describe the new internal entrypoints for creating profile-specialized agents, clarifying their purpose and usage for future development. [1] [2]

@linear
Copy link
Copy Markdown

linear Bot commented Mar 8, 2026

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 8, 2026

📝 Walkthrough

Summary by CodeRabbit

  • New Features

    • Added profile-based specialized agent initialization paths, enabling agents to be configured with specific capability sets independently of global configuration settings. Supports flexible agent customization for different use cases.
  • Documentation

    • Enhanced architecture documentation in both English and Spanish with comprehensive details on specialized agent initialization pathways, profile-based capability configuration, and how they integrate with core runtime components.

Walkthrough

The pull request introduces specialized Agent initialization pathways to support profile-based configuration. New methods from_config_with_profile, code_from_config, and internal from_bootstrap variants are added to Agent and BootstrapContext. Existing from_config is refactored to delegate through the new bootstrap-based initialization. Architecture documentation is updated to describe the specialized agent paths.

Changes

Cohort / File(s) Summary
Agent Runtime Implementation
clients/agent-runtime/src/agent/agent.rs, clients/agent-runtime/src/bootstrap/mod.rs
New Agent constructors (from_config_with_profile, code_from_config, from_bootstrap) and BootstrapContext helpers (from_config_with_profile, from_effective_config) enable profile-specific initialization. Existing from_config delegates to new bootstrap-based paths for consistency.
Architecture Documentation
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md, clients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md
Adds "Internal Specialized Agent Paths" section documenting the canonical Agent::code_from_config and BootstrapContext::from_config_with_profile pathways for profile-driven agent instantiation.

Sequence Diagram

sequenceDiagram
    participant Caller
    participant Agent
    participant Bootstrap as BootstrapContext
    participant Config
    
    Caller->>Agent: code_from_config(config)
    activate Agent
    Agent->>Bootstrap: from_config_with_profile(config, "code")
    activate Bootstrap
    Bootstrap->>Bootstrap: clone config, override profile
    Bootstrap->>Bootstrap: from_effective_config
    Bootstrap-->>Agent: BootstrapContext
    deactivate Bootstrap
    Agent->>Agent: from_bootstrap_with_provider(config, bootstrap, provider)
    Agent-->>Caller: Agent (code profile)
    deactivate Agent
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

area:rust, area:docs, area:web, risk:high

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title follows Conventional Commit style with 'feat' prefix and a clear, descriptive summary of the change within the 72-character limit.
Description check ✅ Passed The description thoroughly covers the changes across multiple files, explains the motivation for profile-based initialization, includes testing details, and documents updates to both English and Spanish documentation.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/dallay-143-feature-deliver-code-specialized-agent-example-using-code

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 8, 2026

✅ Contributor Report

User: @yacosta738
Status: Passed (12/13 metrics passed)

Metric Description Value Threshold Status
PR Merge Rate PRs merged vs closed 88% >= 30%
Repo Quality Repos with ≥100 stars 0 >= 0
Positive Reactions Positive reactions received 9 >= 1
Negative Reactions Negative reactions received 0 <= 5
Account Age GitHub account age 3054 days >= 30 days
Activity Consistency Regular activity over time 108% >= 0%
Issue Engagement Issues with community engagement 0 >= 0
Code Reviews Code reviews given to others 395 >= 0
Merger Diversity Unique maintainers who merged PRs 2 >= 0
Repo History Merge Rate Merge rate in this repo 91% >= 0%
Repo History Min PRs Previous PRs in this repo 130 >= 0
Profile Completeness Profile richness (bio, followers) 90 >= 0
Suspicious Patterns Spam-like activity detection 1 N/A

Contributor Report evaluates based on public GitHub activity. Analysis period: 2025-03-08 to 2026-03-08

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Mar 8, 2026

Copy link
Copy Markdown
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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
clients/agent-runtime/src/agent/agent.rs (1)

254-275: 🧹 Nitpick | 🔵 Trivial

Minor: model_name is computed twice.

from_bootstrap derives model_name at lines 255-259, then from_bootstrap_with_provider derives it again at lines 271-275. Since both read from the same config, consider passing model_name as a parameter to avoid redundant extraction.

♻️ Suggested refactor
-    fn from_bootstrap(config: &Config, bootstrap: bootstrap::BootstrapContext) -> Result<Self> {
-        let model_name = config
-            .default_model
-            .as_deref()
-            .unwrap_or("anthropic/claude-sonnet-4-20250514")
-            .to_string();
-
-        let provider: Box<dyn Provider> = bootstrap::create_routed_provider(config, &model_name)?;
-
-        Self::from_bootstrap_with_provider(config, bootstrap, provider)
+    fn from_bootstrap(config: &Config, bootstrap: bootstrap::BootstrapContext) -> Result<Self> {
+        let model_name = config
+            .default_model
+            .as_deref()
+            .unwrap_or("anthropic/claude-sonnet-4-20250514");
+
+        let provider: Box<dyn Provider> = bootstrap::create_routed_provider(config, model_name)?;
+
+        Self::from_bootstrap_with_provider(config, bootstrap, provider, model_name.to_string())
     }

     fn from_bootstrap_with_provider(
         config: &Config,
         bootstrap: bootstrap::BootstrapContext,
         provider: Box<dyn Provider>,
+        model_name: String,
     ) -> Result<Self> {
-        let model_name = config
-            .default_model
-            .as_deref()
-            .unwrap_or("anthropic/claude-sonnet-4-20250514")
-            .to_string();
-
         let dispatcher_choice = config.agent.tool_dispatcher.as_str();
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@clients/agent-runtime/src/agent/agent.rs` around lines 254 - 275, Compute
model_name once in from_bootstrap and pass it into from_bootstrap_with_provider
instead of recomputing it; update the signature of from_bootstrap_with_provider
to accept model_name: String (or &str) and remove the duplicate extraction
inside from_bootstrap_with_provider (references: from_bootstrap and
from_bootstrap_with_provider, variable model_name and call to
bootstrap::create_routed_provider) so the function uses the passed-in model_name
when creating/using the provider.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@clients/agent-runtime/src/agent/agent.rs`:
- Around line 254-275: Compute model_name once in from_bootstrap and pass it
into from_bootstrap_with_provider instead of recomputing it; update the
signature of from_bootstrap_with_provider to accept model_name: String (or &str)
and remove the duplicate extraction inside from_bootstrap_with_provider
(references: from_bootstrap and from_bootstrap_with_provider, variable
model_name and call to bootstrap::create_routed_provider) so the function uses
the passed-in model_name when creating/using the provider.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: d66b7b41-2a19-4d28-a004-6b1a318ba2c9

📥 Commits

Reviewing files that changed from the base of the PR and between ffd2365 and 4e3408a.

📒 Files selected for processing (4)
  • clients/agent-runtime/src/agent/agent.rs
  • clients/agent-runtime/src/bootstrap/mod.rs
  • clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
  • clients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md
📜 Review details
⏰ 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). (3)
  • GitHub Check: pr-checks
  • GitHub Check: sonar
  • GitHub Check: Cloudflare Pages
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{md,mdx}

⚙️ CodeRabbit configuration file

**/*.{md,mdx}: Verify technical accuracy and that docs stay aligned with code changes.
For user-facing docs, check EN/ES parity or explicitly note pending translation gaps.

Files:

  • clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
  • clients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md
**/*

⚙️ CodeRabbit configuration file

**/*: Security first, performance second.
Validate input boundaries, auth/authz implications, and secret management.
Look for behavioral regressions, missing tests, and contract breaks across modules.

Files:

  • clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
  • clients/agent-runtime/src/bootstrap/mod.rs
  • clients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md
  • clients/agent-runtime/src/agent/agent.rs
clients/agent-runtime/src/**/*.rs

📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)

clients/agent-runtime/src/**/*.rs: Never log secrets, tokens, raw credentials, or sensitive payloads in any logging statements
Avoid unnecessary allocations, clones, and blocking operations to maintain performance and efficiency

Files:

  • clients/agent-runtime/src/bootstrap/mod.rs
  • clients/agent-runtime/src/agent/agent.rs
clients/agent-runtime/**/*.rs

📄 CodeRabbit inference engine (clients/agent-runtime/AGENTS.md)

Run cargo fmt --all -- --check, cargo clippy --all-targets -- -D warnings, and cargo test for code validation, or document which checks were skipped and why

Files:

  • clients/agent-runtime/src/bootstrap/mod.rs
  • clients/agent-runtime/src/agent/agent.rs
**/*.rs

⚙️ CodeRabbit configuration file

**/*.rs: Focus on Rust idioms, memory safety, and ownership/borrowing correctness.
Flag unnecessary clones, unchecked panics in production paths, and weak error context.
Prioritize unsafe blocks, FFI boundaries, concurrency races, and secret handling.

Files:

  • clients/agent-runtime/src/bootstrap/mod.rs
  • clients/agent-runtime/src/agent/agent.rs
🧠 Learnings (8)
📓 Common learnings
Learnt from: CR
Repo: dallay/corvus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T07:28:38.934Z
Learning: Applies to .agents/AGENTS.md : Document agent configurations and capabilities in AGENTS.md
📚 Learning: 2026-02-17T07:28:38.934Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T07:28:38.934Z
Learning: Applies to .agents/AGENTS.md : Document agent configurations and capabilities in AGENTS.md

Applied to files:

  • clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
  • clients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md
📚 Learning: 2026-02-17T07:28:38.934Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T07:28:38.934Z
Learning: Applies to .agents/AGENTS.md : Include version information and compatibility details for agents

Applied to files:

  • clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Preserve CLI contract unless change is intentional and documented; prefer explicit errors over silent fallback for unsupported critical paths

Applied to files:

  • clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
  • clients/agent-runtime/src/bootstrap/mod.rs
  • clients/agent-runtime/src/agent/agent.rs
📚 Learning: 2026-02-17T07:28:38.934Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-02-17T07:28:38.934Z
Learning: Applies to .agents/AGENTS.md : Maintain comprehensive agent metadata including name, description, purpose, and capabilities

Applied to files:

  • clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/main.rs : Keep startup path lean and avoid heavy initialization in command parsing flow

Applied to files:

  • clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
  • clients/agent-runtime/src/bootstrap/mod.rs
  • clients/agent-runtime/src/agent/agent.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/src/providers/**/*.rs : Implement `Provider` trait in `src/providers/` and register in `src/providers/mod.rs` factory when adding a new provider

Applied to files:

  • clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md
  • clients/agent-runtime/src/agent/agent.rs
📚 Learning: 2026-02-17T12:31:17.076Z
Learnt from: CR
Repo: dallay/corvus PR: 0
File: clients/agent-runtime/AGENTS.md:0-0
Timestamp: 2026-02-17T12:31:17.076Z
Learning: Applies to clients/agent-runtime/**/Cargo.toml : Preserve release-size profile assumptions in `Cargo.toml` and avoid adding heavy dependencies unless clearly justified

Applied to files:

  • clients/agent-runtime/src/bootstrap/mod.rs
  • clients/agent-runtime/src/agent/agent.rs
🪛 LanguageTool
clients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md

[grammar] ~138-~138: Elimina la palabra o signo.
Context: ... especializado en código sin duplicar el bootstrap. La ruta canónica es `Agent::c...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~139-~139: Elimina la palabra o signo.
Context: ...g(&config)`, que reutiliza el ensamblaje compartido del bootstrap y fuerza el per...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~140-~140: Elimina la palabra o signo.
Context: ...dades code solo para esa instancia del agente. Los consumidores de más bajo niv...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~141-~141: Elimina la palabra o signo.
Context: ...ceder directamente a los componentes del bootstrap pueden usar `BootstrapContext:...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~144-~144: Cambia la forma del adjetivo.
Context: ...ofile(&config, "code")`. Esto mantiene alineados la selección de proveedor, la memoria, ...

(QB_NEW_ES_OTHER_ERROR_IDS_REPLACEMENT_ADJECTIVE_FORM)


[grammar] ~144-~144: Elimina la palabra o signo.
Context: ...oria, la observabilidad y el filtrado de herramientas con la ruta principal del r...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~145-~145: Elimina la palabra o signo.
Context: ...mientras permite agregar futuros agentes especializados como entrypoints delgados...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)


[grammar] ~146-~146: Elimina la palabra o signo.
Context: ...les en lugar de árboles de configuración separados. ### Proveedores El módulo `...

(QB_NEW_ES_OTHER_ERROR_IDS_UNNECESSARY_SPACE)

🔇 Additional comments (5)
clients/web/apps/docs/src/content/docs/en/clients/agent-runtime/architecture.md (1)

132-142: LGTM!

The new "Internal Specialized Agent Paths" section accurately documents the added Agent::code_from_config and BootstrapContext::from_config_with_profile APIs. The description correctly explains the profile-based bootstrap reuse pattern and aligns with the implementation in agent.rs and bootstrap/mod.rs.

clients/web/apps/docs/src/content/docs/es/clients/agent-runtime/architecture.md (1)

136-147: LGTM!

The Spanish translation maintains semantic parity with the English documentation. The static analysis grammar warnings are false positives triggered by code identifiers within backticks (e.g., bootstrap, code).

clients/agent-runtime/src/bootstrap/mod.rs (1)

164-176: LGTM!

The refactored bootstrap initialization cleanly separates profile override logic from effective config processing. The config.clone() on line 169 is acceptable since this runs only once during agent initialization, not on hot request paths.

clients/agent-runtime/src/agent/agent.rs (2)

230-238: LGTM!

Clean public API additions for profile-based agent construction. code_from_config is a convenient thin wrapper that hardcodes the "code" profile.


1341-1366: LGTM!

Solid test coverage for the code-profile bootstrap path. Correctly verifies tool filtering (shell and git_operations present, schedule absent) and exercises the from_bootstrap_with_provider constructor with a mock provider.

@yacosta738 yacosta738 linked an issue Mar 8, 2026 that may be closed by this pull request
@yacosta738 yacosta738 merged commit 31c8461 into main Mar 8, 2026
17 of 18 checks passed
@yacosta738 yacosta738 deleted the feature/dallay-143-feature-deliver-code-specialized-agent-example-using-code branch March 8, 2026 22:19
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.

Feature: Deliver code-specialized agent example using Code profile

1 participant