Execute the agent loop for a prompt Takes the conversation history and a new user prompt. Returns the agent result and updated message history. When event_tx is provided, uses streaming LLM API for real-time text output.
(
&self,
history: &[Message],
prompt: &str,
event_tx: Option<mpsc::Sender<AgentEvent>>,
)
| 10 | /// Returns the agent result and updated message history. |
| 11 | /// When event_tx is provided, uses streaming LLM API for real-time text output. |
| 12 | pub async fn execute( |
| 13 | &self, |
| 14 | history: &[Message], |
| 15 | prompt: &str, |
| 16 | event_tx: Option<mpsc::Sender<AgentEvent>>, |
| 17 | ) -> Result<AgentResult> { |
| 18 | self.execute_with_session(history, prompt, None, event_tx, None) |
| 19 | .await |
| 20 | } |
| 21 | |
| 22 | /// Execute the agent loop with pre-built messages (user message already included). |
| 23 | /// |