---
updatedAt: 2026-09-28T03:08:02.000Z
agentTools:
  projectIndex: https://docs.ascerta.com/llms.txt
---

# Handling Successful Requests

# The `xproxy_result` Object

The `xproxy_result` object contains essential information about a request's execution, including cost calculations and limit status. It is returned whenever a request completes successfully (HTTP 200) and under certain failure conditions, such as when a limit blocks a request (HTTP 400).

## Availability by Integration Method

Where and how you can access the `xproxy_result` object depends on your integration method:

### Direct Provider Call with Telemetry (Recommended Approach)

#### Using @track decorator or track\_context() function

When using the `@track` decorator or `track_context()` function with direct provider calls the `ascerta` instrumentation automatically submits telemetry data to the Ingest API. Upon successful submission, the instrumentation will add an `xproxy_result` attribute to the providers repsonse object.

Example of how to access the attribute:

```python
def call_inference_provider():
  with track_context():
    # Placehold for your inference call
    response = provider.create()

    # Telemetry submission can fail (transient network errors, service unavailable, etc) 
		# so it is not guaranteed that the `xproxy_result` attribute has been added
    if hasattr(response, 'xproxy_result'):
        xproxy_result = getattr(response, xproxy_result)
        print(f"ascerta request id: {xproxy_result.request_id}")

```

In addition to the added attribute on the response the last `xproxy_result` result can be accessed by calling [get\_context()](https://docs.ascerta.com/docs/get_context) immediately after the inference call.

<br />

#### Without @track decorator or track\_context() function

When making a direct call to a GenAI provider without using the `@track` decorator or `track_context()` function:

* You will need to manually call the [Ingest API](/docs/manual-event-submission) to submit telemetry data
* The Ingest API call will return the `xproxy_result` object containing cost calculations and limit status
* For Python applications, see the [Python SDK Ingest API](/docs/python-sdk-ingest#response-handling) documentation for details on response handling
* For other languages, see the [REST Ingest API](/docs/rest-ingest#api-response) documentation for details on the response format

## xproxy\_result Fields

<Table align={["left","left"]}>
  <thead>
    <tr>
      <th>
        Field
      </th>

      <th>
        Description
      </th>
    </tr>
  </thead>

  <tbody>
    <tr>
      <td>
        `request_id`
      </td>

      <td>
        An identifier that can later be used to update request properties or reference this specific request for debugging
      </td>
    </tr>

    <tr>
      <td>
        `resource_id`
      </td>

      <td>
        An identifier that references the specific <Glossary>Resource</Glossary> used in the request. This is returned as an opaque ID and not a name (e.g. 'gpt-4o') because resources are versioned, and the version used will differ based on the timestamp of the request. See [Resource Versions](/docs/custom-categories-and-resources#resource-versions) for more information.
      </td>
    </tr>

    <tr>
      <td>
        `use_case_id`
      </td>

      <td>
        The `use_case_id` used for the request. See [Use Cases (Continued)](/docs/use-cases-continued) for more information. When Ascerta generates a new `use_case_id`, this field contains the generated value.
      </td>
    </tr>

    <tr>
      <td>
        `limits`
      </td>

      <td>
        A dictionary containing all \*\*`limit-id`\*\*s that were passed in as part of the request, and their [Limit States](/docs/limits-continued#limit-states) after the request was completed.
      </td>
    </tr>

    <tr>
      <td>
        `cost`
      </td>

      <td>
        The breakdown of how much this request costs across input and output units.

        The cost of the call, as charged by the <Glossary>Provider</Glossary> is called the `base` cost.

        When a request has failed, usually due to being blocked by a limit, there is no cost and therefore this field is not returned.
      </td>
    </tr>

    <tr>
      <td>
        `blocked_limit_ids`
      </td>

      <td>
        If a request is blocked by one or more limits, then this array contains the list of \*\*`limit-id`\*\*s responsible for blocking the call. See the [Example Unsuccessful Request](/docs/handling-errors#example-unsuccessful-request-400) section for more information.

        This array is only present if the call was blocked by one or more limits.
      </td>
    </tr>
  </tbody>
</Table>