Introducing Confident Monitor

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 customer has given an order number and the email on the account, and they match.",
)

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. The condition under which the conversation moves along this edge, in plain language. An empty condition 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 customer has given an order number and the email on the account, and they match.",
    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]The condition under which the conversation moves along this edge. Omit it to keep the current condition.
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 its condition holds.

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

The condition under which the conversation moves along this edge. Empty when none has been given, which keeps the edge out of the journey's paths.

Example: "The customer has given an order number and the email on the account, and they match."

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