liveBook · Manning

Tool decorator

A tool decorator is a programming-language decorator that marks a function as an externally callable tool and can attach metadata or a parameter schema.

How 2 Manning books explain it

Digital Twins in Action

A decorator that marks a Python function as a callable tool for an AI agent.

How it is used
Enables a home digital twin agent to retrieve solar-generation data for power optimization.
How deep it goes
Shows a decorated function and its documentation, without explaining the decorator’s internals.
Examples
Uses a local Fronius inverter query that returns current power and daily energy production.
What you can do after
Apply it via the Strands SDK to make a documented Python function available as an agent tool.

Read how Digital Twins in Action explains tool decorator →

Data Analysis with LLMs

The LangChain tool decorator is a Python decorator that converts a function into a tool with metadata describing its name, parameters, and behavior.

How it is used
Turns custom Python functions into tools that agents can invoke.
How deep it goes
Explains decorator placement, function naming, and type annotations; does not detail decorator internals.
Examples
Uses a currency-conversion function to support analysis of video-game sales across currencies.
What you can do after
Build it from scratch: decorate a typed Python function for use as an agent tool.

Read how Data Analysis with LLMs explains tool decorator →

Also covered in

What to know first

Related concepts

Questions about tool decorator

What is tool decorator?

A tool decorator is a programming-language decorator that marks a function as an externally callable tool and can attach metadata or a parameter schema.

Which Manning books explain tool decorator?

Digital Twins in Action and Data Analysis with LLMs.

What should I know before learning tool decorator?

Manning books that teach tool decorator usually introduce language model and AI agent first.

What is the difference between tool decorator and createRetrieverTool?

A tool decorator is a programming-language decorator that marks a function as an externally callable tool and can attach metadata or a parameter schema. createRetrieverTool is a LangChain function that wraps a retriever as a tool callable by an AI agent.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.