liveBook · Manning

Tool

As explained in AI Agents for Offensive Security

An external software capability that an agent can call to perform an action or obtain an effect outside the language model.

A tool is an external capability an AI agent calls to act on the world rather than only generate text. It can be a custom function, script, API call, scanner, database, or MCP server. Tools turn model reasoning into measurable action, while the agent controller decides which tool to run and when. section 1.3.1 section 2.3.1

A tool should have a narrow responsibility and remain unaware of the wider execution plan. It accepts structured input, returns structured output, and does not decide its own scheduling or interpret how downstream components will use its result. This separation lets a controller compose multiple tools into a feedback-driven workflow. section 2.5.3 section 2.5.4 section 2.5.5

Listing 2.2 The tool schema
class Tool:
    name: str
    description: str
 
    def invoke(self, input: Dict[str, Any]) -> Dict[str, Any]:
        """Run the tool and return structured output."""
        raise NotImplementedError
 

A minimal tool contract names the capability, describes it, and exposes an invoke method that accepts and returns structured data. section 2.5.3

Use a durable interface around each tool:

  • Declare a name and description so the capability can be identified and selected. section 2.5.3
  • Make invoke accept structured input and return structured output under the shared observations schema. section 2.5.3
  • Record outputs as artifacts so data movement and agent behavior can be inspected or replayed. section 2.5 section 2.8
  • Place safety controls around action, including gates, sandboxing, logging, and kill switches. section 2.8

URL extraction and summarization

One tool extracts URLs from text with a regular expression and returns a urls field. A second tool receives that artifact, counts the URLs, and returns a short summary. The agent runs the first tool, records its result, passes the artifact to the second tool, then stops. section 2.5 section 2.5.4 section 2.5.5

Tools do not make a system an agent by themselves. An agent combines tools with messages, memory, a controller, and artifacts; the controller converts model predictions into an intentional workflow. Shared schemas make those components interoperable and support inspection after execution. section 2.3.1 section 2.5.8

How AI Agents for Offensive Security covers it

How deep it goes
Defines a Python tool contract and demonstrates two chained implementations, deferring frameworks, memory, and advanced orchestration.
Examples
Demonstrates URL extraction and URL summarization through two Tool subclasses linked by an artifact.
What it assumes
Teaches the minimal tool interface from zero while using Python classes, dictionaries, and regular expressions in examples.
What you can do after
Build it from scratch via a named Python Tool interface with structured inputs, outputs, and artifact logging.
How it connects
Connects tools with AI agents, LLMs, agent controllers, memory, messages, observations, and artifacts.

Also explained in

Compare how 17 books explain tool →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents for Offensive Security. The section links point to the parts of the book it draws on.