Um momento
0x20Lesson 3 of 6

Design tools and action contracts

Give each action a narrow purpose, validated inputs, and a clear result.

12 min 5-question quiz
By the end of this lesson you can
  • Specify tool inputs, effects, and outputs that a loop can use safely.

Tools connect a loop to the outside world. Give each tool a narrow purpose, a clear input schema, predictable output, and a description of any side effects. Validate arguments at the application boundary, check authorization for the current user, and return enough structured information for the next step. Read-only lookup and state-changing actions should be treated differently.

A small example

Illustrative Python
tool = {"name": "lookup_invoice", "effect": "read-only", "inputs": ["invoice_id"]}
print(tool["name"], tool["effect"], tool["inputs"])
Output
lookup_invoice read-only ['invoice_id']

Prefer a small set of understandable tools over a broad action that can do anything. Validate external identifiers, impose timeouts, and make retry behavior safe. Before destructive or consequential actions, show the proposed effect and obtain required user consent.

Key takeaways

  • Specify tool inputs, effects, and outputs that a loop can use safely.

  • Bound the loop, validate actions, and make its outcome observable.

Lesson quiz

5 questions · pass with 4 correct · up to 50 XP

Passing this quiz completes the lesson and keeps your streak going. Questions you miss come back in review sessions later.

Questions about this lesson

Stuck? Ask. Figured something out? Share it. Explaining is one of the best ways to learn.

Loading posts…

Gostou da aula? 😆👍
Apoie nosso trabalho com uma doação: