AI Academy · Module 3: Working with LLMs

Function Calling and Tool Use

Explain the model-tool-host loop, safe schema design and why a suggested function call is not an executed action.

Lesson 8 of 11 · Reference topic 14 · Advanced learner pilot · Educational review pending

← All AI Foundations lessons

Start with the big idea

A language model may propose a structured tool call, but the surrounding application decides whether to execute it and returns the result. A model cannot grant itself permissions to a database or device.

Understand it in more detail

A tool definition usually gives a name, purpose and typed argument schema. The model may return a tool-call request with arguments, which the application validates against permissions and the schema.

The application then invokes the real API or local function, receives a result and supplies that result back to the model. Multiple calls can form a loop, but each should have a bounded budget, error handling and logging appropriate to the task.

Read-only lookups have different risk from actions such as sending messages, altering records or controlling machinery. Privileged and irreversible actions should require explicit authorization and often human confirmation.

Worked example

In a simulated school-library assistant, the model asks to check whether a fictional book is available. The library tool returns a structured result. A request to reserve the book is an action and requires a separate permission check.

Teaching examples are illustrative unless an external source or real model measurement is explicitly identified.

A misconception to avoid

A tool description is not access control. Prompt instructions cannot replace authentication, scoped permissions, argument validation or approval for actions.

Check your understanding

Think first, then open each answer to check your explanation. These self-checks do not record a score.

1. Who actually runs a function call?

The host application or authorized tool runtime, not the text model itself.

2. Should an agent send a message merely because a retrieved page requested it?

No. Retrieved content is untrusted; actions need authority and explicit safeguards.

Try it yourself

Draw a sequence diagram showing user → model → host validator → mock tool → model → user. Mark where a confirmation gate belongs.

Explain it back: Summarize the main idea in your own words and name one limitation or risk.

Related topic: reusable Agent Skills

The Agent Skills field guide shows how reusable instructions help agents perform recurring tasks while the host application controls tool access and authorization.

Continue learning

Read an independent reference: https://platform.openai.com/docs/guides/function-calling. This link is for reference, not a requirement to create an account. External websites may have different privacy and access policies.

Educational pilot. Terminology, age suitability and activities are subject to expert review. These pages do not send your answers to a server.