Learn AI. Do. Grow.
← All modules

Deep dive · module 73 of 100

Tools and function calling

Understand how AI can call external tools.

After this lesson

You can explain what function calling is and when it is useful.

In view · Step by step

A tool call makes a detour

  1. For example, performing a calculation with clearly named inputs.

  2. The application validates the call and lets the allowed tool calculate.

  3. The tool result goes back to the model and is used in a controlled manner.

Remember: The application determines which tools and actions are actually available. Open het volledige schema ↗

What is function calling?

The model can call an external tool (for example, a calculator, search function, or database) and use the result.

When is it useful?

For exact calculations, real-time data, or actions in other systems.

Control remains necessary

The model chooses which tool to call. Check whether the correct tool was used and whether the result is correct.

New practice example

From explanation to a usable result.

When using tools, a model makes a proposal for a function call; the application must check the input and authority.

Fictional practice situation

A fictitious assistant proposes a calendar call with a duration of 30 minutes, but without a date. The application should only execute complete proposals after agreement.

View a possible solution

This is how it can be done

Validate the mandatory fields and first ask for the missing date. Show the full proposal for verification. A text like “appointment made” is not proof: you must read the actual calendar outcome for that.

Why this works

A function with a neat name is not yet a safe action. Validation, permission, and outcome checking belong in the application.

Make it slightly more difficult

Have the tool return a time-out. Which status do you show before you decide, as retrying could cause a duplicate appointment?

Extra practice, at your own pace. You do not need to submit anything. This does not count towards an automatic assessment.

Your workplace · learning by doing

Make something. See what changes.

Ende, your light pink practice buddy

The fictitious source is included. Only when selecting ‘Let Ende answer’ do you send your assignment to the AI service. Do not use private data.

Checking the AI connection… You can already view the written example.

Your result

No answer yet

Present your assignment to Ende.
Read the answer, change one thing, and compare.

You remain in control

What do you want to improve in your next attempt?

My own check

On this device only. AI answers remain only in this page memory. This is self-review, not a grade.

Why this approach works

A function with a neat name is not yet a safe action. Validation, permission, and outcome checking belong in the application.

A step further

Have the tool return a time-out. Which status do you show before you decide, as retrying could cause a duplicate appointment?

Try & discover · no obligation

Control an agent with a control port

Try to send before the check. Then also test a missing source or a malfunction.

Test the fictitious workflow

Choosing a different situation starts a new test and clears the previous approval.

The agent is waiting. You choose which step to test.
  1. Retrieve source
  2. Check draft
  3. Execute action
Starttoestand
Noapproval for this concept

What is happening?

  1. No source has been retrieved yet. Feel free to try the submit button first.

All tools, queues and submissions have been simulated. No message is sent and no external service is called.

This trial works locally with fictitious data and does not count towards your lesson completion. It starts anew with a new lesson or reload.

A prompt to get you started

Briefly explain what function calling is and give one example where it is more useful than just generating text.

Apply it

A model requests to call a tool to change data. The proposal contains an unknown dossier ID.

Which approach best fits this situation?

  • Execute every tool call automatically.
  • Validate arguments and permissions before the tool executes anything.
  • Let the model determine for itself which access rights it receives.

With JavaScript, you can check your approach and receive immediate feedback.

Test your insight

What is function calling?

  • The model can call external tools and use their results.
  • A way to make prompts longer.
  • Only for programmers.
Extra practice

Name a task where an external tool (calculator, search function, database) is more useful than a language model alone.

An exact calculation or looking up current stock levels.

A question? I'll help you on your way.

Drag Aldo to move it. Use the arrow keys on Aldo with the keyboard, Enter to save the position and Escape to cancel.