agent_usage
Creates, updates, deletes, gets or lists an agent_usage resource.
Overview​
| Name | agent_usage |
| Type | Resource |
| Id | railway.billing.agent_usage |
Fields​
The following fields are returned by SELECT queries:
- get
One AgentUsageSummary row.
| Name | Datatype | Description |
|---|---|---|
billing_period_end | string (date-time) | |
hard_limit_cents | integer | |
has_custom_hard_limit | boolean | |
soft_limit_cents | integer | |
total_used_cents | integer | |
usage_remaining | number |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | workspace_id | Get unified AI usage for a workspace. Backed by the Railway GraphQL query agentUsage. | |
set_limit | exec | hard_limit_cents, workspace_id | soft_limit_cents | Set agent usage limit for a workspace. Backed by the Railway GraphQL mutation agentUsageLimitSet. |
Parameters​
Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
| Name | Datatype | Description |
|---|---|---|
workspace_id | string | |
hard_limit_cents | string | Integer passed as a string, for example '1'. |
soft_limit_cents | string | Integer passed as a string, for example '1'. |
SELECT examples​
- get
Get unified AI usage for a workspace. Backed by the Railway GraphQL query agentUsage.
SELECT
billing_period_end,
hard_limit_cents,
has_custom_hard_limit,
soft_limit_cents,
total_used_cents,
usage_remaining
FROM railway.billing.agent_usage
WHERE workspace_id = '{{ workspace_id }}' -- required
;
Lifecycle Methods​
- set_limit
Set agent usage limit for a workspace. Backed by the Railway GraphQL mutation agentUsageLimitSet.
EXEC railway.billing.agent_usage.set_limit
@hard_limit_cents='{{ hard_limit_cents }}', --required
@workspace_id='{{ workspace_id }}', --required
@soft_limit_cents='{{ soft_limit_cents }}'
;