This commit is contained in:
parent
ce5d2c9fb4
commit
b9c6c831c1
3 changed files with 36 additions and 12 deletions
|
|
@ -59,6 +59,7 @@ pub async fn execute_agent_run(
|
|||
goal: String,
|
||||
) -> AppResult<TaskResponse> {
|
||||
let run_id = Uuid::new_v4();
|
||||
tracing::info!(%task_id, %run_id, "Starting agent execution run");
|
||||
|
||||
let new_run = task_run::ActiveModel {
|
||||
id: Set(run_id),
|
||||
|
|
@ -81,12 +82,18 @@ pub async fn execute_agent_run(
|
|||
)?;
|
||||
|
||||
let (logs, answer, status) = match agent.run(config).await {
|
||||
Ok((logs, answer)) => (logs, answer, "completed".to_string()),
|
||||
Err(e) => (
|
||||
format!("Execution failed: {}", e),
|
||||
None,
|
||||
"failed".to_string(),
|
||||
),
|
||||
Ok((logs, answer)) => {
|
||||
tracing::info!(%task_id, %run_id, "Agent execution completed successfully");
|
||||
(logs, answer, "completed".to_string())
|
||||
}
|
||||
Err(e) => {
|
||||
tracing::error!(%task_id, %run_id, error = %e, "Agent execution failed");
|
||||
(
|
||||
format!("Execution failed: {}", e),
|
||||
None,
|
||||
"failed".to_string(),
|
||||
)
|
||||
}
|
||||
};
|
||||
|
||||
let run: task_run::ActiveModel = TaskRun::find_by_id(run_id)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue