How Flisk Routes Agent Traffic: A Sequence Diagram of One Turn
The earlier articles covered the agent, the MCP resource, and the control plane. This one follows a single turn: one request from a client to an agent, through the gateway, the checkpoint store, and back. The sequence follows the Flisk agent docs. The model call is a placeholder, since your runTurn decides what it looks like. The sequence sequenceDiagram autonumber actor User as Client…
A single interaction between a client and an agent demonstrates the Flisk routing process. The client initiates the conversation by sending a POST request to the gateway, including a unique session identifier. The gateway then forwards this request to the agent.
The agent identifies the session using the session ID provided in the header. If no checkpoint exists for that session, the agent creates a new one. Otherwise, it loads the previous checkpoint containing the session's state from a checkpoint store, which is a file stored on a Docker volume.
Next, the agent appends the user's input to the checkpoint and passes it along with the current checkpoint to your model code. The model processes the input and returns a reply and the updated checkpoint state. The agent commits this new checkpoint to the checkpoint store atomically, ensuring that no partial state is saved in case of a crash.
The agent then sends the reply back to the gateway, which forwards it to the client. Throughout this process, the checkpoint store persists the session state, even if the Flisk agent is restarted. The volume containing the checkpoints survives a container stop, and a restarted agent loads the same checkpoint for the next turn.
To ensure the reliability of the turn process, it is recommended to test the following scenario: send two turns with the same session ID, restart the Flisk agent, and then send a third turn. The third reply should reflect the state of the first two turns. Additionally, send a turn with a new session ID to confirm that the agent starts a fresh conversation when provided with a new session ID.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.