Skip to content
Proud to collaborate with Microsoft for Startups

ai.chat ​

Send a chat completion via the org's AI CloudConnection (provider-agnostic)

Provider-agnostic LLM chat completion via a user CloudConnection or AIProviderConfig.

Inputs:

  • connection_uuid: UUID of an AI-provider CloudConnection (optional; at least one of connection_uuid / ai_provider_config_uuid must be present, OR the org must have a default config) (OPENAI / ANTHROPIC / BEDROCK / AZURE_OPENAI / GOOGLE_AI / GROK / OLLAMA)
  • ai_provider_config_uuid: UUID of an AIProviderConfig row (optional). When supplied without connection_uuid, the workflow calls data.ai-provider.get to resolve connection_uuid, default_model, and model_config. When neither this nor connection_uuid is present, data.ai-provider.get-default is called for the org. Precedence: explicit connection_uuid > ai_provider_config_uuid > org default.
  • messages: List of {role, content} dicts (required)
  • model: Override the connection's default model (optional; provider prefix is auto-added if missing). Wins over config.default_model when both are present.
  • system_prompt: Optional system instruction prepended as a system message
  • temperature: Sampling temperature 0.0-2.0 (optional). Wins over model_config.temperature when both are present.
  • max_tokens: Max tokens to generate (optional). Wins over model_config.max_tokens when both are present.

Outputs (terminal state_data):

  • response_text: str — the assistant's reply
  • role: str — always "assistant"
  • model_used: str — model id actually used (provider-prefixed)
  • finish_reason: str — stop | length | tool_calls | content_filter
  • input_tokens: int — prompt token count (best-effort)
  • output_tokens: int — completion token count (best-effort)
  • provider: str — connection type used (openai|anthropic|bedrock|…)

Failure reasons (controlled vocabulary on FAILED state):

  • connection_not_found
  • not_an_ai_connection
  • connection_not_active
  • missing_credentials
  • upstream_auth_failed
  • upstream_rate_limited
  • upstream_error
  • litellm_unavailable
  • validation_failed
  • no_ai_provider_configured (new) — neither uuid given and org has no default
  • ai_provider_config_not_found (new) — explicit ai_provider_config_uuid not resolved

Overview ​

PropertyValue
Workflow typeAtomic
LibraryApp-ai
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidNo—UUID of an AI-type CloudConnection in the caller's org. Highest priority: when present, ai_provider_config_uuid and the org-default lookup are skipped entirely.
ai_provider_config_uuiduuidNo—UUID of an AIProviderConfig row. When supplied (and connection_uuid is absent), the workflow calls data.ai-provider.get to resolve connection_uuid, default_model, and model_config. When neither this nor connection_uuid is present, data.ai-provider.get-default is used for the org. Explicit model/temperature/max_tokens always override the resolved config values.
messagesjsonYes—List of {role, content} message objects
modelstringNo—Model override; provider prefix auto-added if missing. Takes precedence over config.default_model.
system_promptstringNo—Optional system instruction
temperaturejsonNo—Sampling temperature 0.0-2.0. Wins over model_config.temperature from the resolved config.
max_tokensintegerNo—Max tokens to generate. Wins over model_config.max_tokens from the resolved config.

Output Schema ​

FieldTypeRequiredDefaultDescription
response_textstringNo——
rolestringNo——
model_usedstringNo——
finish_reasonstringNo——
input_tokensintegerNo——
output_tokensintegerNo——
providerstringNo——
failure_reasonstringNo——
failure_typestringNo——
failed_actionstringNo——
failed_at_statestringNo——
errorstringNo——
error_typestringNo——
failed_layerstringNo——
failed_stepstringNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—execute—
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
pendingexecutecompleted—
* (any state)failfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "ai.chat",
  "initial_data": {
    "messages": "value"
  }
}