Skip to main content

autoagents_core/agent/
protocol.rs

1use autoagents_llm::chat::ChatMessage;
2use serde::{Deserialize, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub enum AgentProtocol {
6    /// Tool call requested (with ID)
7    ToolCallRequested {
8        id: String,
9        tool_name: String,
10        arguments: String,
11    },
12
13    /// Tool call completed (with ID and result)
14    ToolCallCompleted {
15        id: String,
16        tool_name: String,
17        result: serde_json::Value,
18    },
19
20    /// Tool call has failed
21    ToolCallFailed {
22        id: String,
23        tool_name: String,
24        error: String,
25    },
26
27    /// A turn has started
28    TurnStarted {
29        turn_number: usize,
30        max_turns: usize,
31    },
32
33    /// A turn has completed
34    TurnCompleted {
35        turn_number: usize,
36        final_turn: bool,
37    },
38}
39
40/// Messages from the agent - used for A2A communication
41#[allow(dead_code)]
42#[derive(Debug, Clone, Serialize, Deserialize)]
43struct AgentMessage {
44    /// The content of the message
45    pub content: String,
46
47    /// Optional chat messages for a full conversation history
48    pub chat_messages: Option<Vec<ChatMessage>>,
49}