Skip to content
Simon Place
FR EN
Book a Meet call

Module 4 of 10, lesson 4 of 5

Practice

Reasoning loops and architectures

Write the code

Runs in your browser, with no install, account or API key. The model is scripted, so the results are repeatable.

const sameCall = (a, b) => a.name === b.name && a.input === b.input;async function runAgent({ model, tools, prompt, maxSteps = 20 }) {  const messages = [{ role: 'user', content: prompt }];  let previous = null;  let repeats = 0;  for (let step = 0; step < maxSteps; step += 1) {    const response = await model.create({ messages });
Repair the agentDetect a stuck agent
Open in the editor
async function executePlan(plan, tools) {  const evidence = {};  // TODO  return { status: 'done', evidence };}module.exports = { executePlan };
Give the agent a skillBuild a ReWOO executor
Open in the editor

Running project

Running project: write by hand, in ReAct style, the trace of a refund request where the order can’t be found. Rewrite it in ReWOO style. Count the model calls and find the moment the ReWOO plan becomes wrong.

Practice

Some of these need a free account or an API key, which may be paid.

Legal notice and privacy