Build my path

3f9c1e0course(agent-builder):curriculum preview · demo

Tool Calling That Holds Up

Let a model call your functions without letting it call them wrong. Schemas, validation, guardrails and approvals.

track
Agent Builder
level
Working
length
6 modules · about 14 hours

Your progress dot moves to this branch

foundationsbuildautomatedeploylead

Prerequisites

  • LLM Apps, Properly, or similar experience
  • Has handled HTTP errors

3f9c011docs:outcomes and build

You will be able to

  • Write tool schemas the code enforces
  • Return useful errors to the model
  • Guard money and data actions with limits
  • Test tool use with recorded scenarios

Hands-on build

A guarded tool layer

Three tools (lookup, update, refund) with schemas, limits, approvals and tests.

3f9c022feat:6 modules

Modules.

  1. module 1

    What a tool call really is

    Outcome: Read a raw tool call and trace it to your code.

    Lessons: The loop: model, tool, model · Names, descriptions and why they matter · Reading raw calls

  2. module 2

    Contracts

    Outcome: Schemas with types, enums, ranges and required fields.

    Lessons: Required vs optional · Enums beat free text · Ranges and units

    free Tool calls need contracts covers this module interactively.

  3. module 3

    Validation and error replies

    Outcome: Bad calls are rejected with a message the model can fix.

    Lessons: Validate before you run · Writing error messages for a model · Retry once, then stop

    free Tool calls need contracts covers this module interactively.

  4. module 4

    Guardrails for actions

    Outcome: Limits and approvals enforced in code.

    Lessons: Read vs write tools · Amount limits · Approval queues

    free Trace an agent run, end to end covers this module interactively.

  5. module 5

    Idempotency and retries

    Outcome: Retries that never double an action.

    Lessons: Idempotency keys · Timeouts on tools · Partial failure

    free Trace an agent run, end to end covers this module interactively.

  6. module 6

    Scenario tests

    Outcome: Ten recorded scenarios that run on every change.

    Lessons: Recording a conversation · Asserting on tool calls · Keeping tests cheap

3f9c033docs:sample lesson

Sample lesson · Enums beat free text

If a field can only be one of four values, say so in the schema. A model asked for a free-text "reason" will invent new reasons; a model given an enum picks from your list, and your code can reject anything else.

The free lesson on tool calling lets you break this rule and watch what happens.

3f9c044test:assessment rubric

Ready to merge when

CriterionReady to mergeNot yet
ContractEvery argument has a type and the code rejects anything else.The schema exists only in the prompt.
ActionsWrite actions have limits and an approval rule enforced in code.The prompt asks the model to be careful.
TestsScenarios cover a bad argument, a refusal and an approval.Only the happy path is tested.