Skip to content

feat: add Task Result API support with example and unit tests#156

Open
TanyaSingh369-svg wants to merge 3 commits into
next-1.0.0from
feature/task-result-api
Open

feat: add Task Result API support with example and unit tests#156
TanyaSingh369-svg wants to merge 3 commits into
next-1.0.0from
feature/task-result-api

Conversation

@TanyaSingh369-svg
Copy link
Copy Markdown
Contributor

@TanyaSingh369-svg TanyaSingh369-svg commented May 12, 2026

Summary

Adds support for the Task Result API in the Python SDK.

This enables retrieving run task results via task_result_id, including full model representation, resource integration, and example usage.

Changes

  • Added TaskResult model with all relevant fields and enums
  • Added TaskResults resource with read method
  • Updated client to expose task_results API
  • Updated task stage model to include task result relationship
  • Added example (examples/task_result.py) demonstrating usage with task_result_id
  • Added unit tests for task result functionality

Testing

  • Verified using real task_result_id values retrieved via:
    GET /runs/{run_id}/task-stages
  • Confirmed correct parsing of API response into model
  • Unit tests added to validate functionality

Validation

Unit Test

python -m pytest tests/units/test_task_results.py -v

Result:
All tests passed successfully

Screenshot 2026-05-13 at 1 40 50 AM

Example Execution

export TFE_TASK_RESULT_ID=<task_result_id>
PYTHONPATH=. python examples/task_result.py

Result:
- Successfully retrieved and displayed Task Result from API
- Verified correct parsing of response into SDK model

Screenshot 2026-05-13 at 1 42 45 AM

@TanyaSingh369-svg TanyaSingh369-svg requested a review from a team as a code owner May 12, 2026 15:49

return self._parse_task_result(data["data"])

def _parse_task_result(self, data: dict[str, Any]) -> TaskResult:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task stage relation was not mapped to the read output and the response shows None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants