Skip to content

feat: SubAgent#115

Merged
surafelfikru merged 4 commits into
mainfrom
feat/subagent
May 11, 2026
Merged

feat: SubAgent#115
surafelfikru merged 4 commits into
mainfrom
feat/subagent

Conversation

@ishaksebsib

@ishaksebsib ishaksebsib commented Mar 24, 2026

Copy link
Copy Markdown
Member

Related Issue

#108

Description

This PR introduces subagents as a first-class capability in LanguageModelRequestBuilder.

A subagent can now be defined directly from the request builder's dedicated subagent path; .build() produces a Tool instead of a LanguageModelRequest, while normal request building remains unchanged.

The new API makes subagent creation explicit and type-safe:

  • normal requests continue to use prompt() or messages()
  • subagents are created with subagent(name, description)
  • once in subagent mode, conversation input methods are no longer available
  • The delegated task is supplied at tool-call time through the subagent input schema

Example

let subagent = LanguageModelRequest::builder()
    .model(model)
    .subagent("explore-agent", "Explore the codebase to have a deeper understanding of the project.")
    .system("You are a research agent. Summarize your findings in your final response.")
    .with_tool(readFileTool())
    .with_tool(searchTool())
    .build(); // -> Tool

let main_agent = LanguageModelRequest::builder()
    .model(model)
    .system("You are a helpful assistant with access to tools.")
    .prompt("What is the secret code for lets")
    .with_tool(subagent) // pass the subagent to parent
    .build()
    .generate_text()
    .await?;

Comment thread src/core/tools.rs
@surafelfikru surafelfikru merged commit bfcf83c into main May 11, 2026
6 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