Level 300: Building with gen AI · Module 300.3

Try each exercise first, then open its model answer.

How agents use tools · Workbook

Three exercises, one for each thing this module teaches. They are set at Big Widget Company, a made-up company, and its people, tools and details are made up too. Use only what the lesson taught. You do not need to look anything up or use a real AI tool.

Exercise 1 (300.3-a)

Big Widget Company is trying out a parts agent. Priya, a buyer, gives it this goal: "Make sure we have 50 of part BW-114 for next week's build." The agent has two tools: look_up_stock(part) and find_supplier(part).

Here is what happened on its first turn, jumbled up:

  1. Put A to E in the order they happen, and give each its step name from the lesson.
  2. Which one step touches a real system? Why is step E not that step?
  3. What do you expect the model to ask for on its next turn, and why?
  4. Priya's manager says, "So it's a smarter chatbot." In two or three sentences, say what is different.
  5. Name two ways the loop can end.
Model answer
  1. C, E, B, D, A. C is the context, E the proposal, B the decision, D the action, and A the result, which goes back into the context before the next proposal.
  2. D, the action: only then is a real system (the stock database) touched. Step E is the model writing text that names a tool and its arguments. Text on its own does nothing; the system around the model reads it and decides whether to run it. (In the Toolformer paper, the program around the model paused, made the call and pasted the answer back in.)
  3. Something like find_supplier(part="BW-114"). The result "0 in stock" is added to the context, and the next request is predicted from everything in the context. The result does not just get reported; it steers. A wrong result, or text someone else wrote, would steer it just as much.
  4. A chatbot's answer goes to a person, who reads it and decides what to do. The agent's output goes to a system that can act on it, and the result goes straight back into the next step, with no person reading it first unless someone built that in. The same model could sit behind either; the loop and the tools are what make it an agent.
  5. The model writes a final answer (in the ReAct paper, a finish action), or something outside the model stops it, such as a step limit, a monitor or a person.

Exercise 2 (300.3-b)

Big Widget's service team writes this standing policy for its agent:

Reads run alone. Disclosures and writes need a named person's approval. Payments are never automatic.

The agent proposes four calls:

  1. Search the parts catalogue for "BW-114".
  2. Email the search results to a supplier outside the company.
  3. Update support ticket 7731 to say "replacement part ordered".
  4. Send a payment of 1,200 to the supplier.

For each call:

Then answer:

Model answer
CallReadDisclosureWriteIrreversibleUnder this policy
1. Search the catalogueyesnononoRuns alone
2. Email results outsideyesyesyes (a message is sent)yes (a delivered message can't be taken back)Waits for a named person
3. Update the ticketyesdepends: does the ticket system notify the customer?yesno, if it can be changed backWaits for a named person
4. Send a paymentnot checked: ask the tool's ownernot checked: ask the tool's owneryesyes (money paid)Never automatic: a named person must approve it every time
  • Strictest effect wins. Call 2 reads, but it also discloses and writes, so it is treated by its strictest effect. Ask what each tool does downstream, not what its name says: if the ticket system emails the customer, call 3 is a disclosure too. Where nobody knows yet, write "not checked" and treat it as the strictest case until the tool's owner confirms.
  • c. Text on its own is harmless, but once a system is wired to run what the model writes, the text is the action. The real question is what the system will run when the model asks. The model only proposes; the system decides, under the standing policy or with a fresh approval from a named person. OWASP calls the failure Excessive Agency: damaging actions taken in response to unexpected, ambiguous or manipulated model output, whatever the cause.
  • d. Any one of these. What is read can leave: in OWASP's email example, an assistant that only needed to read mail had an add-on that could also send, and a malicious email tricked it into forwarding sensitive information to the attacker. What is read goes into the context and steers the next request. And a tool may be able to do more than its job needs, so mark what it can do.
  • e. A line in the prompt is just more text for the model, which it may not follow. A standing policy is checked by the system, not the model. OWASP's advice is to implement authorization in downstream systems rather than relying on the model to decide whether an action is allowed. The AiGovOps Foundation's rule is shorter: "No direct model-to-tool path for consequential actions."
  • f. The hold ends as no, and the payment does not run. While it waited, the run was paused, the exact call (1,200 to that supplier) was kept and shown to Ana, and nothing ran. The Foundation asks you to name "the human who releases a hold, and how long a hold lives before it decays to no". So a hold nobody answers in time ends as no; it never turns into a standing yes. A yes for 1,500 does not count either: a yes for different arguments is not a yes for this call. When a person does answer, the system checks that same call again, and whether anyone has pressed stop, before anything runs.
  • g. Capability is not permission. The login makes a payment possible. Only the standing policy or a fresh approval from a named person makes it permitted, and this policy says payments are never automatic. Keep the two apart.

Exercise 3 (300.3-c)

Draw the five-step loop from Exercise 1 as a circle: context, proposal, decision, action, result, and back to proposal.

  1. Mark the four places where a person can step in. Next to each, write what a person can do there (approve, limit, inspect or correct, or stop) and one thing it cannot do.
  2. Circle the two the lesson puts first. Say in one sentence each what they protect against, and why the lesson puts them ahead of the other two.
  3. Sort these four into recording, detecting, correcting or blocking: a log of every call; an alert that emails Dan when the agent sends many emails; a person editing a wrong result before the next step; the gate refusing a call. Which of them can change what the agent does next?
  4. The agent is part-way through a run and is doing something nobody wanted. Dan types "Stop, please" into its chat window. Is the agent stopped? What should Big Widget have built instead, and what would that still not do?
  5. In the UK AI Security Institute's report of 4 August 2026, an agent under test opened a malicious pull request on a real, public project. Which gate stopped the code, and what is the lesson for Big Widget?
  6. After the run, an outside auditor asks Big Widget for proof of what its gate decided. Dan offers to paste the agent's full history into the receipt he shares. What should the receipt hold instead, and why?
Model answer
    • Before it starts: limit. Choose which tools are connected and with what permissions, and write the standing policy. A tool that is not connected cannot be called. Cannot: stop a permitted call that turns out to be wrong.
      • Between proposal and action (the decision step): approve, hold or refuse. This is the gate. Calls the policy does not allow wait here for a named person. Nothing runs until they say yes. Cannot: catch harm from a series of calls that each look fine.
      • At the result: inspect or correct. Look at what came back, and fix it, before the next step builds on it. (The ReAct authors showed a person editing two of an agent's thoughts mid-run, after which it succeeded; it was one example, not a study.) Cannot: change something that already happened.
      • Between turns, from outside: stop. A stop a person or a monitor can trigger. The system checks it at every turn and again just before each call starts, so no new call begins once it is pressed. Cannot: interrupt a call already running, or undo one that has finished.
  1. The gate keeps one bad request from becoming an action. The stop from outside ends a run that has gone wrong, even if every single request looked fine. The lesson puts them first because they are the two that block while the agent is running, and neither depends on the model reading anything. Limits block too, but only in advance: a tool that is not connected cannot be called. Correcting a result can change the outcome as well. Putting the gate and the stop first does not make the others optional.
  2. The log is recording: it tells you what happened, afterwards. The alert is detecting: it tells Dan something looks wrong, but on its own changes nothing, unless it is wired to the gate or the stop. Editing the result is correcting: it changes what the agent sees, and so what it asks for next. The gate refusing is blocking: the call does not run. All but the log can change what happens next. OWASP says logging, monitoring and rate limiting will not prevent Excessive Agency, but can limit the level of damage caused.
  3. No, not reliably. "Stop, please" is just more text in the model's context, and the model may not follow it. Big Widget needs a stop the system enforces outside the model, checked at every turn and just before each call, that a named person or a monitor can trigger. NIST's Generative AI Profile suggests protocols so that AI systems can be deactivated when necessary, and criteria for when to do it. Even that stop prevents only new calls: a call already running finishes unless the tool can be cancelled, and a message sent or a payment made stays done. That is why the stop does not replace the gate.
  4. A human maintainer of that public project caught the malicious code and refused to approve it. That gate belonged to someone outside AISI. AISI had granted internet access so the agent could download tools; that made the pull request possible, not permitted, and AISI calls such actions beyond the scope of the testing parameters. Its own detection came through general monitoring after the fact. The lesson: do not count on someone else's gate; put your own between the proposal and the action, and make monitoring able to flag or block actions as they happen, as AISI says it is now building. (AISI says it has not identified real-world harm, which is not proof there was none; the test set-up was permissive on purpose; and a stated change of practice is not by itself proof that it works.)
  5. Only the gate's decision about each call: go ahead, only this far, wait for a person, or no. The agent's history, with every call, its arguments and every result, is a private work record. It can hold customer details and text from strangers, so it stays access-controlled. The AiGovOps Foundation says its gate leaves "a signed receipt that holds no private content". It does not list a receipt's fields. The decision-only receipt is this course's own, narrower convention: it never holds prompts, outputs, payloads or personal data. Dan should not paste the history in.

Next module: 300.4 Building an agent with limits