This document describes the A2A task management feature that provides an improved UX for managing background tasks.
The task management feature provides a dedicated interface for viewing and managing A2A background tasks, similar to the conversation selection interface. This provides a comprehensive task management system with better visibility into task status and history.
- Shows a simple task count badge
(N)in the header when there are active background tasks - Removes the detailed task display from the main interface for a cleaner look
- Access: Type
/tasksin the chat, or press↓in the chat input, select the⚙background-jobs indicator with←/→, and pressenter - Requirements: The
/tasksshortcut requires A2A to be enabled in configuration; the status-indicator route works whenever the⚙indicator shows running jobs (shells, subagents, or A2A tasks) - Default View: Opens in "All" view showing both active and completed tasks
- Views: Switch between Active, Completed, and All tasks using number keys 1, 2, 3
↑/↓orj/k: Navigate between tasksiorEnter: View detailed task informationc: Cancel the selected active task/: Search tasks by agent name, task ID, or statusr: Refresh task listqorEsc: Exit task management interface
When viewing task details (i key), you can see:
- Task ID
- Agent name and URL
- Current status
- Start time and elapsed duration
- Context ID (if available)
- Completed and canceled tasks are retained in-memory for easy reference
- Default retention: 5 tasks (configurable via
a2a.task.completed_task_retention) - Tasks are ordered by completion time (most recent first)
- Automatic cleanup when retention limit is exceeded
- Note: Retained tasks are lost when the CLI application exits (not persisted to disk)
/tasks
Or, without typing a command: press ↓ in the chat input (while not navigating input
history), move to the ⚙ background-jobs indicator with ←/→, and press enter.
- Open task management with
/tasks - Navigate to the task you want to cancel
- Press
cto cancel - Confirm with
yor cancel withn
- Open task management with
/tasks - Navigate to any task
- Press
iorEnterto view detailed information - Press
i,Esc, orqto close the details view
- Open task management with
/tasks - Press
/to enter search mode - Type your search query (searches agent name, task ID, status)
- Press
Enterto confirm orEscto cancel search
The task management feature is automatically enabled when A2A is enabled in your configuration:
a2a:
enabled: true
task:
completed_task_retention: 5 # Number of completed tasks to retain (default: 5)
# ... other A2A settingsConfiguration options:
completed_task_retention: Maximum number of completed/canceled tasks to retain in memory for viewing (default: 5)
If A2A is disabled, the /tasks command will show an error message.
- Task Manager:
TaskManagerImpl(internal/ui/components/task_management_view.go) - Main UI component for task management - Task Shortcut:
A2ATaskManagementShortcut(internal/shortcuts/task_management.go) - Handles the/taskscommand - State Manager: Manages in-memory task retention using
RetainedTaskInfostructs - Events: Uses
TasksLoadedEventandTaskCancelledEventfor state management
- Active tasks are loaded from background task polling state in
StateManager - Completed tasks are stored in-memory using
RetainedTaskInfowith automatic retention limits - Task retention is managed by
StateManagermethods:AddTaskToInMemoryRetention(),GetRetainedTasks(), etc. - UI state includes current view (Active/Completed/All), search query, selection, and info display modes
ViewStateA2ATaskManagement: Dedicated view state for task management- Proper transitions back to chat view when exiting
- Integration with existing view management system
The feature includes comprehensive tests for:
- Task retention service functionality
- Task management shortcut behavior
- Task cancellation and completion flow
- A2A configuration requirements
Run tests with:
go test ./internal/ui/components/ -v -run TestTaskRetention
go test ./internal/shortcuts/ -v -run TestTaskManagement