Use session ID to manage communication between components
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 SkillFlaw Playground, current sessions are listed on the left side of the pane.
SkillFlaw 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 becomes 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 SKILLFLAW_SERVER_ADDRESS, FLOW_ID, and SKILLFLAW_API_KEY with the values from your SkillFlaw deployment.
_10curl --request POST \_10 --url "http://SKILLFLAW_SERVER_ADDRESS/api/v1/run/FLOW_ID" \_10 --header "Content-Type: application/json" \_10 --header "x-api-key: $SKILLFLAW_API_KEY" \_10 --data '{_10 "input_value": "Hello",_10 "output_type": "chat",_10 "input_type": "chat",_10 "session_id": "my_custom_session_value"_10}'
The my_custom_session_value value is used in components that accept it, and the stored messages from this flow are stored with their respective session_id values in your configured SkillFlaw message storage.
Retrieval of messages from memory by session ID
To retrieve messages from local SkillFlaw 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 SkillFlaw API at GET /api/v1/monitor/messages.
For an example of session ID in action, see Use Session IDs in SkillFlaw.