pub struct SequentialAgent<P: LlmProvider> { /* private fields */ }Expand description
Runs a list of sub-agents in order. Each agent receives the previous
agent’s text output as its task input. Returns the final agent’s output
with accumulated TokenUsage.
Implementations§
Source§impl<P: LlmProvider> SequentialAgent<P>
impl<P: LlmProvider> SequentialAgent<P>
Sourcepub fn builder() -> SequentialAgentBuilder<P>
pub fn builder() -> SequentialAgentBuilder<P>
Create a new SequentialAgentBuilder.
Add agents with .agent(...) in execution order; each agent receives
the previous agent’s text output as its task input.
§Example
use std::sync::Arc;
use heartbit_core::{
AgentRunner, AnthropicProvider, BoxedProvider, SequentialAgent,
};
let provider = Arc::new(BoxedProvider::new(AnthropicProvider::new(
"sk-...",
"claude-sonnet-4-20250514",
)));
let researcher = AgentRunner::builder(provider.clone())
.system_prompt("Summarize the topic in 3 bullet points.")
.build()?;
let writer = AgentRunner::builder(provider)
.system_prompt("Rewrite as a single engaging paragraph.")
.build()?;
let pipeline = SequentialAgent::builder()
.agent(researcher)
.agent(writer)
.build()?;
let output = pipeline.execute("History of Rust").await?;
println!("{}", output.result);Trait Implementations§
Source§impl<P: LlmProvider> Debug for SequentialAgent<P>
impl<P: LlmProvider> Debug for SequentialAgent<P>
Source§impl<P: LlmProvider + 'static> From<SequentialAgent<P>> for WorkflowRouter<P>
impl<P: LlmProvider + 'static> From<SequentialAgent<P>> for WorkflowRouter<P>
Source§fn from(agent: SequentialAgent<P>) -> Self
fn from(agent: SequentialAgent<P>) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<P> Freeze for SequentialAgent<P>
impl<P> !RefUnwindSafe for SequentialAgent<P>
impl<P> Send for SequentialAgent<P>
impl<P> Sync for SequentialAgent<P>
impl<P> Unpin for SequentialAgent<P>
impl<P> UnsafeUnpin for SequentialAgent<P>
impl<P> !UnwindSafe for SequentialAgent<P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more