Runs
Runs represent the execution of an agent on a message. They are created when a message is sent to an agent or triggered manually using the API.
Run object
Attributes
id
StringA unique identifier for the run.
status
EnumThe current status of the run.
agent_id
StringA unique identifier for the agent that is processing this run.
trigger_message_group_id
StringThe ID of the message group that triggered the run.
cost
ObjectDetails about the cost associated with the run.
message_group
ObjectThe message group created as a result of the run.
errors
Array of ObjectsA list of errors that occurred during the run.
attached_items
Array of ObjectsA list of items attached to the run.
started_at
DateThe date and time when the run started.
created_at
DateThe date and time when the run was created.
completed_at
DateThe date and time when the run was completed.
{"id": "run_Rm4Mnheq2bfEPhBhP7SY","status": "success","agent_id": "agent_Rm4Mnheq2bfEPhBhP7SY","trigger_message_group_id": "mgrp_Rm4Mnheq2bfEPhBhP7SY","cost": {"amount": 1,"unit": "metorial_credits"},"message_group": {"id": "msg_Rm4Mnheq2bfEPhBhP7SY","status": "completed","type": "assistant_message","created_at": "2025-01-01T00:00:00.000Z","thread_id": "thread_Rm4Mnheq2bfEPhBhP7SY","parent_message_group_id": "mgrp_Rm4Mnheq2bfEPhBhP7SY","metadata": {"key": "value"},"messages": [{"id": "msg_Rm4Mnheq2bfEPhBhP7SY","status": "active","type": "content","message_group_id": "mgrp_Rm4Mnheq2bfEPhBhP7SY","thread_id": "thread_Rm4Mnheq2bfEPhBhP7SY","actor": {"id": "act_Rm4Mnheq2bfEPhBhP7SY","name": "John Doe","type": "user","metadata": {"email": "[email protected]","other": "Additional metadata can be included here."},"created_at": "2025-01-01T00:00:00.000Z","updated_at": "2025-01-01T00:00:00.000Z"},"content": {"id": "cnt_Rm4Mnheq2bfEPhBhP7SY","message_item_id": "msg_Rm4Mnheq2bfEPhBhP7SY","attachments": [{"id": "att_Rm4Mnheq2bfEPhBhP7SY","type": "file","file_id": "file_Rm4Mnheq2bfEPhBhP7SY","url": "https://example.com/file_Rm4Mnheq2bfEPhBhP7SY","caption": "Example file"}],"parts": [{"id": "part_Rm4Mnheq2bfEPhBhP7SY","type": "text","text": "Example text"}]},"error": null,"created_at": "2025-01-01T00:00:00.000Z"},{"id": "msg_Rm4Mnheq2bfEPhBhP7SY","status": "active","type": "content","message_group_id": "mgrp_Rm4Mnheq2bfEPhBhP7SY","thread_id": "thread_Rm4Mnheq2bfEPhBhP7SY","actor": {"id": "act_Rm4Mnheq2bfEPhBhP7SY","name": "John Doe","type": "user","metadata": {"email": "[email protected]","other": "Additional metadata can be included here."},"created_at": "2025-01-01T00:00:00.000Z","updated_at": "2025-01-01T00:00:00.000Z"},"content": {"id": "cnt_Rm4Mnheq2bfEPhBhP7SY","message_item_id": "msg_Rm4Mnheq2bfEPhBhP7SY","attachments": [{"id": "att_Rm4Mnheq2bfEPhBhP7SY","type": "file","file_id": "file_Rm4Mnheq2bfEPhBhP7SY","url": "https://example.com/file_Rm4Mnheq2bfEPhBhP7SY","caption": "Example file"}],"parts": [{"id": "part_Rm4Mnheq2bfEPhBhP7SY","type": "text","text": "Example text"}]},"error": null,"created_at": "2025-01-01T00:00:00.000Z"}],"attached_items": [{"id": "itm_Rm4Mnheq2bfEPhBhP7SY","actor": {"id": "act_Rm4Mnheq2bfEPhBhP7SY","name": "John Doe","type": "user","metadata": {"email": "[email protected]","other": "Additional metadata can be included here."},"created_at": "2025-01-01T00:00:00.000Z","updated_at": "2025-01-01T00:00:00.000Z"},"key": "example_key","value": {"example": "value"},"created_at": "2025-01-01T00:00:00.000Z"}],"run": {"id": "run_Rm4Mnheq2bfEPhBhP7SY","agent_id": "act_Rm4Mnheq2bfEPhBhP7SY","status": "success","metadata": {"key": "value"},"started_at": "2025-01-01T00:00:00.000Z","created_at": "2025-01-01T00:00:00.000Z","completed_at": "2025-01-01T00:00:00.000Z"}},"errors": [{"id": "err_Rm4Mnheq2bfEPhBhP7SY","run_id": "run_Rm4Mnheq2bfEPhBhP7SY","code": "ERR001","message": "An error occurred.","metadata": {"additional": "Additional metadata."},"created_at": "2025-01-01T00:00:00.000Z"}],"attached_items": [{"id": "itm_Rm4Mnheq2bfEPhBhP7SY","actor": {"id": "act_Rm4Mnheq2bfEPhBhP7SY","name": "John Doe","type": "user","metadata": {"email": "[email protected]","other": "Additional metadata can be included here."},"created_at": "2025-01-01T00:00:00.000Z","updated_at": "2025-01-01T00:00:00.000Z"},"key": "example_key","value": {"example": "value"},"created_at": "2025-01-01T00:00:00.000Z"},{"id": "itm_Rm4Mnheq2bfEPhBhP7SY","actor": {"id": "act_Rm4Mnheq2bfEPhBhP7SY","name": "John Doe","type": "user","metadata": {"email": "[email protected]","other": "Additional metadata can be included here."},"created_at": "2025-01-01T00:00:00.000Z","updated_at": "2025-01-01T00:00:00.000Z"},"key": "example_key","value": {"example": "value"},"created_at": "2025-01-01T00:00:00.000Z"}],"started_at": "2025-03-14T14:14:46.475Z"}
List runs
Retrieve a list of all runs.
Query Parameters
id
ObjectOptionalFilter results by run IDs.
created_at
ObjectOptionalFilter results by creation date.
started_at
ObjectOptionalFilter results by start date.
completed_at
ObjectOptionalFilter results by completion date.
status
ObjectOptionalFilter results by run status.
curl -X GET https://api.metorial.com/runs \-H "Authorization: Bearer metorial_sk_..."
Get run
Retrieve details for a single run by its unique identifier.
URL Parameters
runId
StringThe unique identifier for the run.
curl -X GET https://api.metorial.com/runs/run_Rm4Mnheq2bfEPhBhP7SY \-H "Authorization: Bearer $$SECRET_TOKEN"
Create run
Create a new run by posting a message to a thread.
Request Body
language
StringOptionalThe language in which the run is to be executed.
country
StringOptionalThe country context for the run.
timezone
StringOptionalThe timezone for the run.
metadata
ObjectOptionalAdditional metadata for the run.
agent_id
StringThe unique identifier for the agent that will process this run.
content
StringThe content of the message to process.
content
ObjectDetailed structure of the message content.
raw_inputs
ObjectOptionalRaw input data associated with the run.
curl -X POST https://api.metorial.com/runs \-H "Authorization: Bearer metorial_sk_..." \-d '{"language": "en","country": "US","timezone": "America/New_York","agent_id": "agent_Rm4Mnheq2bfEPhBhP7SY","content": "Hello, world!","raw_inputs": {"text": "Hello, world!"}}'