Skip to main content
PUT
/
defend
/
{workflow_id}
Update a workflow
from deeprails import Deeprails

DEEPRAILS_API_KEY = "YOUR_API_KEY"

client = Deeprails(
    api_key=DEEPRAILS_API_KEY,
)

workflow_response = client.defend.update_workflow(
    workflow_id="defend_abc123",
    description="A workflow used to test the DeepRails SDK"
)
print(workflow_response.description)
print(workflow_response.updated_at)
{
  "workflow_id": "<string>",
  "name": "<string>",
  "description": "<string>",
  "improvement_action": "regenerate",
  "status": "archived",
  "created_at": "2023-11-07T05:31:56Z",
  "modified_at": "2023-11-07T05:31:56Z",
  "success_rate": 123,
  "max_retries": 123
}
The request can update name and description. Only fields provided in the request body will be updated.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

workflow_id
string
required

The ID of the workflow to edit.

Body

application/json
name
string

Name of the workflow.

description
string

Description for the workflow.

Response

Workflow updated successfully

workflow_id
string
required

A unique workflow ID.

name
string
required

Name of the workflow.

description
string

Description for the workflow.

improvement_action
enum<string> | null

The action used to improve outputs that fail one or more guardrail metrics for the workflow events. May be regenerate, fixit, or null which represents “do nothing”. Regenerate runs the user's input prompt with minor induced variance. Fixit attempts to directly address the shortcomings of the output using the guardrail failure rationale. Do nothing does not attempt any improvement.

Available options:
regenerate,
fixit
status
enum<string>

Status of the selected workflow. May be archived or active. Archived workflows will not accept events.

Available options:
archived,
active
created_at
string<date-time>

The time the workflow was created in UTC.

modified_at
string<date-time>

The most recent time the workflow was modified in UTC.

success_rate
number

Rate of events associated with this workflow that passed evaluation.

max_retries
integer

Max. number of improvement action retries until a given event passes the guardrails.

I