BlaiseBlaise
Documentation
Runner and PlugsTutorials

Watch a session pause and resume

Log the lifecycle events of a session to a file, and follow one session through a pause, a resume and its end.

In this tutorial you log every lifecycle event of a session to a file, and follow one session through its start, a pause, a resume and its end. It takes about twenty minutes, most of it waiting for the session to go idle. You need what the first tutorial set up. Leave the agent's idle policy at its default, Pause it and resume on the next message.

1. Write a blaise.yml

Make an empty directory and create blaise.yml in it:

blaise.yml
version: 1
setup:
  - use: blaise:shell
    with:
      start: echo "start" >> lifecycle.log
      resume: echo "resume" >> lifecycle.log
      pause: echo "pause, may resume $BLAISE_MAY_RESUME" >> lifecycle.log
      teardown: echo "teardown, $BLAISE_END_REASON" >> lifecycle.log

blaise:shell runs one script for each lifecycle event. Each script appends a line to lifecycle.log.

2. Start the runner and a session

blaise-agent listen

Start a session in the dashboard with the prompt Say hello., and wait for the answer. Then look at the log:

cat lifecycle.log
start

3. Let the session go idle

Do nothing for about six minutes. The agent's inactivity limit is five minutes, and Blaise checks every thirty seconds. Open the session in the dashboard: the Environment panel shows the state paused. Then look at the log again:

start
pause, may resume true

The agent has ended, and the plugs were paused. Nothing was torn down.

4. Resume it

Send another message in the same session: What did I just ask you?. The runner starts a new run. The agent remembers the conversation. The log has a new line:

start
pause, may resume true
resume

5. End the session

In the Environment panel, choose End session. Check the log one last time:

start
pause, may resume true
resume
pause, may resume false
teardown, closed

The run paused again, this time with nothing to resume to, and the plug was torn down.

What you did

You followed a session through every state of its environment. The agent process lived only while it was working; what the plugs set up lasted from message to message. Where to go next:

On this page