Skip to main content

Workflow Stages

Manage workflow stages in Credo AI.

Methods

create

Create Workflow Stage Create a new workflow stage.

Only intermediate workflow stages can be created via the API. Start and end stages are system-managed. The new stage will be inserted after the specified parent stage.

from credoai import WorkflowStageCreate

data = WorkflowStageCreate(
name="Example Name",
)

response = client.workflow_stages.create(
data=data,
)

Parameters:

Returns: Response object


list

List Workflow Stages List all workflow stages.

Returns all workflow stages including start, intermediate, and end stages with optional pagination.

response = client.workflow_stages.list(
)

Parameters:

  • page_limit (Any, optional) - Query parameter
  • page_after (Any, optional) - Query parameter

Returns: Response object


get

Get Workflow Stage Get a workflow stage by ID.

workflow_stage_id = "workflow_stage_id-123"

response = client.workflow_stages.get(
workflow_stage_id=workflow_stage_id,
)

Parameters:

  • workflow_stage_id (str, required) - Resource identifier

Returns: Response object


update

Update Workflow Stage Update an existing workflow stage.

Note: Start and end stages cannot be modified via the API.

from credoai import WorkflowStageUpdate

workflow_stage_id = "workflow_stage_id-123"

data = WorkflowStageUpdate(
name="Example Name",
)

response = client.workflow_stages.update(
workflow_stage_id=workflow_stage_id,
data=data,
)

Parameters:

  • workflow_stage_id (str, required) - Resource identifier
  • data (WorkflowStageUpdate, required) - Request payload

Returns: Response object


delete

Delete Workflow Stage Delete a workflow stage by ID.

Note: Start and end stages cannot be deleted via the API.

workflow_stage_id = "workflow_stage_id-123"

response = client.workflow_stages.delete(
workflow_stage_id=workflow_stage_id,
)

Parameters:

  • workflow_stage_id (str, required) - Resource identifier

Returns: Response object


Error Handling

from credoai.errors import ApiError, ClientValidationError
from credoai.auth import AuthenticationError

try:
response = client.workflow_stages.create(...)
except ApiError as e:
print(f"API error {e.status_code}: {e.message}")
except ClientValidationError as e:
print(f"Validation error: {e}")
except AuthenticationError as e:
print(f"Auth error: {e}")