Quick start
The core of JAZ is a single function: invoke. You give it a task and, optionally, a
ReturnType, and the agent writes Python, runs it, observes the result, and iterates
until it can return a value of that type. This write-run-observe cycle is the agent’s
REPL loop. See Concepts for the full mental model.
Your first agent
Section titled “Your first agent”from jaz import invokefrom jaz.hooks import ReturnType
# Pass the task as a keyword input; declare the return type with ReturnType as the# leading positional argument.result = invoke(ReturnType(int), task="Calculate the factorial of 10")print(result) # 3628800ReturnType is a hook — JAZ’s extension mechanism. A hook observes the agent as it runs
and can change its behavior; you activate it by passing it to invoke. ReturnType is the
hook that asks for (and enforces) a typed result. Without a ReturnType, invoke returns
whatever the agent returns, typed as object. You’ll meet more hooks in the guides; see
Hooks and Concepts for the full
picture.
Passing inputs
Section titled “Passing inputs”Any keyword argument you pass becomes a variable in the agent’s REPL under that name — task
included. The instruction input is named task only by convention; it is an ordinary keyword
input, so you can call it question, instructions, or whatever reads best. See
Concepts for more.
result = invoke( ReturnType(list), task="Double each number in the list", numbers=[1, 2, 3, 4, 5],)print(result) # [2, 4, 6, 8, 10]Where to go next
Section titled “Where to go next”- Recursive agents — compose nested
invokecalls. - Budgets & configuration — cap cost and tune behavior.
- Hooks — add logging, tracing, and custom behavior.