# Publishing Tasks

A Task is a computational job submitted from a Source. Providers registered for that Source compete to execute it.

## What's in a Task

| Component   | Description                      |
| ----------- | -------------------------------- |
| **Source**  | The execution environment to use |
| **Config**  | Task parameters (JSON)           |
| **Payment** | Amount in $OGPU                  |
| **Expiry**  | Deadline for completion          |

## Publishing a Task

### Via Client App

1. Go to [client.opengpu.network](https://client.opengpu.network)
2. Select your Source
3. Click "New Task"
4. Enter:
   * Configuration (model parameters, inputs, etc.)
   * Payment amount
   * Expiry duration
5. Submit

### Via SDK

```python
task = await client.tasks.submit(
    source_address="0x...",
    config={
        "prompt": "Explain quantum computing",
        "max_tokens": 500,
        "temperature": 0.7
    },
    payment=0.01,
    expiry_minutes=30
)
```

## Task Lifecycle

```
Published → Attempted → Responded → Finalized
    │           │           │           │
    │           │           │           └─ Payment released
    │           │           └─ Result submitted
    │           └─ Provider(s) started executing
    └─ Payment locked in escrow
```

### Possible Statuses

| Status        | Meaning                           |
| ------------- | --------------------------------- |
| **New**       | Published, awaiting attempts      |
| **Attempted** | Provider(s) started executing     |
| **Responded** | Result(s) submitted               |
| **Finalized** | Completed, payment released       |
| **Expired**   | Deadline passed, payment refunded |
| **Canceled**  | Client canceled, payment refunded |

## Retrieving Results

### Via Client App

Results appear in your task history. Download from the UI.

### Via SDK

```python
# Wait for completion
while task.status != "finalized":
    await asyncio.sleep(5)
    task.refresh()

# Get result
result = await task.get_result()
print(result.data)
```

Results are stored on IPFS and linked in the response.

### Via Direct RPC

For full control, interact with the protocol contracts directly via RPC.

## Tips

* **Set realistic expiry times** — Too short may result in no completions
* **Check provider availability** — Ensure providers are registered for your Source
* **Monitor via Management dApp** — Track task progress at [management.opengpu.network](https://management.opengpu.network)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://opengpu-network.gitbook.io/opengpu-network/for-clients/publishing-tasks.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
