Skip to main content

ras_agent/domain/
agent_output.rs

1use ras_types::ActionName;
2use serde::{Deserialize, Deserializer, Serialize};
3
4#[derive(Debug, Clone, Serialize, Deserialize)]
5pub struct AgentBrain {
6    #[serde(default, deserialize_with = "null_to_empty")]
7    pub evaluation_previous_goal: String,
8    #[serde(default, deserialize_with = "null_to_empty")]
9    pub memory: String,
10    #[serde(default, deserialize_with = "null_to_empty")]
11    pub next_goal: String,
12}
13
14fn null_to_empty<'de, D>(de: D) -> Result<String, D::Error>
15where
16    D: Deserializer<'de>,
17{
18    Ok(Option::<String>::deserialize(de)?.unwrap_or_default())
19}
20
21#[derive(Debug, Clone, Serialize, Deserialize)]
22pub struct PlanItem {
23    pub step: u32,
24    pub description: String,
25    pub completed: bool,
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct AgentOutput {
30    pub current_state: AgentBrain,
31    pub action: Vec<ActionInvocation>,
32    pub plan: Option<Vec<PlanItem>>,
33    pub current_plan_item: Option<u32>,
34}
35
36#[derive(Debug, Clone, Serialize, Deserialize)]
37pub struct ActionInvocation {
38    pub name: ActionName,
39    pub parameters: serde_json::Value,
40}