Skip to content

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]
  1. Execution: Provider completes your task
  2. Submission: Provider submits response to network
  3. Availability: Response becomes available for retrieval
  4. Review: You can check and validate the response
  5. Confirmation: You confirm the response as acceptable
  6. 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)ΒΆ

# In your source configuration
deliveryMethod=ogpu.client.DeliveryMethod.FIRST_RESPONSE
- First successful response is automatically confirmed - Faster task completion - Best for deterministic tasks

Manual Confirmation (MANUAL_CONFIRMATION)ΒΆ

# In your source configuration  
deliveryMethod=ogpu.client.DeliveryMethod.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

responses = ogpu.client.get_task_responses(task_address)

βœ… Confirm ResponsesΒΆ

Accept a response and release payment

ogpu.client.confirm_response(response_address)

πŸ” Monitor StatusΒΆ

Check if any response has been confirmed

confirmed = ogpu.client.get_confirmed_response(task_address)

🎯 Next Steps¢

Response Management GuidesΒΆ

Ready to handle your task responses! πŸ“¨