워크플로우 이벤트 엔드포인트

워크플로우 이벤트 엔드포인트 (Workflows Events Endpoints)

Workflows API - events입니다. 워크플로우 실행 중 발생하는 이벤트를 SSE로 스트리밍하거나 목록으로 조회하는 엔드포인트예요.

출처: 문서

본문

워크플로우 실행 동안의 상태 변화를 이벤트로 받아보는 API입니다. 실시간으로 흐름을 지켜보고 싶다면 스트림을, 지난 이벤트를 확인하고 싶다면 목록 조회를 쓰면 돼요.

GET /v1/workflows/events/stream — Get Stream Events (이벤트 스트림)

워크플로우 이벤트를 Server-Sent Events(SSE)로 스트리밍합니다. root_workflow_exec_id, parent_workflow_exec_id, workflow_exec_id 중 하나는 필수예요.

응답 (200): 타입 event-stream<ResponseBody> — SSE 스트림.

  • ResponseBody — {object}

curl:

curl https://api.mistral.ai/v1/workflows/events/stream \
 -X GET \
 -H 'Authorization: Bearer ***'

TypeScript:

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: proces...EY"] ?? "",
});

async function run() {
  const result = await mistral.workflows.events.getStreamEvents({});

  for await (const event of result) {
    console.log(event);
  }
}

run();

GET /v1/workflows/events/list — Get Workflow Events (워크플로우 이벤트 조회)

워크플로우 이벤트 목록을 가져옵니다.

응답 필드 (200 Successful Response):

  • events#array<WorkflowExecutionStartedResponse|WorkflowExecutionCompletedResponse|WorkflowExecutionFailedResponse|WorkflowExecutionCanceledResponse|WorkflowExecutionContinuedAsNewResponse|WorkflowTaskTimedOutResponse|WorkflowTaskFailedResponse|CustomTaskStartedResponse|CustomTaskInProgressResponse|CustomTaskCompletedResponse|CustomTaskFailedResponse|CustomTaskTimedOutResponse|CustomTaskCanceledResponse|ActivityTaskStartedResponse|ActivityTaskCompletedResponse|ActivityTaskRetryingResponse|ActivityTaskFailedResponse> (필수) — 워크플로우 이벤트 목록.
  • next_cursor#string|null — 페이지네이션 커서.

curl:

curl https://api.mistral.ai/v1/workflows/events/list \
 -X GET \
 -H 'Authorization: Bearer ***'

TypeScript:

import { Mistral } from "@mistralai/mistralai";

const mistral = new Mistral({
  apiKey: proces...EY"] ?? "",
});

async function run() {
  const result = await mistral.workflows.events.getWorkflowEvents({});

  console.log(result);
}

run();

응답 예시 (200):

{
  "events": [
    {
      "attributes": {
        "input": {
          "value": "approved"
        },
        "task_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
        "workflow_name": "support-workflow"
      },
      "chain_run_id": null,
      "continued_run_id": null,
      "event_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
      "event_timestamp": 87,
      "first_execution_run_id": null,
      "parent_workflow_exec_id": null,
      "root_workflow_exec_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
      "schedule_id": null,
      "workflow_exec_id": "019b2bd7-96e7-7219-8c0b-45a73da50088",
      "workflow_name": "support-workflow",
      "workflow_run_id": "019b2bd7-96e7-7219-8c0b-45a73da50088"
    }
  ]
}

더 알아보기 (Learn more)