You are signed in. Close

You are signed out. Close

Thank you. Your subscription has started. Close

Thank you. You will get an email when a new comic comes out. Close

We could not confirm your payment. If you paid, use the link "Sign in" at the bottom of the page. Close

Something went wrong on our side. Please try again in a moment. Close

Previous episode Tool descriptions: how an AI agent picks the right tool

How AI agents work: an AI that can only write, and still gets things done

The agent loop: how an AI agent keeps going until the job is done

One request can need three tools in a row: check the weather, read the calendar, send a message. But the AI model asks for one tool at a time, and then it waits. So what keeps the AI agent working until the job is done?

  1. 1 Round one starts as before: the model writes a request for the weather. The app runs it and pastes back the result: rain from 2 pm.round 1your requestthe modelrequesttool: weatherplace: the parkday: Saturdaythe appresultrain from 2 pm

    Round one starts as before: the model writes a request for the weather. The app runs it and pastes back the result: rain from 2 pm.

  2. 2 Round two. The model keeps nothing between runs, so the app sends it everything again, that result included. The model reads "rain" and asks the calendar tool to move the picnic to Sunday. The app runs that one too.round 2your requestresultrain from 2 pmthe modelrequesttool: calendarmove: the picnicto: Sundaythe appresultmoved to Sunday

    Round two. The model keeps nothing between runs, so the app sends it everything again, that result included. The model reads "rain" and asks the calendar tool to move the picnic to Sunday. The app runs that one too.

  3. 3 Round three: a request to the messages tool, for Miva and Rono. Sent.round 3your requestresultrain from 2 pmresultmoved to Sundaythe modelrequesttool: messagesto: Miva, Ronotext: Rain on Saturday,picnic moved to Sundaythe appresultsent

    Round three: a request to the messages tool, for Miva and Rono. Sent.

  4. 4 In round four, the model writes only words for you, with no request in them. For the app, that is the signal to stop: it shows you the answer.round 4the modelthe appno requestDone! Rainon Saturday,so the picnicis on Sunday.Miva andRono know.

    In round four, the model writes only words for you, with no request in them. For the app, that is the signal to stop: it shows you the answer.

  5. 5 Draw it as a circle: the model writes, the app runs, the result goes back. This is the agent loop. A model and an app that run it together are what people call an AI agent.the modelrequest result the appa toolno request:your answerthe agent loop

    Draw it as a circle: the model writes, the app runs, the result goes back. This is the agent loop. A model and an app that run it together are what people call an AI agent.

  6. 6 On Miva's and Rono's phones, the message is already there. You asked for it, true, but nobody showed you the words before they went out. So who decides what an agent is allowed to do?Rain onSaturday,picnic movedto SundayMivaRain onSaturday,picnic movedto SundayRonoyou?

    On Miva's and Rono's phones, the message is already there. You asked for it, true, but nobody showed you the words before they went out. So who decides what an agent is allowed to do?

  7. Quick check

    Count the runs.request result request result All set!How many timesdid the app runthe model?

    Count the runs.

    Show the answer

    Three. Once for each request, and once more for the answer with no request.

  8. Go further

    One name from the research.ReActA 2022 research paperon this loop: think,act, read the result.The best-known earlyname for it

    One name from the research.

Next episode AI agent permissions: who decides what an agent may do

Share this comic

More comics