Basic usage
Use thereportProgress function from the context object:
Progress with known total
When you know the total number of items or bytes:Progress with bytes
Report progress for file operations using bytes:Progress without known total
For indeterminate operations, report progress as a percentage:Combining with logging
Provide both progress updates and detailed logs:Progress with streaming
Combine progress with streaming output:Best practices
1
Update progress regularly
Update progress frequently enough to provide smooth feedback, but not so often that it impacts performance.
2
Always report completion
Always report 100% progress when the operation completes.
3
Use meaningful units
Choose progress units that make sense for your operation (items, bytes, percentage).
4
Handle errors gracefully
Don’t report progress if an error occurs.
Performance considerations
Next steps
Streaming Output
Learn about streaming partial results
Logging
Add detailed logging to your tools