Skip to content
ML to LLMs
Labs / AI Engineering

Agent loop

Step through an agent's think, call tool, observe loop with mocked tools; inject failures and step limits.

Theory and worked examples: Tool use and agents

Agent loop lab

Task: “Find the cheapest refundable SFO→SEA flight on Nov 14 under $300 and hold it.” A scripted model with four mocked tools; step through each thought, tool call, and observation.

Context window1,200 tokens

Purple: system prompt + tool schemas + task (1,200). Each later segment: one turn's thought, call, and observation.

  1. tools search_flights · get_fare_rules · hold_booking · web_search

    search_flights: “Live scheduled flights, sorted by price.” web_search: “General web pages. Not a source of live prices or fare rules.”

Press Step (or Autoplay). Before the first model call the context already holds the system prompt, every tool schema, and the user task: 1,200 tokens.