ResponsesΒΆ
Learn how to handle task responses on the OpenGPU network. When providers complete your tasks, they submit responses containing computed results that you can retrieve, validate, and confirm.
π― What are Responses?ΒΆ
Responses are the results returned by providers after executing your tasks. Each response contains:
- Result Data: The computed output from your task
- Provider Information: Who executed the task
- Status Indicators: Success/failure status
- Timestamps: When the work was completed
- Confirmation State: Whether the response has been accepted
π Response LifecycleΒΆ
graph LR
A[Task Executed] --> B[Response Submitted]
B --> C[Response Available]
C --> D[Client Reviews]
D --> E[Response Confirmed]
E --> F[Payment Released]
- Execution: Provider completes your task
- Submission: Provider submits response to network
- Availability: Response becomes available for retrieval
- Review: You can check and validate the response
- Confirmation: You confirm the response as acceptable
- Payment: Provider receives payment for completed work
π Response ComponentsΒΆ
Response Data StructureΒΆ
class TaskResponse:
address: str # Unique response identifier
provider: str # Provider wallet address
data: str # The actual result data
status: str # "submitted" or "confirmed"
confirmed: bool # Whether response is confirmed
timestamp: int # When response was submitted
Response StatesΒΆ
- π‘ Submitted: Response submitted but not yet confirmed
- β Confirmed: Response accepted and payment released
π Quick ExampleΒΆ
Here's how to retrieve and confirm a response:
import ogpu.client
# Get all responses for your task
task_address = "0x1234567890abcdef..."
responses = ogpu.client.get_task_responses(task_address)
print(f"π¨ Found {len(responses)} responses")
# Check for confirmed response
confirmed = ogpu.client.get_confirmed_response(task_address)
if confirmed:
print(f"β
Confirmed result: {confirmed.data}")
else:
print("β³ No confirmed response yet")
# Confirm the first submitted response
for response in responses:
if response.status == "submitted" and not response.confirmed:
confirmation_tx = ogpu.client.confirm_response(response.address)
print(f"β
Response confirmed: {confirmation_tx}")
break
π Response TypesΒΆ
Automatic vs Manual ConfirmationΒΆ
Depending on your source configuration, responses can be handled differently:
Automatic Confirmation (FIRST_RESPONSE
)ΒΆ
- First successful response is automatically confirmed
- Faster task completion
- Best for deterministic tasks
Manual Confirmation (MANUAL_CONFIRMATION
)ΒΆ
- You must manually confirm responses
- Allows quality review before payment
- Best for creative or subjective tasks
π― Key OperationsΒΆ
π₯ Retrieve ResponsesΒΆ
Get all submitted responses for your tasks
β Confirm ResponsesΒΆ
Accept a response and release payment
π Monitor StatusΒΆ
Check if any response has been confirmed
π― Next StepsΒΆ
Response Management GuidesΒΆ
- π₯ Retrieving Responses - Learn how to fetch and monitor task responses
- β Confirming Responses - Validate and confirm responses to complete tasks
Ready to handle your task responses! π¨