| Crates.io | ambush |
| lib.rs | ambush |
| version | 0.1.0 |
| created_at | 2025-12-14 20:27:06.991547+00 |
| updated_at | 2025-12-14 20:27:06.991547+00 |
| description | Task decomposition and plan mode for AI agents - planning the attack |
| homepage | |
| repository | https://github.com/moltenlabs/molten |
| max_upload_size | |
| id | 1985052 |
| size | 91,468 |
Task decomposition and plan mode for AI agents - planning the attack.
Ambush provides task decomposition and planning capabilities for AI agents, breaking complex requests into manageable steps with agent assignments.
[dependencies]
ambush = "0.1"
use ambush::{TaskPlanner, PlanConfig};
#[tokio::main]
async fn main() -> Result<(), ambush::PlannerError> {
let config = PlanConfig::default();
let planner = TaskPlanner::new(config);
// Generate a plan from a user request
let plan = planner.plan("Add user authentication to my app").await?;
println!("Plan has {} steps:", plan.steps.len());
for step in &plan.steps {
println!(" - {} ({:?})", step.description, step.complexity);
}
println!("Estimated tokens: {}", plan.estimated_tokens);
Ok(())
}
use ambush::{TaskPlanner, PlanConfig};
use warhorn::PlanGranularity;
// Coarse-grained planning (fewer, larger steps)
let plan = planner.plan_with_granularity(
"Refactor the database layer",
PlanGranularity::Coarse
).await?;
// Detailed planning (more, smaller steps)
let plan = planner.plan_with_granularity(
"Add login form",
PlanGranularity::Detailed
).await?;
// Auto-detect based on request complexity
let plan = planner.plan_with_granularity(
"Fix bug in parser",
PlanGranularity::Auto
).await?;
The planner automatically assigns agent roles based on the task domain:
use warhorn::AgentRole;
for (step_id, role) in &plan.agent_assignments {
match role {
AgentRole::DomainLead { domain } => {
println!("Step {} assigned to {} lead", step_id, domain);
}
AgentRole::Worker => {
println!("Step {} assigned to worker", step_id);
}
_ => {}
}
}
MIT OR Apache-2.0