Flip status to ``completed``, stash the final text, schedule eviction.
(
task_id: str,
*,
result_text: str,
registry: "RuntimeTaskRegistry",
)
| 275 | |
| 276 | |
| 277 | def complete_agent_task( |
| 278 | task_id: str, |
| 279 | *, |
| 280 | result_text: str, |
| 281 | registry: "RuntimeTaskRegistry", |
| 282 | ) -> None: |
| 283 | """Flip status to ``completed``, stash the final text, schedule eviction.""" |
| 284 | def _complete(prev: TaskStateBase) -> TaskStateBase: |
| 285 | if not isinstance(prev, LocalAgentTaskState): |
| 286 | return prev |
| 287 | if is_terminal_task_status(prev.status): |
| 288 | return prev |
| 289 | return _terminal_replace(prev, status="completed", result_text=result_text) |
| 290 | |
| 291 | registry.update(task_id, _complete) |
| 292 | |
| 293 | |
| 294 | def fail_agent_task( |