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.
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.
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.
Also covered in
What to know first
- language modelA language model is a computational model of linguistic sequences that estimates their probabilities or predicts tokens from context, enabling it to generate or evaluate language.
- AI agentAn AI agent is a computational system that perceives information about an environment and selects or performs actions to pursue goals.
Related concepts
- toolimplements · A software tool is a capability or utility that enables a person or system to perform a defined task or operation.
- custom toolimplements · A custom tool is a developer-defined, agent-callable capability that performs domain-specific actions beyond built-in functions and returns results.
- tool useimplements · Tool use is the capability of an AI system or agent to request external software operations through defined interfaces to obtain information or perform actions.
- function_tool decoratoralternative to · A decorator or helper that exposes a programming-language function as an agent-callable tool and generates its structured tool description.
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.

