Runs
Runs an assistant over the thread; one run at a time.
Updated on Aug 10, 2026
The run brings the three pieces together: the assistant (the configuration), the thread (the conversation), and the moment. It supports streaming, like chat.
https://api.hinow.ai/v1/threads/{thread_id}/runsBearerRuns an assistant over the thread. Supports streaming.
Parâmetros
thread_idstring· pathobrigatórioassistant_idstring· bodyobrigatóriostreamboolean· bodyRun created
modelstring· bodyOne run at a time
instructionsstring· bodyA thread does not accept two simultaneous runs: the second one comes back with `409 thread_busy`. In chat interfaces, disable sending until the previous run has finished.
additional_instructionsstring· bodyAcrescenta ao fim das instruções, sem substituí-las.
additional_messagesarray· bodyMensagens acrescentadas à thread antes de rodar.
toolsarray· bodySobrepõe as ferramentas neste run.
temperaturenumber· bodytop_pnumber· bodymax_completion_tokensinteger· bodyCorte de saída — estourou, o run termina incomplete.
truncation_strategyobject· body{"type": "last_messages", "last_messages": N} limita o histórico enviado ao modelo.
response_formatstring | object· bodymetadataobject· body
Respostas
| Status | Significado |
|---|---|
queued | Aceito, aguardando vaga de execução. |
in_progress | O modelo está trabalhando. |
requires_action | O modelo chamou suas funções — envie os resultados em submit_tool_outputs (veja Chamada de funções). |
completed | Terminou; a resposta está na thread. |
incomplete | Terminou cortado — incomplete_details.reason diz o motivo (max_completion_tokens, max_tool_loops). |
cancelling / cancelled | Cancelamento pedido / concluído. |
failed | Erro de execução — detalhes em last_error. |
expired | Passou do prazo de 10 minutos sem concluir (inclui requires_action sem resposta). |
RUN=$(curl -s https://api.hinow.ai/v1/threads/$THREAD/runs \
-H "Authorization: Bearer hi_SUA_API_KEY" -H "Content-Type: application/json" \
-d '{"assistant_id": "asst_..."}' | jq -r .id)
# consulte até sair de queued/in_progress
curl -s https://api.hinow.ai/v1/threads/$THREAD/runs/$RUN \
-H "Authorization: Bearer hi_SUA_API_KEY" | jq '{status, usage}'Com stream: true, a resposta é um stream text/event-stream com os mesmos eventos da OpenAI — os SDKs e handlers existentes funcionam sem mudança:
thread.run.created→thread.run.queued→thread.run.in_progressthread.run.step.created/.in_progress/.delta/.completedthread.message.created/.in_progress/.delta(o texto chega aqui) /.completed- terminal:
thread.run.completed,.requires_action,.incomplete,.failed,.cancelled,.expired - e por fim
donecomdata: [DONE].
https://api.hinow.ai/v1/threads/runsBearerCria a thread e já executa — o atalho para conversas novas.
Parâmetros
assistant_idstring· bodyobrigatóriothreadobject· body{"messages": [...], "metadata": {...}} — o corpo de um create thread.
streamboolean· body
Respostas
curl -s -X POST https://api.hinow.ai/v1/threads/$THREAD/runs/$RUN/cancel \
-H "Authorization: Bearer hi_SUA_API_KEY"
# → status: "cancelling"; em seguida "cancelled".
# O cancelamento aborta inclusive a chamada de modelo em voo.Cada run registra seus passos — message_creation (a resposta) e tool_calls (ferramentas, com argumentos e resultados). É a trilha de auditoria da execução:
curl -s "https://api.hinow.ai/v1/threads/$THREAD/runs/$RUN/steps?order=asc" \
-H "Authorization: Bearer hi_SUA_API_KEY"Uma execução por vez
Uma thread não aceita dois runs simultâneos: o segundo volta com 400 invalid_request_error (“Thread ... already has an active run ...”). Em interfaces de chat, desabilite o envio enquanto a execução anterior não terminar. Runs expiram em 10 minutos — inclusive os parados em requires_action.

