Introducing Confident Voice: Watch the Launch Video Now

Managing Journey Edges via Confident AI SDK

Overview

The Confident AI SDK exposes every Edge method on the platform. This page documents how to call these methods in all supported languages. See the introduction to install the SDK and set your API key.

Methods

Create Edge

Adds an edge between two states of a journey and returns its id. A state cannot lead to itself, and only one edge may run from one state to another; a second returns a 409.

from confident_ai import ConfidentAI

client = ConfidentAI()

result = client.journeys.create_edge(
    journey_id="<JOURNEY-ID>",
    from_state_id="<JOURNEY-STATE-ID>",
    to_state_id="<JOURNEY-STATE-ID>",
    when="The assistant confirms the refund has been issued.",
)

For async mode, call a_create_edge and await it as shown below:

result = await client.journeys.a_create_edge(...)

Parameters

ParameterTypeDescription
journey_idstrRequired. The id of the journey.
from_state_idstrRequired. The id of the state the edge leaves from.
to_state_idstrRequired. The id of the state the edge leads to. It must differ from fromStateId, and both must be in this journey.
whenstrRequired. What the app does or says in its reply that moves the simulated user along this edge; describe the app's reply, not the user. An empty when keeps the edge out of the journey's paths until it is given one.

Returns

This method returns an object of type JourneyEdgeRef.

Update Edge

Rewrites an edge's condition or points it at a different state, and returns it. Pointing it at a state another edge from the same state already leads to returns a 409.

from confident_ai import ConfidentAI

client = ConfidentAI()

result = client.journeys.update_edge(
    journey_id="<JOURNEY-ID>",
    edge_id="<JOURNEY-EDGE-ID>",
    when="The assistant confirms the refund has been issued.",
    to_state_id="<JOURNEY-STATE-ID>",
)

For async mode, call a_update_edge and await it as shown below:

result = await client.journeys.a_update_edge(...)

Parameters

ParameterTypeDescription
journey_idstrRequired. The id of the journey the edge belongs to.
edge_idstrRequired. The id of the edge.
whenOptional[str]What the app does or says in its reply that moves the simulated user along this edge. Omit it to keep the current one.
to_state_idOptional[str]The id of the state the edge should lead to instead, in this journey. It cannot be the state the edge leaves from. Goldens generated for a path through the old edge are kept but no longer belong to any path. Omit it to keep the current target.

Returns

This method returns an object of type JourneyEdge.

Delete Edge

Permanently deletes an edge, along with every state that could only be reached through it, and returns the ids of the states removed. Goldens generated for a path through the edge or those states are kept but no longer belong to any path.

from confident_ai import ConfidentAI

client = ConfidentAI()

result = client.journeys.delete_edge(
    journey_id="<JOURNEY-ID>",
    edge_id="<JOURNEY-EDGE-ID>",
)

For async mode, call a_delete_edge and await it as shown below:

result = await client.journeys.a_delete_edge(...)

Parameters

ParameterTypeDescription
journey_idstrRequired. The id of the journey the edge belongs to.
edge_idstrRequired. The id of the edge.

Returns

This method returns an object of type DeleteJourneyEdgeResult.

Types

DeleteJourneyEdgeResult

The states removed by deleting an edge from a journey.

class DeleteJourneyEdgeResult:
    id: str
    deleted_state_ids: List[str] = Field(alias="deletedStateIds")

idstrRequired

The id of the edge you deleted.

Example: "<JOURNEY-EDGE-ID>"

deleted_state_idsList[str]Required

The states that could only be reached through this edge, removed with it. [] when every state is still reachable.

Example: []

JourneyEdge

A transition from one state of a journey to another, taken when the app's reply matches its when.

class JourneyEdge:
    id: str
    from_state_id: str = Field(alias="fromStateId")
    to_state_id: str = Field(alias="toStateId")
    when: str
    created_at: str = Field(alias="createdAt")
    updated_at: str = Field(alias="updatedAt")

idstrRequired

The id of the edge, generated by Confident AI.

Example: "<JOURNEY-EDGE-ID>"

from_state_idstrRequired

The id of the state the edge leaves from.

Example: "<JOURNEY-STATE-ID>"

to_state_idstrRequired

The id of the state the edge leads to.

Example: "<JOURNEY-STATE-ID>"

whenstrRequired

What the app does or says in its reply that moves the simulated user along this edge. Empty when none has been given, which keeps the edge out of the journey's paths.

Example: "The assistant confirms the refund has been issued."

created_atstrRequired

The time the edge was created, as an ISO 8601 datetime.

Example: "2025-01-15T10:30:00+00:00"

updated_atstrRequired

The time the edge was last changed, as an ISO 8601 datetime.

Example: "2025-01-16T09:12:00+00:00"

JourneyEdgeRef

A reference to a journey edge by its id.

class JourneyEdgeRef:
    id: str

idstrRequired

The id of the edge, generated by Confident AI.

Example: "<JOURNEY-EDGE-ID>"

Building a production pipeline?Design a scalable API workflow for evals, datasets, traces, and promptsTalk to an engineer

Last updated on

Built byConfident AI