Introduction

Welcome back to Putting Bedrock Models to Action with Strands Agents! Having successfully built your first intelligent agent in the previous lesson, you're now ready to unlock the true power of agentic AI: the ability to take real actions in the world through tools. This exciting progression transforms your agent from a conversational assistant into an action-capable system that can perform calculations, retrieve information, and interact with external systems.

In this second unit, we'll elevate your AWS Technical Assistant beyond simple conversation into a sophisticated system capable of mathematical computations and technical specification retrieval. You'll master two essential tool integration approaches: leveraging pre-built tools from the strands_tools library and creating custom tools tailored to your specific requirements. By the lesson's end, your agent will seamlessly coordinate multiple tools to solve complex problems, demonstrating the remarkable capabilities that emerge when AI reasoning meets real-world action.

This hands-on journey will show you how tools transform static conversations into dynamic problem-solving sessions, where agents can perform calculations, access data repositories, and provide comprehensive analyses that would be impossible through conversation alone.

Understanding Tools in Agent Systems

Tools represent the bridge between AI reasoning and real-world capabilities, transforming conversational agents into action-oriented systems that can perform concrete tasks beyond text generation. When an agent has access to tools, it gains the ability to execute functions, retrieve information, perform calculations, and interact with external systems based on the context of your conversation.

The tool integration process follows a simple decision-making pattern: as your agent processes your request, it autonomously determines whether external tools are needed to provide a complete response. If tools are required, the agent identifies the appropriate tools, calls them with relevant parameters, processes the results, and incorporates those results into its final response. This entire orchestration happens transparently within the agent loop, creating seamless user experiences where complex multi-step operations feel like natural conversations.

Tools in the Strands framework fall into two main categories: pre-built tools from the strands_tools library that provide common functionality like calculations and web search, and custom tools that you create using the @tool decorator to address your specific application requirements. Both types integrate seamlessly with your agents, allowing you to mix and match capabilities as needed for your particular use cases.

Introducing Pre-built Tools

The Strands ecosystem includes a comprehensive library of pre-built tools designed to handle common agent tasks, starting with mathematical calculations through the powerful calculator tool.

The calculator import from strands_tools provides your agent with sophisticated mathematical capabilities that go far beyond basic arithmetic. This tool can handle complex expressions, unit conversions, statistical calculations, and mathematical functions, making it invaluable for technical applications where precise numerical analysis is required.

The tool import from the core Strands library introduces the @tool decorator, which we'll use shortly to create our own custom tools that integrate seamlessly with the existing Strands tool ecosystem.

Creating Custom Tools with the @tool Decorator

The @tool decorator transforms ordinary Python functions into agent-compatible tools with automatic metadata extraction, parameter validation, and result formatting.

The decorator automatically parses your function's docstring to generate tool descriptions that help the agent understand when and how to use each tool. The type annotations (-> str) provide essential information for parameter validation and result processing, ensuring that tool calls remain robust and predictable.

The comprehensive docstring serves dual purposes: it provides clear documentation for human developers and supplies the agent with detailed information about the tool's purpose, usage, and expected outputs, enabling intelligent tool selection during the reasoning process.

Implementing AWS Resource Specifications

Before our custom tool can function, we need to define the underlying data structure that contains AWS technical specifications and service limits.

This data structure organizes AWS service information in a format that's both human-readable and agent-friendly. The JSON-compatible structure ensures that when our tool returns this information, the agent can easily parse and interpret the data for inclusion in its responses. Note that in a more general setting, you would likely be obtaining this data in a different manner (for example, via an API request), but the underlying logic is the same.

Enhancing Your Agent with Multi-Tool Capabilities

With both pre-built and custom tools defined, we can now create an enhanced agent capable of coordinating multiple tools to solve complex problems.

The tools parameter accepts a list containing both pre-built tools like calculator and custom tools like get_aws_resource_specs, creating a unified toolkit that your agent can access during conversations. This integration approach allows agents to seamlessly coordinate between different tool types, using mathematical calculations alongside domain-specific data retrieval as needed.

The agent automatically gains awareness of all available tools and their capabilities, enabling intelligent tool selection based on the context and requirements of each user query.

Testing Multi-Tool Interactions

Now let's witness the remarkable coordination capabilities of our enhanced agent by presenting it with a query that requires both mathematical calculation and AWS specification lookup.

This query presents a perfect example of multi-tool coordination: the agent must perform unit conversion (calculator tool) and retrieve AWS service limitations (get_aws_resource_specs tool) to provide a comprehensive response.

Understanding the Agent's Tool Coordination

The response demonstrates the multi-tool orchestration, where the agent autonomously identifies the need for both mathematical conversion and AWS specification lookup, executes both tools in logical sequence, and synthesizes the results into a comprehensive analysis:

The agent's transparency in displaying "Tool #1: calculator" and "Tool #2: get_aws_resource_specs" provides valuable insight into its decision-making process, showing exactly which tools were invoked and in what order. This transparency helps developers understand agent behavior and builds user trust in the system's capabilities.

Most impressively, the agent didn't simply return raw tool outputs but instead integrated the results into a structured analysis complete with cost implications, practical recommendations, and follow-up questions, demonstrating how tools enable agents to provide actionable business intelligence rather than mere data retrieval.

Conclusion and Next Steps

You've successfully transformed your conversational agent into an action-capable system that can perform real-world tasks through intelligent tool coordination. The combination of pre-built tools like calculator and custom tools created with the @tool decorator demonstrates the remarkable flexibility and power available within the Strands framework. Your agent can now seamlessly transition between mathematical calculations and domain-specific data retrieval, providing comprehensive analyses that would be impossible through conversation alone.

This foundation in tool integration opens endless possibilities for creating specialized agents that can interact with APIs, databases, cloud services, and any other systems accessible through Python functions. The upcoming practice exercises will challenge you to expand your tool toolkit, experiment with different coordination patterns, and discover the full potential of action-oriented AI systems.

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal