KapsoEx.Agent.Runs (kapso_ex v0.1.0)

Copy Markdown View Source

Trigger and control Kapso Agent runs.

Runs are asynchronous: poll get/2 (or the returned status_url) or subscribe to the kapso_agent.run.* project webhooks. When a run is waiting_for_approval, approve or reject the pending tool call.

Summary

Functions

Approves a pending tool call.

Cancels a run.

Creates a run.

Gets a run. Only runs created with the same API key are visible.

Pauses a run.

Rejects a pending tool call.

Resumes a paused run.

Types

result()

@type result() :: {:ok, map()} | {:error, KapsoEx.Error.t()}

Functions

approve(client, run_id, approval_id)

@spec approve(KapsoEx.Client.t(), String.t(), String.t()) :: result()

Approves a pending tool call.

cancel(client, run_id)

@spec cancel(KapsoEx.Client.t(), String.t()) :: result()

Cancels a run.

create(client, attrs)

@spec create(KapsoEx.Client.t(), map() | keyword()) :: result()

Creates a run.

Attributes: mode and input (%{prompt: ...} or %{finding_id: ...}) are required; pass conversation_id to continue a session (same API key and mode), and metadata for your own references.

Built-in modes that accept API runs: "auto", "api", "workflows", "findings", "findings-investigator", "meta-onboarding", "whatsapp-templates" and "whatsapp-flow", plus custom modes with the api surface. Other modes return 422.

Runs.create(client, %{mode: "api", input: %{prompt: "How many conversations failed today?"}})

get(client, run_id)

@spec get(KapsoEx.Client.t(), String.t()) :: result()

Gets a run. Only runs created with the same API key are visible.

pause(client, run_id)

@spec pause(KapsoEx.Client.t(), String.t()) :: result()

Pauses a run.

reject(client, run_id, approval_id)

@spec reject(KapsoEx.Client.t(), String.t(), String.t()) :: result()

Rejects a pending tool call.

resume(client, run_id)

@spec resume(KapsoEx.Client.t(), String.t()) :: result()

Resumes a paused run.