aether_evals/agents/
agent.rs1use crate::{Task, containers::ContainerError};
2use aether_core::events::AgentEvent;
3use futures::Stream;
4use thiserror::Error;
5
6pub type AgentRunResult = Result<AgentEvent, RunError>;
7
8pub trait Agent: Send + Sync {
19 fn run(&self, task: Task) -> impl Stream<Item = AgentRunResult> + Send + '_;
20}
21
22#[derive(Debug, Error)]
24pub enum RunError {
25 #[error("Agent execution failed: {0}")]
26 ExecutionFailed(String),
27
28 #[error("Agent configuration error: {0}")]
29 ConfigurationError(String),
30
31 #[error("Agent command exited with code {exit_code}: {stderr}")]
32 CommandExitNonzero { exit_code: i64, stderr: String },
33
34 #[error("Agent command exited without emitting a terminal AgentEvent: {stderr}")]
35 CommandExitWithoutTerminal { stderr: String },
36
37 #[error("Agent command emitted invalid AgentEvent JSON line: {line}")]
38 AgentEventJsonLine {
39 line: String,
40 #[source]
41 source: serde_json::Error,
42 },
43
44 #[error(transparent)]
45 Container(#[from] ContainerError),
46}