Basic Result Access
Task Metadata
Cost Information
Tool Call History
Cache Information
Task State Information
Complete Example
Available Properties and Methods
Property/Method | Type | Description |
---|---|---|
response | Any | The task’s response output |
task_id | str | Unique task identifier |
price_id | str | Price tracking identifier |
duration | float | Task execution duration in seconds |
total_cost | float | Estimated cost in USD |
total_input_token | int | Number of input tokens used |
total_output_token | int | Number of output tokens generated |
tool_calls | List[Dict] | History of tool calls made |
get_cache_stats() | Dict | Cache statistics and configuration |
get_task_id() | str | Formatted task ID for display |
Best Practices
- Result Validation: Always check if results are None before processing
- Error Handling: Handle cases where metadata might not be available
- Cost Monitoring: Track costs for budget management
- Performance Analysis: Use duration metrics for optimization
- Tool Debugging: Review tool call history for debugging complex workflows
- Cache Optimization: Monitor cache hit rates to optimize caching strategies