Core Attributes
Attribute | Type | Description |
---|---|---|
description | str | A clear, concise statement of what the task entails |
tools | List[Any] | The tools/resources the agent can use for this task |
response_format | Union[Type[BaseModel], type[str], None] | The expected output format (string, Pydantic model, or None) |
context | Any | Other tasks whose outputs will be used as context for this task |
attachments | Optional[List[str]] | File paths to attach to the task (images, documents, etc.) |
Advanced Configuration
Attribute | Type | Description |
---|---|---|
enable_thinking_tool | Optional[bool] | Whether to enable the thinking tool for complex reasoning |
enable_reasoning_tool | Optional[bool] | Whether to enable the reasoning tool for multi-step analysis |
guardrail | Optional[Callable] | Function to validate task output before proceeding |
guardrail_retries | Optional[int] | Maximum number of retries when guardrail validation fails |
enable_cache | bool | Whether to enable caching for this task |
cache_method | Literal[“vector_search”, “llm_call”] | Method to use for caching |
cache_threshold | float | Similarity threshold for cache hits (0.0-1.0) |
cache_duration_minutes | int | How long to cache results in minutes |
Complete Example
Here’s a comprehensive example that demonstrates how to use various task attributes together:Best Practices
- Description: Be specific and clear about what the task should accomplish
- Tools: Only include tools that are relevant to the task to avoid confusion
- Response Format: Use structured formats (Pydantic models) for complex data
- Caching: Enable caching for expensive operations that might be repeated
- Guardrails: Implement validation functions for critical tasks to ensure output quality