Messages

Append a message to a thread

Changed on

Append a user message to an existing thread and trigger a deferred run. When the thread already has a run in flight the message is queued, not refused: the response reports queued with the run ID the message's own run will start under after the earlier run ends. Queued messages run one at a time in the order they were appended. With wait, the server waits for the message's own run and never returns the earlier run's result.

post/threads/{threadId}/messages

Request

  • Base URL: https://api.sazabi.com/v1
  • URL: https://api.sazabi.com/v1/threads/{threadId}/messages
  • Auth: none declared

Path parameters

threadIdstring uuid required

Thread ID to append the message to.

Request body

messagestring required

Message body to append to the thread.

waitboolean

Whether the server should wait for the appended message run before responding.

timeoutSecondsinteger

Maximum seconds to wait when wait is true before handing off to polling.

automationIdstring uuid

Internal automation context. Set by the Sazabi CLI when an automation script starts an agent run.

Response

OK

completedboolean required

Whether the run has reached a terminal status.

threadIdstring uuid required

Thread ID associated with the run.

runIdstring uuid required

Run ID for subsequent polling. For a queued follow-up this is the ID its run will start under once the thread's earlier run ends; polling it reports queued until then and never the earlier run's result.

messageIdstring uuid

ID of the user message that triggered this run.

status'queued' | 'processing' | 'completed' | 'aborted' | 'error' required

Current run lifecycle status. queued: the message is waiting behind the thread's run in flight and has not started; it starts after that run ends, whatever that run's outcome, unless the queued message is cancelled with runs.cancel.

responsestring nullable required

Assistant response text when the run has completed.

failureClass'billing_account_missing' | 'subscription_missing' | 'subscription_blocked' | 'credit_balance_missing' | 'credit_balance_depleted' | 'billing_admission_unavailable' | 'ambient_denied' | 'permission' | 'policy' | 'provider' | 'provider_rejected' | 'cancelled' | 'timeout' | 'rate_limit' | 'grpc_message_too_large' | 'sandbox_concurrency' | 'sandbox_missing' | 'sandbox_failed' | 'tool_failed' | 'workflow_start_failed' | 'workflow_died' | 'unknown' nullable required

Machine-readable reason the run ended in error. Null unless the run failed. A class this client does not recognize means an unclassified failure, not an error.

failureRetryableboolean nullable required

Whether retrying the identical request is worth attempting. Null when there is no answer: the run did not fail, or its failure is unclassified.

Changes

    • warning

      added the new queued enum value to the response property for the response status

    • warning

      removed the request property

    • warning

      added the new billing_account_missing enum value to the / response property for the response status

    • warning

      added the new billing_admission_unavailable enum value to the / response property for the response status

    • warning

      added the new credit_balance_depleted enum value to the / response property for the response status

    • warning

      added the new credit_balance_missing enum value to the / response property for the response status

    • warning

      added the new subscription_blocked enum value to the / response property for the response status

    • warning

      added the new subscription_missing enum value to the / response property for the response status