Jupyter Notebook

If you create and start an agent from a Jupyter Notebook, you can control it

Getting Started

Create a Jupyter installation in a venv

bash
python3 -m venv ~/.virtualenvs/notebook source "$HOME/.virtualenvs/notebook/bin/activate" pip install jupyterlab # install ipykernel

Start it

bash
source "$HOME/.virtualenvs/notebook/bin/activate" # Run it with aitm aitm jupyter lab

Extra: Jupyter Wrapper Script

You can also create a bash wrapper jupyter script in your bin ($HOME/.local/bin)

bash
#!/usr/bin/env bash set -Eeuo pipefail source "$HOME/.virtualenvs/notebook/bin/activate" aitm jupyter "$@"

Test

You can test that the control works by executing curl in a cell. A request should be logged in the ui

bash
!curl https://httpbin.org/ip

Restrictions

Sandboxing

The sandbox makes only the following directories writable:

  • The current directory
  • All paths in jupyter --paths (config, data and runtime)
  • The path given by the command ipyhton locate (ie IPYTHONDIR)

Debug

  • Jupyter should work without aitm
bash
source "$HOME/.virtualenvs/notebook/bin/activate" jupyter lab