Thinkube Models

Run notebooks from your agent, watched or unattended

Have your agent run a notebook while you watch it in a Thinkube IDE tab, or on a server of its own that stops when the run ends

Level
beginner
Time
30 min
Risk
low
Updated
2026-10-04

NotebooksMCPUnattended runs

Overview

Basic idea

A notebook runs in a notebook server: one pod on one node, with the CPU, memory and GPUs chosen when it starts. The agent works in that server directly, through the notebook operations.

  • Watched. The agent opens the notebook on your server and shows it in a Thinkube IDE tab. The outputs and the progress bar appear there as the cells run.

  • Unattended. The agent starts a server of its own on the node you name, runs the notebook top to bottom, and stops the server when the run ends. Your own server and its tabs stay as they are.

  • Outputs stay in the file. Either way the notebook file keeps every output, so you can read the run afterwards.

What you’ll accomplish

You create a two-cell notebook, run it while you watch it in a Thinkube IDE tab, and run it again unattended on another node.

What to know before starting

Required

  • Asking your agent in Thinkube IDE to do things on the platform.

Optional

Supported hardware

  • GPU: not needed for this notebook. A notebook that trains or runs a model in the kernel asks for one when its server starts: say "with one GPU".

  • Architecture: amd64 or arm64.

Prerequisites

Platform

  • Thinkube running, with Thinkube IDE open. Ask your agent: "what’s running?"

  • A notebook server on tkamd1, for the watched run. Ask your agent: "start a notebook server on tkamd1". The first start on a node downloads the notebook environments, so it takes longer than later starts. Replace tkamd1 and tkamd2, here and below, with your own nodes.

Components

  • None beyond the base platform.

Instructions

Step 1. Create a notebook

Ask your agent:

› create watch-a-run.ipynb on tkamd1: one cell that prints the server name and the cores, one that counts 30 seconds with a tqdm progress bar

The notebook the agent wrote on the reference run:

import os, platform
print(f"node: {os.environ.get('JUPYTERHUB_SERVER_NAME') or platform.node()}, cores: {os.cpu_count()}")
import time
from tqdm import tqdm

total = 0
for i in tqdm(range(30)):
    time.sleep(1)
    total += i
print(f"sum: {total}")

tqdm draws a text progress bar that moves in the tab.

Step 2. Open it in a Thinkube IDE tab

Ask your agent:

› open watch-a-run.ipynb with agent-dev and show it to me

The agent opens the notebook with the agent-dev kernel, then runs this command in the terminal:

tk-notebook-open --node tkamd1 watch-a-run.ipynb

Or by hand: run that command in a Thinkube IDE terminal.

Expected output:

{"opened":"https://notebooks.<your domain>/user/<you>/tkamd1/notebooks/thinkube/notebooks/watch-a-run.ipynb","node":"tkamd1",...}

The tab takes a few seconds to attach. The agent waits until the tab is connected, so you see the run from its first line.

Step 3. Run it while you watch

Ask your agent:

› run all the cells

The tab shows the progress bar move.

Expected output, from the reference run:

status: completed
started_at: 23:43:19   finished_at: 23:43:49
cell 0: node: tkamd1, cores: 16
cell 1: 100%|██████████| 30/30 [00:30<00:00,  1.00s/it]
        sum: 435

os.cpu_count() counts the node’s cores; the server itself has the 4 cores it started with.

Step 4. Close the notebook

The kernel holds memory on the server until the notebook is closed.

Ask your agent:

› close watch-a-run.ipynb

Expected output:

saved: true
kernel_shut_down: true

Step 5. Run it unattended on another node

An unattended run suits a notebook that runs for a long time, or one that needs a GPU on a node where you have no server.

Ask your agent:

› run watch-a-run.ipynb unattended on tkamd2 with agent-dev and no GPU

Expected output, from the reference run:

job_id: 117bf693-67b7-4a54-a21c-fb3301433386
server_name: job-651a370f
status: starting

then running with the cells done of the total, and at the end:

status: completed
completed_cells: 2 of 2
cell 0: node: job-651a370f, cores: 32
cell 1: sum: 435
created_at: 23:43:21   finished_at: 23:44:30

The server job-651a370f stopped when the run ended, and no other servers were listed.

Step 6. Next steps

To undo: Delete the notebook file.

Troubleshooting

Symptom Cause Fix

Listing the kernels answers Notebook servers are running on tkamd1, tkamd2, tkspark; say which with node.

More than one notebook server is running, and the request did not name its node

Name the node: "list the kernels on tkamd1".