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
- Exposes current inverter output to an agent deciding whether excess solar power can support home climate control.
- How deep it goes
- Shows a decorated function and its input-and-return documentation, but does not explain decorator internals.
- Examples
- Uses a local inverter query alongside weather-forecast and home-digital-twin API tools.
- What you can do after
- Apply it via the Strands SDK to make a documented Python function callable by an agent.
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.
Related concepts
- toolimplements · A tool is an instrument or software capability that enables a person or system to perform a task, obtain information, or interact with resources.
- 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 usageimplements · Tool use is an AI system's invocation of external software functions, services, or other capabilities 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.
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.

