task)This document describes the task tool for Ollama Code.
Use task to launch a specialized subagent to handle complex, multi-step tasks autonomously. The Task tool delegates work to specialized agents that can work independently with access to their own set of tools, allowing for parallel task execution and specialized expertise.
task takes the following arguments:
description (string, required): A short (3-5 word) description of the task for user visibility and tracking purposes.prompt (string, required): The detailed task prompt for the subagent to execute. Should contain comprehensive instructions for autonomous execution.subagent_type (string, required): The type of specialized agent to use for this task. Must match one of the available configured subagents.task with Ollama CodeThe Task tool dynamically loads available subagents from your configuration and delegates tasks to them. Each subagent runs independently and can use its own set of tools, allowing for specialized expertise and parallel execution.
When you use the Task tool, the subagent will:
Usage:
task(description="Brief task description", prompt="Detailed task instructions for the subagent", subagent_type="agent_name")
The available subagents depend on your configuration. Common subagent types might include:
You can view available subagents by using the /agents command in Ollama Code.
The Task tool provides live updates showing:
You can launch multiple subagents concurrently by calling the Task tool multiple times in a single message, allowing for parallel task execution and improved efficiency.
Each subagent can be configured with:
task examplestask(
description="Code refactoring",
prompt="Please refactor the authentication module in src/auth/ to use modern async/await patterns instead of callbacks. Ensure all tests still pass and update any related documentation.",
subagent_type="general-purpose"
)
# Launch code review and test execution in parallel
task(
description="Code review",
prompt="Review the recent changes in the user management module for code quality, security issues, and best practices compliance.",
subagent_type="code-reviewer"
)
task(
description="Run tests",
prompt="Execute the full test suite and analyze any failures. Provide a summary of test coverage and recommendations for improvement.",
subagent_type="test-runner"
)
task(
description="Update docs",
prompt="Generate comprehensive API documentation for the newly implemented REST endpoints in the orders module. Include request/response examples and error codes.",
subagent_type="documentation-writer"
)
Use the Task tool when:
Don’t use the Task tool for:
Subagents are configured through Ollama Code’s agent configuration system. Use the /agents command to:
For more information on configuring subagents, refer to the subagents documentation.