Use Session IDs

Estimated reading: 2 minutes 146 views

Session ID is a unique identifier for client/server connections. A single session equals the duration of a client’s connection to a server.

In the Robility flow Playground, current sessions are listed on the left side of the pane.

Robility flow uses session IDs to track different chat interactions within flows. This allows multiple chat sessions to exist in a single flow. Messages are stored in the database with session IDs as a reference.

This differentiation between users per session is helpful in managing client/server connections but is also important in maintaining separate conversational contexts within a single flow. LLMs rely on past interactions to generate responses to queries, and if these conversations aren’t separated, the responses become less useful or even confused.

Customize session ID

Custom session IDs can be set as part of the payload in API calls, or as advanced settings in individual components. The API session ID value takes precedence. If no session ID is specified, the flow ID is assigned.

If you set a custom session ID in a payload, all downstream components use the upstream component’s session ID value. Replace ROBILITY FLOW_SERVER_ADDRESS, FLOW_ID, and ROBILITY FLOW_API_KEY with the values from your Robility flow deployment.

curl –request POST \

  –url “http://ROBILITY FLOW_SERVER_ADDRESS/api/v1/run/FLOW_ID” \

  –header “Content-Type: application/json” \

  –header “x-api-key: $ROBILITY FLOW_API_KEY” \

  –data ‘{

  “input_value”: “Hello”,

  “output_type”: “chat”,

  “input_type”: “chat”,

  “session_id”: “my_custom_session_value”

}’

The my_custom_session_value value is used in components that accept it, and the stored messages from this flow are stored in robility flow.db with their respective session_id values.

Retrieval of messages from memory by session ID

To retrieve messages from local Robility flow memory, add a Message History component to your flow. The component accepts sessionID as a filter parameter and uses the session ID value from upstream automatically to retrieve message history by session ID from storage.

Messages can be retrieved by session_id from the Robility flow API at GET /v1/monitor/messages. For more information, see Monitor endpoints.

Share this Doc

Use Session IDs

Or copy link

CONTENTS