Skip to content

v0.5.0

Choose a tag to compare

@yuanhao yuanhao released this 24 Feb 23:41
· 372 commits to main since this release
da021ff

What's New

Breaking Changes

  • AgentTool::execute() signature changed — The 4-parameter signature is replaced by execute(params, ctx: ToolContext). All tool implementations must update.

New Features

  • ToolContext struct — Bundles tool_call_id, tool_name, cancel, on_update, and on_progress into a single parameter. Future-proofs the trait (adding fields is non-breaking). Implements Clone and Debug.

  • ProgressMessage event — Tools can emit lightweight user-facing progress text via ctx.on_progress, surfaced as AgentEvent::ProgressMessage { tool_call_id, tool_name, text }.

  • InputFilter trait — Synchronous filter(&self, text: &str) -> FilterResult hook applied before the LLM call:

    • Pass — message goes through unchanged
    • Warn(String) — warning appended to user message for the LLM to see
    • Reject(String) — loop aborts immediately, emits InputRejected { reason } event
  • InputRejected event — New AgentEvent variant emitted when an input filter rejects a message.

  • Sub-agent progress forwarding — SubAgentTool now forwards ProgressMessage events from child agents via the parent's on_progress callback.

Migration Guide

Update your AgentTool implementations:

// Before (v0.4):
async fn execute(
    &self,
    tool_call_id: &str,
    params: Value,
    cancel: CancellationToken,
    on_update: Option<ToolUpdateFn>,
) -> Result<ToolResult, ToolError>

// After (v0.5):
async fn execute(
    &self,
    params: Value,
    ctx: ToolContext,
) -> Result<ToolResult, ToolError>

Access fields via ctx.cancel, ctx.on_update, ctx.tool_call_id, etc.