tiny-agent 0.2.0

一个小而完整的 Rust LLM Agent 运行时:可中断、可恢复、可观测、可插拔的 agent loop / A small but complete LLM agent runtime in Rust — an interruptible, resumable, observable, pluggable agent loop.
Documentation
use crate::{sandbox::Sandbox, shared::UserInteraction, tools::ToolOutcome};
use schemars::JsonSchema;
use serde::Deserialize;
use serde_json::json;
use std::sync::Arc;

#[derive(Deserialize, JsonSchema)]
pub struct AskFollowupQuestionArgs {
    pub question: String,
    pub options: Vec<String>,
}

pub async fn ask_followup_question(
    _sandbox: Arc<dyn Sandbox>,
    args: AskFollowupQuestionArgs,
) -> Result<ToolOutcome, String> {
    Ok(ToolOutcome::NeedsUserInteraction(UserInteraction {
        kind: "followup_question".to_string(),
        payload: json!({
            "question": args.question,
            "options": args.options
        }),
    }))
}