Skip to main content

agent_usage

Creates, updates, deletes, gets or lists an agent_usage resource.

Overview​

Nameagent_usage
TypeResource
Idrailway.billing.agent_usage

Fields​

The following fields are returned by SELECT queries:

One AgentUsageSummary row.

NameDatatypeDescription
billing_period_endstring (date-time)
hard_limit_centsinteger
has_custom_hard_limitboolean
soft_limit_centsinteger
total_used_centsinteger
usage_remainingnumber

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectworkspace_idGet unified AI usage for a workspace. Backed by the Railway GraphQL query agentUsage.
set_limitexechard_limit_cents, workspace_idsoft_limit_centsSet 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.

NameDatatypeDescription
workspace_idstring
hard_limit_centsstringInteger passed as a string, for example '1'.
soft_limit_centsstringInteger passed as a string, for example '1'.

SELECT examples​

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 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 }}'
;