Runs
The Runs API endpoint allows you to retrieve data about specific runs from your Lunary application.
It supports various filters to narrow down the results according to your needs.
This endpoint supports GET requests and expects query parameters for filtering the results.
Endpoint
Example usage
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
api_key | string | No | API Key for authentication. |
app_id | string | Yes | ID of the application. |
search | string | No | Search term for filtering runs. |
models | array | No | Filter runs by model names. |
tags | array | No | Filter runs by tags. |
type | array | No | Filter runs by types: 'llm', 'tool', 'chain', 'agent'. |
limit | number | No | Maximum number of results to return. Default is 100. |
page | number | No | Page number for pagination. |
order | string | No | Sort order, either 'asc' or 'desc'. |
min_duration | number | No | Minimum duration for filtering runs. |
max_duration | number | No | Maximum duration for filtering runs. |
start_time | string | Yes | Start time for the time window filter in ISO 8601 format. |
end_time | string | Yes | End time for the time window filter in ISO 8601 format. |
Response Format
The response is a JSON object with the following structure:
Main Response Object
Field | Type | Description |
---|---|---|
data | Run[] | An array of run objects. |
total | number | Total number of runs matching the query criteria. |
page | number | Current page number in the pagination. |
limit | number | Number of items per page, as specified in the query. |
Run Object
Each object in the data
array contains the following fields:
Field | Type | Description |
---|---|---|
type | string | The type of the run. |
name | string | The name of the model used. |
createdAt | string | The creation time of the run. |
endedAt | string | The ending time of the run. |
duration | number | Duration of the run in seconds. |
tokens | Token | Object containing details about token usage. |
tags | array | Tags associated with the run. |
input | string | Input provided for the run. |
output | string | Output of the run. |
error | string | Error message, if any. |
user | User | Object containing user information. |
cost | number | Calculated cost of the run. |
Tokens Object
Field | Type | Description |
---|---|---|
completion | number | Number of completion tokens used. |
prompt | number | Number of prompt tokens used. |
total | number | Total number of tokens used. |
User Object
Field | Type | Description |
---|---|---|
id | string | User ID. |
createdAt | string | Creation time of the user. |
lastSeen | string | Last seen time of the user. |
props | object | Additional properties associated with the user. |
Example Response
Error Handling
Standard HTTP status codes are used for error handling:
429
: Rate limit exceeded.422
: Missing or incorrect parameters.403
: Unauthorized access.500
: Internal server error.