data.ai-provider.persist ​
Create or update an AIProviderConfig linking a CloudConnection to AI-specific settings
Persist an AIProviderConfig: create new or update existing row.
Input: organization_uuid, connection_uuid, default_model, plus optional model_config, rate_limit_rpm, rate_limit_tpm, is_default, actor. Output in state_data: ai_provider_config_uuid, persisted, created, persisted_at.
Idempotency key: (organization_id, connection_id). A second call with the same pair updates the row in place; no duplicate is inserted.
Overview ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-connection |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
organization_uuid | uuid | Yes | — | UUID of the organization that owns the AI provider config |
connection_uuid | uuid | Yes | — | UUID of the CloudConnection being attached as AI provider |
default_model | string | Yes | — | Default model ID (e.g. 'gpt-4o-mini', 'MiniMax-M2') |
models | list | No | — | User-supplied list of model IDs (e.g. for OpenRouter); null leaves it unset |
model_config | dict | No | — | Model configuration dict: temperature, max_tokens, etc. |
rate_limit_rpm | integer | No | — | Requests per minute rate limit; null means unlimited |
rate_limit_tpm | integer | No | — | Tokens per minute rate limit; null means unlimited |
is_default | boolean | No | — | Mark as the default AI provider for this organization |
actor | string | No | — | Caller identity (Cognito sub or UUID) initiating the persist |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
ai_provider_config_uuid | uuid | Yes | — | UUID of the persisted AIProviderConfig row |
persisted | boolean | Yes | — | True when a row was created or updated in this run |
created | boolean | Yes | — | True when a new row was inserted (False when updating existing) |
persisted_at | string | Yes | — | ISO-8601 timestamp of the persist operation |
failure_reason | string | No | — | Engine-stamped: human-readable failure reason |
failure_type | string | No | — | Engine-stamped: failure category |
failed_action | string | No | — | Engine-stamped: action method that raised |
failed_at_state | string | No | — | Engine-stamped: state name when the failure occurred |
failed_step | string | No | — | Engine-stamped: name of the step that failed (DAG workflows) |
failed_layer | integer | No | — | Engine-stamped: layer index that failed (DAG workflows) |
error | string | No | — | Engine-stamped: error message on the failure envelope |
error_type | string | No | — | Engine-stamped: exception class name on the failure envelope |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | complete | Persist AI provider config |
completed | No | Yes | Yes | — | Persisted |
failed | No | Yes | No | — | Persist failed |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | complete | completed | — |
pending | fail | failed | — |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "data.ai-provider.persist",
"initial_data": {
"organization_uuid": "value",
"connection_uuid": "value",
"default_model": "value"
}
}