Manage the current todos.
(todos: list[Todo], runtime: ToolRuntime)
| 17 | |
| 18 | @tool |
| 19 | def manage_todos(todos: list[Todo], runtime: ToolRuntime) -> Command: |
| 20 | """ |
| 21 | Manage the current todos. |
| 22 | """ |
| 23 | # Ensure all todos have IDs that are unique |
| 24 | for todo in todos: |
| 25 | if "id" not in todo or not todo["id"]: |
| 26 | todo["id"] = str(uuid.uuid4()) |
| 27 | |
| 28 | # Update the state |
| 29 | return Command(update={ |
| 30 | "todos": todos, |
| 31 | "messages": [ |
| 32 | ToolMessage( |
| 33 | content="Successfully updated todos", |
| 34 | tool_call_id=runtime.tool_call_id |
| 35 | ) |
| 36 | ] |
| 37 | }) |
| 38 | |
| 39 | @tool |
| 40 | def get_todos(runtime: ToolRuntime): |
nothing calls this directly
no outgoing calls
no test coverage detected