potato_agent/agents/
run_context.rs1use serde::{Deserialize, Serialize};
2use serde_json::Value;
3use std::collections::HashMap;
4
5#[derive(Debug, Clone)]
7pub struct AgentRunConfig {
8 pub max_iterations: u32,
9}
10
11impl Default for AgentRunConfig {
12 fn default() -> Self {
13 Self { max_iterations: 10 }
14 }
15}
16
17#[derive(Debug, Clone)]
19pub struct AgentRunContext {
20 pub agent_id: String,
21 pub iteration: u32,
22 pub max_iterations: u32,
23 pub responses: Vec<String>,
25}
26
27impl AgentRunContext {
28 pub fn new(agent_id: String, max_iterations: u32) -> Self {
29 Self {
30 agent_id,
31 iteration: 0,
32 max_iterations,
33 responses: Vec::new(),
34 }
35 }
36
37 pub fn increment(&mut self) {
38 self.iteration += 1;
39 }
40
41 pub fn push_response(&mut self, text: String) {
42 self.responses.push(text);
43 }
44
45 pub fn last_response(&self) -> Option<&str> {
46 self.responses.last().map(String::as_str)
47 }
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52pub struct ResumeContext {
53 pub agent_id: String,
54 pub iteration: u32,
55 pub session_snapshot: HashMap<String, Value>,
56}