Skip to main content

cloud_agent_tasks

Creates, updates, deletes, gets or lists a cloud_agent_tasks resource.

Overview​

Namecloud_agent_tasks
TypeResource
Idrailway.agents.cloud_agent_tasks

Fields​

The following fields are returned by SELECT queries:

One row per CloudAgentTask. Task lifecycle and correlation. Read cloudAgentTask for the latest session response.

NameDatatypeDescription
idstring
cloud_agent_idstring
requested_by_user_idstring
session_idstring
completed_atstring (date-time)
created_atstring (date-time)
created_viastring (API, MCP)
errorstring
external_refstring
metadataobject
prompt_previewstring
started_atstring (date-time)
statusstring (AWAITING_INPUT, COMPLETED, FAILED, PENDING, RUNNING)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectenvironment_idstatusList task lifecycle records in an environment, newest first. Backed by the Railway GraphQL query cloudAgentTasks.
dispatchexecenvironment_id, project_id, promptagent_name, cloud_agent_id, external_ref, idempotency_key, metadata, mode, output_schema, reply_to_task_id, session_id, source, webhook_secret, webhook_urlStart a task and return its handle. Creates a fresh agent by default; replyToTaskId continues the original conversation. Backed by the Railway GraphQL mutation cloudAgentTaskDispatch.

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
environment_idstring
statusstring
agent_namestring
cloud_agent_idstringExplicit agent reuse. Omit all targets to create a fresh agent.
external_refstring
idempotency_keystring
metadataobject
modestring(FOLLOW_UP, PROMPT, STEER)
output_schemaobjectJSON Schema object for structured output; requires PROMPT mode.
project_idstring
promptstring
reply_to_task_idstringContinue this task's original agent/session. Mutually exclusive with cloudAgentId/sessionId.
session_idstringExisting session to continue; requires cloudAgentId.
sourceobjectJSON object of GraphQL type CloudAgentSourceInput; keys keep the API's camelCase names.
webhook_secretstring
webhook_urlstring

SELECT examples​

List task lifecycle records in an environment, newest first. Backed by the Railway GraphQL query cloudAgentTasks.

SELECT
id,
cloud_agent_id,
requested_by_user_id,
session_id,
completed_at,
created_at,
created_via,
error,
external_ref,
metadata,
prompt_preview,
started_at,
status
FROM railway.agents.cloud_agent_tasks
WHERE environment_id = '{{ environment_id }}' -- required
AND status = '{{ status }}'
;

Lifecycle Methods​

Start a task and return its handle. Creates a fresh agent by default; replyToTaskId continues the original conversation. Backed by the Railway GraphQL mutation cloudAgentTaskDispatch.

EXEC railway.agents.cloud_agent_tasks.dispatch
@environment_id='{{ environment_id }}', --required
@project_id='{{ project_id }}', --required
@prompt='{{ prompt }}', --required
@agent_name='{{ agent_name }}',
@cloud_agent_id='{{ cloud_agent_id }}',
@external_ref='{{ external_ref }}',
@idempotency_key='{{ idempotency_key }}',
@metadata='{{ metadata }}',
@mode='{{ mode }}',
@output_schema='{{ output_schema }}',
@reply_to_task_id='{{ reply_to_task_id }}',
@session_id='{{ session_id }}',
@source='{{ source }}',
@webhook_secret='{{ webhook_secret }}',
@webhook_url='{{ webhook_url }}'
;