pub struct AgentBuilder { /* private fields */ }Expand description
Ergonomic constructor for AgentConfig. Required inputs are passed to AgentBuilder::new;
every other field defaults to the same values the nitpicker review path uses, and is
overridable via the chainable setters. Use AgentBuilder::build for a raw config or
AgentBuilder::run to execute in one call.
Concurrency note: each builder defaults to its own Semaphore::new(MAX_CONCURRENT_LLM_CALLS),
so it bounds in-flight LLM calls within one agent (and its subagents) but not across
independent builders — N agents can run N × MAX_CONCURRENT_LLM_CALLS calls at once. To cap
aggregate concurrency account-wide, share one Arc<Semaphore> via AgentBuilder::llm_semaphore.
Implementations§
Source§impl AgentBuilder
impl AgentBuilder
pub fn new( name: impl Into<String>, model: impl Into<String>, system_prompt: impl Into<String>, client: Arc<dyn LLMClientDyn>, ) -> Self
pub fn max_turns(self, max_turns: usize) -> Self
pub fn compact_threshold(self, threshold: u64) -> Self
Sourcepub fn max_tokens(self, max_tokens: NonZeroU64) -> Self
pub fn max_tokens(self, max_tokens: NonZeroU64) -> Self
Cap the output of each turn. Unset by default, which leaves the provider’s own per-model
limit to apply; set it only to bound spend, since a cap below what the model reasons
through returns empty content rather than a shorter answer. NonZeroU64 because a zero cap
asks for a response the provider answers with nothing at all.
Sourcepub fn subagent_system_prompt(self, prompt: impl Into<String>) -> Self
pub fn subagent_system_prompt(self, prompt: impl Into<String>) -> Self
Override the system prompt spawned subagents run with (default: the built-in generic prompt). The override propagates through nested subagent spawns.
Sourcepub fn project_context(self, context: impl Into<String>) -> Self
pub fn project_context(self, context: impl Into<String>) -> Self
Extra context appended to the system prompt (e.g. a project summary).
Sourcepub fn llm_semaphore(self, semaphore: Arc<Semaphore>) -> Self
pub fn llm_semaphore(self, semaphore: Arc<Semaphore>) -> Self
Share a concurrency limiter across agents instead of the per-builder default
(Semaphore::new(MAX_CONCURRENT_LLM_CALLS)), to cap aggregate in-flight LLM calls.