REPLs and debug sessions
Keep session state between agent tool calls.
A Python REPL, debugger or database client can depend on state established in an earlier interaction. Evaluate whether your agent can return to that process, use its state and close it cleanly.
Try a small Python session
Use a connected agend environment with Python 3. Ask your agent to start python3 through shell_exec with interactive mode enabled. Continue using shell_send_raw in the same environment for each subsequent line, including its newline.
>>> total = 40
>>> total += 2
>>> print(total)
42
>>> exit() This is an illustrative transcript with expected output. Have the agent send the assignment, update and read in separate tool calls. Success means it reads 42 from the existing process and observes completion after exit().
Check the session, not just the text
- Confirm that the agent does not start a new Python interpreter for each interaction.
- Check the process exit status after closing the REPL. If the final output races with exit, refresh the existing session before starting another command.
- For a database, verify transaction state and results using an approved test database. A ready prompt does not prove a commit succeeded.
- For a debugger, verify breakpoints and inspected values against a known fixture.
Understand persistence and sleep
Interactive sessions retain process state between tool calls. While an environment sleeps, its processes are paused. External database and SSH connections can expire and need to reconnect after wake. Files remain on persistent storage, subject to the plan's lifecycle and retention terms.
Other terminals also support persistent sessions. Compare your actual workflow and recovery effort. For a deterministic calculation, a short Python script can be more practical than an agent-operated REPL.
Move to a recurring workflow
Bring a repeated debugging, data exploration or database task. Keep the same success checks and model settings across your baseline and agend runs. Record manual recovery and failures before deciding whether the workflow has improved.
Understand input, exit and health signals, or try an installer fixture with a verifiable output file.