task_tools#

Built-in planning tools for the predefined reasoning state.

Three tools — add_tasks, complete_task, skip_task — that read and write a request-scoped TaskList. They are NOT registered on the agent’s permanent tool registry: a fresh Tool instance is built per baf.library.state.reasoning_state_library.reasoning_body() invocation via build_task_tools(), so each user request gets its own task list and the tool closures cannot leak state between requests.

Compared with the universal workspace tools in baf.library.tool.workspace_tools, the task tools have additional runtime dependencies — they emit task_added / task_completed / task_skipped reasoning step events alongside the mutation, and forward a fresh task-list snapshot to the streaming UI. The reasoning loop wires these in by passing session + stream_steps + a single-element step_cell that holds the current iteration number.

baf.library.tool.task_tools.build_task_tools(task_list, session, stream_steps, step_cell)[source]#

Build the three planning Tool instances that close over a single task_list.

These are private to a single reasoning_body invocation. After each successful task-list mutation the tools also forward a reasoning_step event and a task_list_update snapshot to the session’s platform (via the helpers in baf.library.state.reasoning_state_library). The current loop iteration is read from step_cell[0] — the body updates it once per iteration so task-tool callers don’t need to know it.

Parameters:
  • task_list (TaskList) – the request-scoped task list these tools mutate.

  • session (Session) – the user session — used to emit step / task-list events back to the UI.

  • stream_steps (bool) – whether to forward step / task-list events to session.platform. False disables the streaming hooks.

  • step_cell (list) – a 1-element mutable cell whose [0] value is the current loop iteration number; the reasoning body updates it.

Returns:

[add_tasks_tool, complete_task_tool, skip_task_tool].

Return type:

list[Tool]