This PR introduces a new endpoint that allows users to retrieve the HAR (HTTP Archive) file associated with a specific task. This addition is particularly valuable for AI security agents and developers who need access to raw network traffic data.
Key Features
New GET endpoint: /tasks/{task_id}/har
Streams HAR file content for efficient handling of large files
Uses aiofiles for non-blocking file operations
Motivation
Offers valuable insights into network traffic for debugging and analysis purposes
Enhances the API's utility for users who require detailed HTTP transaction information
Implementation Details
Utilizes StreamingResponse to handle large HAR files without memory issues
Implements error handling for file not found and other potential exceptions
Integrates with existing artifact management system
Testing
Tested with various HAR file sizes to ensure proper streaming behavior
Verified error handling for non-existent tasks and missing HAR files
Add endpoint to stream HAR file for tasks
Overview
This PR introduces a new endpoint that allows users to retrieve the HAR (HTTP Archive) file associated with a specific task. This addition is particularly valuable for AI security agents and developers who need access to raw network traffic data.
Key Features
/tasks/{task_id}/har
aiofiles
for non-blocking file operationsMotivation
Implementation Details
StreamingResponse
to handle large HAR files without memory issuesTesting
Security Considerations
Future Improvements
Feedback Request
I'd appreciate a review on:
Looking forward to your feedback!
Summary:
Adds a new endpoint in
skyvern/forge/sdk/routes/agent_protocol.py
to stream HAR files for tasks using non-blocking operations and error handling.Key points:
GET /tasks/{task_id}/har
endpoint inskyvern/forge/sdk/routes/agent_protocol.py
.StreamingResponse
andaiofiles
.get_task_har
function to retrieve HAR files for tasks.stream_file
function for non-blocking file reading.Generated with :heart: by ellipsis.dev