Skip to content

Overview of JAZ

Step 1 of 10 · The notes

344 field notes, no two alike

You are writing the analysis script for a penguin field study. This season's measurements came back as free-text notes, one per penguin, and every scientist writes them differently.

What you are driving is the jaz console: a prompt for an agent, with a Python session behind it. This tour stays on the Python side (! switches to it), so every line you send is one you could put in a script or a notebook.

Start by loading the notes. The console offers the next lines: type anything and it types them for you, Enter runs each one, or click Send.

Step 1 of 10 · The notes

What just happened

Five notes, five ways of writing one down: the species as a code (ADPE) or a word, the sex as ♂, f or ?, a telegram with pipes beside a full sentence. pandas cuts each one short here; there are 344 of them.

┃ >>> import pandas as pd
┃ >>> field_notes = pd.read_csv("penguin_field_notes.csv")
┃ >>> field_notes.head()
note
0 ADPE ♂ Torg. culmen 39.1, BD 18.7, FL 181. wt ...
1 Torgersen, first transect of the morning. Adel...
2 ADPE f Torg | bill 40.3 x 18.0 | flip 195 | 32...
3 Torgersen - Adelie, sex ?, bolted into the roc...
4 Adelie female (Torgersen). Weighed first: 3,45...

Step 2 of 10 · Setup

What if the parser wrote itself?

You could write code to parse these, and rewrite it every season, when a note turns up that it does not handle. JAZ's one primitive, invoke, is for exactly this: a function that an LLM implements at run time, from the inputs it actually received. The model writes the function's body as Python, and JAZ runs it.

Three things before you call it: import it, say which modules the model's code may import (by default, none), and write down what you want as a plain string.

The console is already signed in to a model. In a script, configure(llm=...) names one.

┃ >>> from jaz import configure, invoke
┃ >>> from jaz.hooks import ReturnType
┃ >>> from jaz.repl import PythonREPL
┃ >>> configure(repl=PythonREPL(exec_timeout=300, allowed_imports=["pandas", "numpy", "re", "concurrent"]))
┃ >>> task = """\
┃ ... Extract a DataFrame from the field notes, one row per note, in order. Rows are penguins.
┃ ... Columns are species (Adelie, Chinstrap or Gentoo), island (Biscoe, Dream or Torgersen),
┃ ... bill_length_mm, bill_depth_mm, flipper_length_mm, body_mass_g (floats, in mm and g),
┃ ... and sex (MALE or FEMALE).
┃ ... """

Step 3 of 10 · invoke

Call it like a function

invoke takes any keyword arguments, and those are its inputs: here task, the string you just wrote, and field_notes, the DataFrame itself, not a copy pasted into a prompt. Neither name is special. Each input is shown to the model, and is a variable where its code runs.

ReturnType(pd.DataFrame) is optional: it checks that a DataFrame is what comes back.

Send the call and watch under it. Each numbered block is code the model wrote, run as soon as it arrived.

Step 3 of 10 · invoke

What just happened

The model took three turns: it printed a sample of the notes to look at them [0], wrote a parser for the formats it saw and counted the gaps [1], then returned the table [2]. What you got back is a real DataFrame, not text to parse: the table is pandas' own print of it.

┃ >>> extracted_data = invoke(
┃ ... ReturnType(pd.DataFrame),
┃ ... task=task,
┃ ... field_notes=field_notes,
┃ ... )
┊ │ [0] # Look at a sample of the notes before deciding how to extract them.
┊ │ print(field_notes.note.head(12).to_string())
┊ ✓ (0.0s)
┊ │ [1] # The notes are free text in several formats. Parse each one with regular expressions.
┊ │ import re
┊ │ import pandas as pd
┊ │
┊ │ SPECIES = {"adelie": "Adelie", "adélie": "Adelie", "adpe": "Adelie", "chinstrap": "Chinstrap",
┊ │ "chpe": "Chinstrap", "gentoo": "Gentoo", "gepe": "Gentoo"}
┊ │ ISLANDS = {"torg": "Torgersen", "bisc": "Biscoe", "dream": "Dream"}
┊ │ NUM = r"(\d[\d,]*\.?\d*)"
┊ │
┊ │ def number(pattern, text):
┊ │ found = re.search(pattern, text, re.I)
┊ │ return float(found.group(1).replace(",", "")) if found else None
┊ │
┊ │ def parse(note):
┊ │ low = note.lower()
┊ │ species = next((name for key, name in SPECIES.items() if key in low), None)
┊ │ island = next((name for key, name in ISLANDS.items() if key in low), None)
┊ │ if re.search(r"\b(female|hen|f|she)\b|♀", low):
┊ │ sex = "FEMALE"
┊ │ elif re.search(r"\b(male|cock|m|he)\b|♂", low):
┊ │ sex = "MALE"
┊ │ else:
┊ │ sex = None
┊ │ mass = number(NUM + r" ?g\b", note)
┊ │ if mass is None and (kg := number(NUM + r" ?kg", note)) is not None:
┊ │ mass = kg * 1000
┊ │ if mass is None and (lb := number(NUM + r" ?lbs?", note)) is not None:
┊ │ mass = lb * 453.592
┊ │ pair = re.search(NUM + r"(?: mm)? ?(?:x|/|by) ?" + NUM, note) # "40.3 x 18.0", "34.1/18.1"
┊ │ length = (number(r"(?:bill length|culmen|BL)\D{0,3}" + NUM, note)
┊ │ or number(NUM + r"(?: mm| in)? long", note) or (pair and float(pair.group(1))))
┊ │ depth = (number(r"(?:depth|BD)\D{0,3}" + NUM, note)
┊ │ or number(NUM + r"(?: mm| in)? deep", note) or (pair and float(pair.group(2))))
┊ │ flipper = number(r"(?:flipper length|flipper|flip|FL)\D{0,3}" + NUM, note)
┊ │ if " in " in note or note.rstrip(".").endswith(" in"): # one volunteer measured in inches
┊ │ length, depth, flipper = [v and round(v * 25.4, 1) for v in (length, depth, flipper)]
┊ │ return species, island, length, depth, flipper, mass, sex
┊ │
┊ │ COLUMNS = ["species", "island", "bill_length_mm", "bill_depth_mm", "flipper_length_mm",
┊ │ "body_mass_g", "sex"]
┊ │ table = pd.DataFrame([parse(note) for note in field_notes.note], columns=COLUMNS)
┊ │ print(table.isna().sum())
┊ ✓ (0.1s)
┊ │ [2] # A few values are missing, as expected: some birds were not measured. Done.
┊ │ return table
┊ ✓ (0.0s)
┃ >>> extracted_data.head()
species island bill_length_mm bill_depth_mm flipper_length_mm body_mass_g sex
0 Adelie Torgersen 39.1 18.7 181.0 3750.0 MALE
1 Adelie Torgersen 39.5 17.4 186.0 3800.0 FEMALE
2 Adelie Torgersen 40.3 18.0 195.0 3250.0 FEMALE
3 Adelie Torgersen NaN NaN NaN NaN NaN
4 Adelie Torgersen 36.7 19.3 193.0 3450.0 FEMALE

Step 4 of 10 · Check it

But is it right?

A teammate extracted the same table by hand, so this one can be scored. evaluate is the study's own helper: the share of cells that match theirs.

Step 4 of 10 · Check it

What just happened

Nine cells in ten are right. But look at accuracy_weights_in_lb: every weight that was noted in pounds is wrong.

┃ >>> from field_study import evaluate
┃ >>> evaluate(extracted_data)
{'accuracy_overall': 0.904, 'accuracy_weights_in_lb': 0.0}

Step 5 of 10 · A tool

Why are the lb weights wrong?

The parser converts pounds to grams correctly, so the notes themselves must be off. The field team kept a journal that season, 265 entries of it; the reason may be in there.

search_field_journal is an ordinary Python function that searches it. Import it, then ask the console what an agent would be shown for it: that is what ? does.

Step 5 of 10 · A tool

What just happened

That is everything the model is told about the function: its signature and its docstring, read off the function itself. Nobody wrote a schema.

┃ >>> from field_study import search_field_journal
┃ >>> ?search_field_journal
`search_field_journal(query: str) -> str`: Searches the field team's journal from the season the measurements
were taken, which records known problems with them, and returns the 10 entries that share
the most words with `query`. Make sure to search it and read its output before doing
anything with the field data.

Step 6 of 10 · Tools are inputs

What if the agent could search the journal?

In most frameworks a tool is a special kind of thing: registered with the agent or on a tool server, its arguments and results squeezed through JSON. With invoke, a tool is just an input that is callable. Pass the function as one more keyword argument, and the model's code can call it like any other function.

The same call as before, one argument longer. Then score it again.

Step 6 of 10 · Tools are inputs

What just happened

This time the first thing the model did was search the journal [0]. It found Ana's entry of 11 January: the one scale that reads in pounds had never been tared, so every weight in lb reads 0.2 lb too high. The parser it then wrote subtracts 0.2 lb [1], and the lb weights are all right now.

┃ >>> extracted_data = invoke(
┃ ... ReturnType(pd.DataFrame),
┃ ... task=task,
┃ ... field_notes=field_notes,
┃ ... search_field_journal=search_field_journal,
┃ ... )
┊ │ [0] # The journal records known problems with the measurements. Search it before the data.
┊ │ print(search_field_journal("known problems with weights scale measurements"))
┊ ✓ (0.0s)
┊ │ [1] # The notes are free text in several formats. Parse each one with regular expressions.
┊ │ import re
┊ │ import pandas as pd
┊ │
┊ │ SPECIES = {"adelie": "Adelie", "adélie": "Adelie", "adpe": "Adelie", "chinstrap": "Chinstrap",
┊ │ "chpe": "Chinstrap", "gentoo": "Gentoo", "gepe": "Gentoo"}
┊ │ ISLANDS = {"torg": "Torgersen", "bisc": "Biscoe", "dream": "Dream"}
┊ │ NUM = r"(\d[\d,]*\.?\d*)"
┊ │
┊ │ def number(pattern, text):
┊ │ found = re.search(pattern, text, re.I)
┊ │ return float(found.group(1).replace(",", "")) if found else None
┊ │
┊ │ def parse(note):
┊ │ low = note.lower()
┊ │ species = next((name for key, name in SPECIES.items() if key in low), None)
┊ │ island = next((name for key, name in ISLANDS.items() if key in low), None)
┊ │ if re.search(r"\b(female|hen|f|she)\b|♀", low):
┊ │ sex = "FEMALE"
┊ │ elif re.search(r"\b(male|cock|m|he)\b|♂", low):
┊ │ sex = "MALE"
┊ │ else:
┊ │ sex = None
┊ │ mass = number(NUM + r" ?g\b", note)
┊ │ if mass is None and (kg := number(NUM + r" ?kg", note)) is not None:
┊ │ mass = kg * 1000
┊ │ if mass is None and (lb := number(NUM + r" ?lbs?", note)) is not None:
┊ │ mass = (lb - 0.2) * 453.592 # the journal: every lb weight reads 0.2 lb too high
┊ │ pair = re.search(NUM + r"(?: mm)? ?(?:x|/|by) ?" + NUM, note) # "40.3 x 18.0", "34.1/18.1"
┊ │ length = (number(r"(?:bill length|culmen|BL)\D{0,3}" + NUM, note)
┊ │ or number(NUM + r"(?: mm| in)? long", note) or (pair and float(pair.group(1))))
┊ │ depth = (number(r"(?:depth|BD)\D{0,3}" + NUM, note)
┊ │ or number(NUM + r"(?: mm| in)? deep", note) or (pair and float(pair.group(2))))
┊ │ flipper = number(r"(?:flipper length|flipper|flip|FL)\D{0,3}" + NUM, note)
┊ │ if " in " in note or note.rstrip(".").endswith(" in"): # one volunteer measured in inches
┊ │ length, depth, flipper = [v and round(v * 25.4, 1) for v in (length, depth, flipper)]
┊ │ return species, island, length, depth, flipper, mass, sex
┊ │
┊ │ COLUMNS = ["species", "island", "bill_length_mm", "bill_depth_mm", "flipper_length_mm",
┊ │ "body_mass_g", "sex"]
┊ │ table = pd.DataFrame([parse(note) for note in field_notes.note], columns=COLUMNS)
┊ │ print(table.isna().sum())
┊ ✓ (0.1s)
┊ │ [2] # A few values are missing, as expected: some birds were not measured. Done.
┊ │ return table
┊ ✓ (0.0s)
┃ >>> evaluate(extracted_data)
{'accuracy_overall': 0.922, 'accuracy_weights_in_lb': 1.0}

Step 7 of 10 · Subagents

What if one agent is not enough?

Some cells are still wrong. A parser only handles the formats its author noticed, and 344 notes are too many for one agent to read one by one. A small chunk of them is not.

Every agent can call invoke itself, to hand work to subagents. That is on by default; you only have to ask for it, here with one more input. And since an input reaches only the agent it was passed to, search_field_journal moves into scope(...), which gives it to every agent started inside the block.

Step 7 of 10 · Subagents

What just happened

The agent searched the journal [0], then cut the notes into eight chunks and started a subagent on each, all at once [1]. Each subagent read its 43 notes and typed their rows out by hand: open a sub-agent row to see one. The agent joined the eight tables into the one you got back, and it scores 1.0.

┃ >>> from jaz import scope
┃ >>> with scope(search_field_journal=search_field_journal):
┃ ... extracted_data = invoke(
┃ ... ReturnType(pd.DataFrame),
┃ ... task=task,
┃ ... field_notes=field_notes,
┃ ... subagent_usage_instruction="""\
┃ ... Split the notes up into multiple small chunks and launch parallel subagents
┃ ... that read each chunk manually to extract its values by hand.
┃ ... """,
┃ ... )
┃ ...
┊ │ [0] # The journal records known problems with the measurements. Search it before the data.
┊ │ print(search_field_journal("known problems with weights scale measurements"))
┊ ✓ (0.0s)
┊ │ [1] # The journal: every weight in lb reads 0.2 lb too high. As instructed, split the notes
┊ │ # into chunks of 43 and have a subagent read each chunk by hand, in parallel.
┊ │ from concurrent.futures import ThreadPoolExecutor
┊ │ import pandas as pd
┊ │
┊ │ chunks = [field_notes.iloc[i:i + 43] for i in range(0, len(field_notes), 43)]
┊ │
┊ │ def read(chunk):
┊ │ return invoke(
┊ │ task=task,
┊ │ field_notes=chunk,
┊ │ instructions="Read every note yourself and type out its row by hand; do not write a "
┊ │ "parser. Known problem: weights in lb read 0.2 lb too high, so subtract "
┊ │ "0.2 lb before converting to grams.",
┊ │ )
┊ │
┊ │ with ThreadPoolExecutor(max_workers=8) as pool:
┊ │ parts = list(pool.map(read, chunks))
┊ │ return pd.concat(parts, ignore_index=True)
┊ ↳ sub-agent · 1 step · click to expandclick to collapse
┊ │ [0] # 43 notes: read each one and type out its row. Lengths to mm, weights to g,
┊ │ # and 0.2 lb off every weight given in lb.
┊ │ import pandas as pd
┊ │
┊ │ rows = [
┊ │ ('Adelie', 'Torgersen', 39.1, 18.7, 181.0, 3750.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 39.5, 17.4, 186.0, 3800.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 40.3, 18.0, 195.0, 3250.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', None, None, None, None, None),
┊ │ ('Adelie', 'Torgersen', 36.7, 19.3, 193.0, 3450.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 39.3, 20.6, 190.0, 3650.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 38.9, 17.8, 181.0, 3625.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 39.2, 19.6, 195.0, 4675.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 34.1, 18.1, 193.0, 3475.0, None),
┊ │ ('Adelie', 'Torgersen', 42.0, 20.2, 190.0, 4250.0, None),
┊ │ ('Adelie', 'Torgersen', 37.8, 17.1, 186.0, 3300.0, None),
┊ │ ('Adelie', 'Torgersen', 37.8, 17.3, 180.0, 3700.0, None),
┊ │ ('Adelie', 'Torgersen', 41.1, 17.6, 182.0, 3200.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 38.6, 21.2, 191.0, 3800.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 34.6, 21.1, 198.0, 4400.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 36.6, 17.8, 185.0, 3700.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 38.7, 19.0, 195.0, 3450.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 42.5, 20.7, 197.0, 4500.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 34.4, 18.4, 184.0, 3325.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 46.0, 21.5, 194.0, 4200.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 37.8, 18.3, 174.0, 3400.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 37.7, 18.7, 180.0, 3600.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 35.9, 19.2, 189.0, 3800.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 38.2, 18.1, 185.0, 3950.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 38.8, 17.2, 180.0, 3800.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 35.3, 18.9, 187.0, 3800.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 40.6, 18.6, 183.0, 3550.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 40.5, 17.9, 187.0, 3200.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 37.9, 18.6, 172.0, 3150.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 40.5, 18.9, 180.0, 3950.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 39.5, 16.7, 178.0, 3250.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 37.2, 18.1, 178.0, 3900.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 39.5, 17.8, 188.0, 3300.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 40.9, 18.9, 184.0, 3900.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 36.4, 17.0, 195.0, 3325.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 39.2, 21.1, 196.0, 4150.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 38.8, 20.0, 190.0, 3950.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 42.2, 18.5, 180.0, 3550.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 37.6, 19.3, 181.0, 3300.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 39.8, 19.1, 184.0, 4650.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 36.5, 18.0, 182.0, 3150.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 40.8, 18.4, 195.0, 3900.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 36.0, 18.5, 186.0, 3100.0, 'FEMALE'),
┊ │ ]
┊ │ return pd.DataFrame(rows, columns=["species", "island", "bill_length_mm", "bill_depth_mm",
┊ │ "flipper_length_mm", "body_mass_g", "sex"])
┊ ✓ (0.0s)
┊ ↳ sub-agent · 1 step · click to expandclick to collapse
┊ │ [0] # 43 notes: read each one and type out its row. Lengths to mm, weights to g,
┊ │ # and 0.2 lb off every weight given in lb.
┊ │ import pandas as pd
┊ │
┊ │ rows = [
┊ │ ('Adelie', 'Dream', 44.1, 19.7, 196.0, 4400.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 37.0, 16.9, 185.0, 3000.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 39.6, 18.8, 190.0, 4600.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 41.1, 19.0, 182.0, 3425.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 37.5, 18.9, 179.0, 2975.0, None),
┊ │ ('Adelie', 'Dream', 36.0, 17.9, 190.0, 3450.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 42.3, 21.2, 191.0, 4150.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 39.6, 17.7, 186.0, 3500.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 40.1, 18.9, 188.0, 4300.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 35.0, 17.9, 190.0, 3450.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 42.0, 19.5, 200.0, 4050.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 34.5, 18.1, 187.0, 2900.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 41.4, 18.6, 191.0, 3700.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 39.0, 17.5, 186.0, 3550.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 40.6, 18.8, 193.0, 3800.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 36.5, 16.6, 181.0, 2850.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 37.6, 19.1, 194.0, 3750.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 35.7, 16.9, 185.0, 3150.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 41.3, 21.1, 195.0, 4400.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 37.6, 17.0, 185.0, 3600.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 41.1, 18.2, 192.0, 4050.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 36.4, 17.1, 184.0, 2850.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 41.6, 18.0, 192.0, 3950.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 35.5, 16.2, 195.0, 3350.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 41.1, 19.1, 188.0, 4100.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 35.9, 16.6, 190.0, 3050.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 41.8, 19.4, 198.0, 4450.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 33.5, 19.0, 190.0, 3600.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 39.7, 18.4, 190.0, 3900.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 39.6, 17.2, 196.0, 3550.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 45.8, 18.9, 197.0, 4150.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 35.5, 17.5, 190.0, 3700.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 42.8, 18.5, 195.0, 4250.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 40.9, 16.8, 191.0, 3700.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 37.2, 19.4, 184.0, 3900.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 36.2, 16.1, 187.0, 3550.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 42.1, 19.1, 195.0, 4000.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 34.6, 17.2, 189.0, 3200.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 42.9, 17.6, 196.0, 4700.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 36.7, 18.8, 187.0, 3800.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 35.1, 19.4, 193.0, 4200.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 37.3, 17.8, 191.0, 3350.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 41.3, 20.3, 194.0, 3550.0, 'MALE'),
┊ │ ]
┊ │ return pd.DataFrame(rows, columns=["species", "island", "bill_length_mm", "bill_depth_mm",
┊ │ "flipper_length_mm", "body_mass_g", "sex"])
┊ ✓ (0.0s)
┊ ↳ sub-agent · 1 step · click to expandclick to collapse
┊ │ [0] # 43 notes: read each one and type out its row. Lengths to mm, weights to g,
┊ │ # and 0.2 lb off every weight given in lb.
┊ │ import pandas as pd
┊ │
┊ │ rows = [
┊ │ ('Adelie', 'Dream', 36.3, 19.5, 190.0, 3800.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 36.9, 18.6, 189.0, 3500.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 38.3, 19.2, 189.0, 3950.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 38.9, 18.8, 190.0, 3600.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 35.7, 18.0, 202.0, 3550.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 41.1, 18.1, 205.0, 4300.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 34.0, 17.1, 185.0, 3400.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 39.6, 18.1, 186.0, 4450.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 36.2, 17.3, 187.0, 3300.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 40.8, 18.9, 208.0, 4300.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 38.1, 18.6, 190.0, 3700.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 40.3, 18.5, 196.0, 4350.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 33.1, 16.1, 178.0, 2900.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 43.2, 18.5, 192.0, 4100.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 35.0, 17.9, 192.0, 3725.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 41.0, 20.0, 203.0, 4725.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 37.7, 16.0, 183.0, 3075.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 37.8, 20.0, 190.0, 4250.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 37.9, 18.6, 193.0, 2925.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 39.7, 18.9, 184.0, 3550.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 38.6, 17.2, 199.0, 3750.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 38.2, 20.0, 190.0, 3900.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 38.1, 17.0, 181.0, 3175.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 43.2, 19.0, 197.0, 4775.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 38.1, 16.5, 198.0, 3825.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 45.6, 20.3, 191.0, 4600.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 39.7, 17.7, 193.0, 3200.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 42.2, 19.5, 197.0, 4275.0, 'MALE'),
┊ │ ('Adelie', 'Biscoe', 39.6, 20.7, 191.0, 3900.0, 'FEMALE'),
┊ │ ('Adelie', 'Biscoe', 42.7, 18.3, 196.0, 4075.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 38.6, 17.0, 188.0, 2900.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 37.3, 20.5, 199.0, 3775.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 35.7, 17.0, 189.0, 3350.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 41.1, 18.6, 189.0, 3325.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 36.2, 17.2, 187.0, 3150.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 37.7, 19.8, 198.0, 3500.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 40.2, 17.0, 176.0, 3450.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 41.4, 18.5, 202.0, 3875.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 35.2, 15.9, 186.0, 3050.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 40.6, 19.0, 199.0, 4000.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 38.8, 17.6, 191.0, 3275.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 41.5, 18.3, 195.0, 4300.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 39.0, 17.1, 191.0, 3050.0, 'FEMALE'),
┊ │ ]
┊ │ return pd.DataFrame(rows, columns=["species", "island", "bill_length_mm", "bill_depth_mm",
┊ │ "flipper_length_mm", "body_mass_g", "sex"])
┊ ✓ (0.0s)
┊ ↳ sub-agent · 1 step · click to expandclick to collapse
┊ │ [0] # 43 notes: read each one and type out its row. Lengths to mm, weights to g,
┊ │ # and 0.2 lb off every weight given in lb.
┊ │ import pandas as pd
┊ │
┊ │ rows = [
┊ │ ('Adelie', 'Torgersen', 44.1, 18.0, 210.0, 4000.0, 'MALE'),
┊ │ ('Adelie', 'Torgersen', 38.5, 17.9, 190.0, 3325.0, 'FEMALE'),
┊ │ ('Adelie', 'Torgersen', 43.1, 19.2, 197.0, 3500.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 36.8, 18.5, 193.0, 3500.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 37.5, 18.5, 199.0, 4475.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 38.1, 17.6, 187.0, 3425.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 41.1, 17.5, 190.0, 3900.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 35.6, 17.5, 191.0, 3175.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 40.2, 20.1, 200.0, 3975.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 37.0, 16.5, 185.0, 3400.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 39.7, 17.9, 193.0, 4250.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 40.2, 17.1, 193.0, 3400.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 40.6, 17.2, 187.0, 3475.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 32.1, 15.5, 188.0, 3050.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 40.7, 17.0, 190.0, 3725.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 37.3, 16.8, 192.0, 3000.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 39.0, 18.7, 185.0, 3650.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 39.2, 18.6, 190.0, 4250.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 36.6, 18.4, 184.0, 3475.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 36.0, 17.8, 195.0, 3450.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 37.8, 18.1, 193.0, 3750.0, 'MALE'),
┊ │ ('Adelie', 'Dream', 36.0, 17.1, 187.0, 3700.0, 'FEMALE'),
┊ │ ('Adelie', 'Dream', 41.5, 18.5, 201.0, 4000.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 46.5, 17.9, 192.0, 3500.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 50.0, 19.5, 196.0, 3900.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 51.3, 19.2, 193.0, 3650.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 45.4, 18.7, 188.0, 3525.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 52.7, 19.8, 197.0, 3725.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 45.2, 17.8, 198.0, 3950.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 46.1, 18.2, 178.0, 3250.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 51.3, 18.2, 197.0, 3750.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 46.0, 18.9, 195.0, 4150.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 51.3, 19.9, 198.0, 3700.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 46.6, 17.8, 193.0, 3800.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 51.7, 20.3, 194.0, 3775.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 47.0, 17.3, 185.0, 3700.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 52.0, 18.1, 201.0, 4050.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 45.9, 17.1, 190.0, 3575.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 50.5, 19.6, 201.0, 4050.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 50.3, 20.0, 197.0, 3300.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 58.0, 17.8, 181.0, 3700.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 46.4, 18.6, 190.0, 3450.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 49.2, 18.2, 195.0, 4400.0, 'MALE'),
┊ │ ]
┊ │ return pd.DataFrame(rows, columns=["species", "island", "bill_length_mm", "bill_depth_mm",
┊ │ "flipper_length_mm", "body_mass_g", "sex"])
┊ ✓ (0.0s)
┊ ↳ sub-agent · 1 step · click to expandclick to collapse
┊ │ [0] # 43 notes: read each one and type out its row. Lengths to mm, weights to g,
┊ │ # and 0.2 lb off every weight given in lb.
┊ │ import pandas as pd
┊ │
┊ │ rows = [
┊ │ ('Chinstrap', 'Dream', 42.4, 17.3, 181.0, 3600.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 48.5, 17.5, 191.0, 3400.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 43.2, 16.6, 187.0, 2900.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 50.6, 19.4, 193.0, 3800.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 46.7, 17.9, 195.0, 3300.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 52.0, 19.0, 197.0, 4150.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 50.5, 18.4, 200.0, 3400.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 49.5, 19.0, 200.0, 3800.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 46.4, 17.8, 191.0, 3700.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 52.8, 20.0, 205.0, 4550.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 40.9, 16.6, 187.0, 3200.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 54.2, 20.8, 201.0, 4300.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 42.5, 16.7, 187.0, 3350.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 51.0, 18.8, 203.0, 4100.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 49.7, 18.6, 195.0, 3600.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 47.5, 16.8, 199.0, 3900.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 47.6, 18.3, 195.0, 3850.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 52.0, 20.7, 210.0, 4800.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 46.9, 16.6, 192.0, 2700.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 53.5, 19.9, 205.0, 4500.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 49.0, 19.5, 210.0, 3950.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 46.2, 17.5, 187.0, 3650.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 50.9, 19.1, 196.0, 3550.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 45.5, 17.0, 196.0, 3500.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 50.9, 17.9, 196.0, 3675.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 50.8, 18.5, 201.0, 4450.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 50.1, 17.9, 190.0, 3400.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 49.0, 19.6, 212.0, 4300.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 51.5, 18.7, 187.0, 3250.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 49.8, 17.3, 198.0, 3675.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 48.1, 16.4, 199.0, 3325.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 51.4, 19.0, 201.0, 3950.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 45.7, 17.3, 193.0, 3600.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 50.7, 19.7, 203.0, 4050.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 42.5, 17.3, 187.0, 3350.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 52.2, 18.8, 197.0, 3450.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 45.2, 16.6, 191.0, 3250.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 49.3, 19.9, 203.0, 4050.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 50.2, 18.8, 202.0, 3800.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 45.6, 19.4, 194.0, 3525.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 51.9, 19.5, 206.0, 3950.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 46.8, 16.5, 189.0, 3650.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 45.7, 17.0, 195.0, 3650.0, 'FEMALE'),
┊ │ ]
┊ │ return pd.DataFrame(rows, columns=["species", "island", "bill_length_mm", "bill_depth_mm",
┊ │ "flipper_length_mm", "body_mass_g", "sex"])
┊ ✓ (0.0s)
┊ ↳ sub-agent · 1 step · click to expandclick to collapse
┊ │ [0] # 43 notes: read each one and type out its row. Lengths to mm, weights to g,
┊ │ # and 0.2 lb off every weight given in lb.
┊ │ import pandas as pd
┊ │
┊ │ rows = [
┊ │ ('Chinstrap', 'Dream', 55.8, 19.8, 207.0, 4000.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 43.5, 18.1, 202.0, 3400.0, 'FEMALE'),
┊ │ ('Chinstrap', 'Dream', 49.6, 18.2, 193.0, 3775.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 50.8, 19.0, 210.0, 4100.0, 'MALE'),
┊ │ ('Chinstrap', 'Dream', 50.2, 18.7, 198.0, 3775.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 46.1, 13.2, 211.0, 4500.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.0, 16.3, 230.0, 5700.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 48.7, 14.1, 210.0, 4450.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.0, 15.2, 218.0, 5700.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.6, 14.5, 215.0, 5400.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 46.5, 13.5, 210.0, 4550.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 45.4, 14.6, 211.0, 4800.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 46.7, 15.3, 219.0, 5200.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 43.3, 13.4, 209.0, 4400.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 46.8, 15.4, 215.0, 5150.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 40.9, 13.7, 214.0, 4650.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.0, 16.1, 216.0, 5550.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.5, 13.7, 214.0, 4650.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 48.4, 14.6, 213.0, 5850.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.8, 14.6, 210.0, 4200.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.3, 15.7, 217.0, 5850.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 42.0, 13.5, 210.0, 4150.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.2, 15.2, 221.0, 6300.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 46.2, 14.5, 209.0, 4800.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 48.7, 15.1, 222.0, 5350.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 50.2, 14.3, 218.0, 5700.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.1, 14.5, 215.0, 5000.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 46.5, 14.5, 213.0, 4400.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 46.3, 15.8, 215.0, 5050.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 42.9, 13.1, 215.0, 5000.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 46.1, 15.1, 215.0, 5100.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 44.5, 14.3, 216.0, 4100.0, None),
┊ │ ('Gentoo', 'Biscoe', 47.8, 15.0, 215.0, 5650.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 48.2, 14.3, 210.0, 4600.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.0, 15.3, 220.0, 5550.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.3, 15.3, 222.0, 5250.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 42.8, 14.2, 209.0, 4700.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 45.1, 14.5, 207.0, 5050.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 59.6, 17.0, 230.0, 6050.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 49.1, 14.8, 220.0, 5150.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 48.4, 16.3, 220.0, 5400.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 42.6, 13.7, 213.0, 4950.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 44.4, 17.3, 219.0, 5250.0, 'MALE'),
┊ │ ]
┊ │ return pd.DataFrame(rows, columns=["species", "island", "bill_length_mm", "bill_depth_mm",
┊ │ "flipper_length_mm", "body_mass_g", "sex"])
┊ ✓ (0.0s)
┊ ↳ sub-agent · 1 step · click to expandclick to collapse
┊ │ [0] # 43 notes: read each one and type out its row. Lengths to mm, weights to g,
┊ │ # and 0.2 lb off every weight given in lb.
┊ │ import pandas as pd
┊ │
┊ │ rows = [
┊ │ ('Gentoo', 'Biscoe', 44.0, 13.6, 208.0, 4350.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 48.7, 15.7, 208.0, 5350.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 42.7, 13.7, 208.0, 3950.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.6, 16.0, 225.0, 5700.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.3, 13.7, 210.0, 4300.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.6, 15.0, 216.0, 4750.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 50.5, 15.9, 222.0, 5550.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 43.6, 13.9, 217.0, 4900.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 45.5, 13.9, 210.0, 4200.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.5, 15.9, 225.0, 5400.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 44.9, 13.3, 213.0, 5100.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 45.2, 15.8, 215.0, 5300.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 46.6, 14.2, 210.0, 4850.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 48.5, 14.1, 220.0, 5300.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.1, 14.4, 210.0, 4400.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.1, 15.0, 225.0, 5000.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 46.5, 14.4, 217.0, 4900.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 45.0, 15.4, 220.0, 5050.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 43.8, 13.9, 208.0, 4300.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 45.5, 15.0, 220.0, 5000.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 43.2, 14.5, 208.0, 4450.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.4, 15.3, 224.0, 5550.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.3, 13.8, 208.0, 4200.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 46.2, 14.9, 221.0, 5300.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.7, 13.9, 214.0, 4400.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 54.3, 15.7, 231.0, 5650.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.8, 14.2, 219.0, 4700.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.8, 16.8, 230.0, 5700.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 46.2, 14.4, 214.0, 4650.0, None),
┊ │ ('Gentoo', 'Biscoe', 49.5, 16.2, 229.0, 5800.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 43.5, 14.2, 220.0, 4700.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.7, 15.0, 223.0, 5550.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.7, 15.0, 216.0, 4750.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 46.4, 15.6, 221.0, 5000.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 48.2, 15.6, 221.0, 5100.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 46.5, 14.8, 217.0, 5200.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 46.4, 15.0, 216.0, 4700.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 48.6, 16.0, 230.0, 5800.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.5, 14.2, 209.0, 4600.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 51.1, 16.3, 220.0, 6000.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.2, 13.8, 215.0, 4750.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 45.2, 16.4, 223.0, 5950.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 49.1, 14.5, 212.0, 4625.0, 'FEMALE'),
┊ │ ]
┊ │ return pd.DataFrame(rows, columns=["species", "island", "bill_length_mm", "bill_depth_mm",
┊ │ "flipper_length_mm", "body_mass_g", "sex"])
┊ ✓ (0.0s)
┊ ↳ sub-agent · 1 step · click to expandclick to collapse
┊ │ [0] # 43 notes: read each one and type out its row. Lengths to mm, weights to g,
┊ │ # and 0.2 lb off every weight given in lb.
┊ │ import pandas as pd
┊ │
┊ │ rows = [
┊ │ ('Gentoo', 'Biscoe', 52.5, 15.6, 221.0, 5450.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.4, 14.6, 212.0, 4725.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.0, 15.9, 224.0, 5350.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 44.9, 13.8, 212.0, 4750.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.8, 17.3, 228.0, 5600.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 43.4, 14.4, 218.0, 4600.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 51.3, 14.2, 218.0, 5300.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.5, 14.0, 212.0, 4875.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 52.1, 17.0, 230.0, 5550.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.5, 15.0, 218.0, 4950.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 52.2, 17.1, 228.0, 5400.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.5, 14.5, 212.0, 4750.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.5, 16.1, 224.0, 5650.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 44.5, 14.7, 214.0, 4850.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.8, 15.7, 226.0, 5200.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 49.4, 15.8, 216.0, 4925.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 46.9, 14.6, 222.0, 4875.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 48.4, 14.4, 203.0, 4625.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 51.1, 16.5, 225.0, 5250.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 48.5, 15.0, 219.0, 4850.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 55.9, 17.0, 228.0, 5600.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.2, 15.5, 215.0, 4975.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.1, 15.0, 228.0, 5500.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.3, 13.8, 216.0, 4725.0, None),
┊ │ ('Gentoo', 'Biscoe', 46.8, 16.1, 215.0, 5500.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 41.7, 14.7, 210.0, 4700.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 53.4, 15.8, 219.0, 5500.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 43.3, 14.0, 208.0, 4575.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 48.1, 15.1, 209.0, 5500.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 50.5, 15.2, 216.0, 5000.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.8, 15.9, 229.0, 5950.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 43.5, 15.2, 213.0, 4650.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 51.5, 16.3, 230.0, 5500.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 46.2, 14.1, 217.0, 4375.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 55.1, 16.0, 230.0, 5850.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 44.5, 15.7, 217.0, 4875.0, None),
┊ │ ('Gentoo', 'Biscoe', 48.8, 16.2, 222.0, 6000.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 47.2, 13.7, 214.0, 4925.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', None, None, None, None, None),
┊ │ ('Gentoo', 'Biscoe', 46.8, 14.3, 215.0, 4850.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 50.4, 15.7, 222.0, 5750.0, 'MALE'),
┊ │ ('Gentoo', 'Biscoe', 45.2, 14.8, 212.0, 5200.0, 'FEMALE'),
┊ │ ('Gentoo', 'Biscoe', 49.9, 16.1, 213.0, 5400.0, 'MALE'),
┊ │ ]
┊ │ return pd.DataFrame(rows, columns=["species", "island", "bill_length_mm", "bill_depth_mm",
┊ │ "flipper_length_mm", "body_mass_g", "sex"])
┊ ✓ (0.0s)
┊ ✓ (3.9s)
┃ >>> evaluate(extracted_data)
{'accuracy_overall': 1.0, 'accuracy_weights_in_lb': 1.0}

Step 8 of 10 · Next season

And next season?

Suppose the team learns from this one, and next season every note is written to the same template. Have a look at them.

Step 8 of 10 · Next season

What just happened

One format, 344 times. A single regular expression can read these: no agent should need many turns for it, or any subagents.

┃ >>> from field_study import templated_notes
┃ >>> templated_notes.head()
note
0 Adelie, Torgersen. MALE. Bill 39.1 mm long, 18...
1 Adelie, Torgersen. FEMALE. Bill 39.5 mm long, ...
2 Adelie, Torgersen. FEMALE. Bill 40.3 mm long, ...
3 Adelie, Torgersen. Sex unknown. Not measured.
4 Adelie, Torgersen. FEMALE. Bill 36.7 mm long, ...

Step 9 of 10 · Hooks

How do you hold an agent to that?

With hooks. A hook watches a run and can change it; ReturnType, which you have passed all along, is one. JAZ ships more: here at most five turns, no subagents at all, and ten cents of model spend.

A hook passed to invoke applies to that one call. A hook used with with applies to every invoke inside the block, subagents included.

Step 9 of 10 · Hooks

What just happened

Two turns, no subagents, every cell right. Had the agent run past a limit, invoke would have raised an error (IterationLimitExhaustedError, BudgetPoolExhaustedError) instead of carrying on.

┃ >>> from jaz.hooks import BudgetPool, IterationLimit, RecursionLimit
┃ >>> with IterationLimit(max_iterations=5), RecursionLimit(max_depth=1), BudgetPool(cost_budget=0.1):
┃ ... templated_extracted_data = invoke(
┃ ... ReturnType(pd.DataFrame),
┃ ... task=task,
┃ ... field_notes=templated_notes,
┃ ... )
┃ ...
┊ │ [0] # Look at a sample of the notes before deciding how to extract them.
┊ │ print(field_notes.note.head(12).to_string())
┊ ✓ (0.0s)
┊ │ [1] # Every note follows one template, so one regular expression extracts them all.
┊ │ import re
┊ │ import pandas as pd
┊ │
┊ │ PATTERN = re.compile(r"(\w+), (\w+)\. (\w+)[^.]*\.(?: Bill ([\d.]+) mm long, ([\d.]+) mm deep; "
┊ │ r"flipper ([\d.]+) mm; mass ([\d.]+) g\.)?")
┊ │ rows = []
┊ │ for note in field_notes.note:
┊ │ species, island, sex, *numbers = PATTERN.match(note).groups()
┊ │ rows.append([species, island, *(float(n) if n else None for n in numbers),
┊ │ sex if sex in ("MALE", "FEMALE") else None])
┊ │ return pd.DataFrame(rows, columns=["species", "island", "bill_length_mm", "bill_depth_mm",
┊ │ "flipper_length_mm", "body_mass_g", "sex"])
┊ ✓ (0.0s)
┃ >>> evaluate(templated_extracted_data)
{'accuracy_overall': 1.0, 'accuracy_weights_in_lb': 1.0}

Step 10 of 10 · Configuration

Does every call need the big model?

With the data clean, your script moves on to its analysis: how much heavier is a penguin for each extra millimetre of flipper, species by species? SciPy has a robust fit for that (Theil–Sen), and the task is easy, so a smaller model will do.

Both are configuration. ConfigOverride changes it for one call when it is passed like a hook, or for a whole block with with. Here it swaps the model, and gives the model's code a sandbox that may import scipy.

Step 10 of 10 · Configuration

What just happened

A dict came back, typed as you asked: for each species, a slope in grams per millimetre of flipper, and an intercept.

┃ >>> from jaz import ConfigOverride
┃ >>> from jaz.llm import LiteLLM
┃ >>> slopes_intercepts = invoke(
┃ ... ConfigOverride(
┃ ... llm=LiteLLM(model="openai/gpt-5.4-nano"),
┃ ... repl=PythonREPL(allowed_imports=["scipy"]),
┃ ... ),
┃ ... ReturnType(dict[str, tuple[float, float]]),
┃ ... task="For each species, fit a robust linear regression of body mass on flipper length "
┃ ... "with scipy.stats.theilslopes, and return (slope (g/mm), intercept (g)) pairs, "
┃ ... "keyed by species.",
┃ ... penguins=extracted_data,
┃ ... )
┊ │ [0] # One Theil-Sen fit per species: body mass on flipper length.
┊ │ from scipy.stats import theilslopes
┊ │
┊ │ measured = penguins.dropna(subset=["flipper_length_mm", "body_mass_g"])
┊ │ fits = {}
┊ │ for species, group in measured.groupby("species"):
┊ │ slope, intercept, _, _ = theilslopes(group.body_mass_g, group.flipper_length_mm)
┊ │ fits[species] = (round(float(slope), 2), round(float(intercept), 1))
┊ │ return fits
┊ ✓ (0.2s)
┃ >>> slopes_intercepts
{'Adelie': (34.15, -2788.6), 'Chinstrap': (34.0, -2964.0), 'Gentoo': (56.82, -7272.7)}

Done · Summary

That was all of JAZ

  • Inputs. invoke takes any Python objects as keyword arguments: the prompt, data such as a DataFrame, and tools such as search_field_journal all go in the same way.
  • Outputs. The agent returns a real Python object, which ReturnType checks.
  • Subagents and scope. Any agent can call invoke to hand work on, and scope(...) gives an input to every agent in a block.
  • Hooks watch and constrain a run, for one call or for a block.
  • Configuration sets the model and the sandbox: configure for everything, ConfigOverride for a call or a block.

This was a recording. The notebook is the same script, live:

Or run it in the jaz console yourself:

curl -LsSf https://raw.githubusercontent.com/jaz-lang/jaz/main/install.sh | sh

Installs the console with its own Python. Then run jaz in a new terminal.Windows and more

$ jazrecorded session
JAZ
Now with 50% more recursion
╭───────────────────────────────────────────────────────────────────────────╮
│ Interactive jaz console — ask the agent, with a Python session behind it. │
│ │
│ what does jaz.invoke return? a line is a prompt for the agent │
│ summarize {doc} in two lines {braces} show the agent a variable │
│ n: int <- how long is {doc}? capture a typed result │
│ ?doc show what the agent sees for `doc` │
│ ! Python mode: a line is Python (! returns) │
│ │
│ /vars list the session's variables │
│ │
│ Type /exit or Ctrl-D to quit. │
╰───────────────────────────────────────────────────────────────────────────╯
>
ask the agent · ! for Python · / for commands
Type next

A recorded session, replayed as you pick lines. To try it out live, install the console:

curl -LsSf https://raw.githubusercontent.com/jaz-lang/jaz/main/install.sh | sh

Installs the console with its own Python. Then run jaz in a new terminal.Windows and more