Skip to main content
Agency Swarm includes a set of built-in tools that provide common functionality for your agents. These tools are production-ready and can be used immediately without additional configuration.

Quick Overview

IPythonInterpreter

Execute Python code in an isolated environment with persistent state.

PersistentShellTool

Run shell commands in a persistent terminal session.

LoadFileAttachment

Load and process local images and PDF files.

Tool Details

IPythonInterpreter

Executes Python code in an isolated IPython environment with persistent state between calls.

Use Cases

Data Analysis Analyze and process datasets

Calculations Perform mathematical and statistical operations

Testing Test code snippets in a safe environment

Scripts Run Python scripts and automation

Usage Example

from agency_swarm import Agent
from agency_swarm.tools import IPythonInterpreter

data_analyst = Agent(
    name="Data Analyst",
    description="Analyzes data using Python",
    instructions="./instructions.md",
    tools=[IPythonInterpreter]
)
Similar to the Agents SDK LocalShellTool, but works with any model. Executes shell commands in a persistent terminal session, maintaining state across multiple commands.

Use Cases

CLI Commands Execute command-line operations

File Operations Navigate and manage file systems

Git Operations Version control and repository management

Build Operations Run build scripts and compile code

Usage Example

from agency_swarm import Agent
from agency_swarm.tools import PersistentShellTool

devops_agent = Agent(
    name="DevOps Agent",
    description="Manages deployment and infrastructure",
    instructions="./instructions.md",
    tools=[PersistentShellTool]
)
Loads local files and returns them in the appropriate format for the agent to view.
Only supports images and PDF files. For other file types, use the FileSearch and CodeInterpreter tools from the Agents SDK.

Use Cases

Image Processing Load and analyze image files

PDF Reading Extract and process PDF content

User Files Handle user-uploaded file attachments

File Analysis Inspect and analyze local files

Usage Example

from agency_swarm import Agent
from agency_swarm.tools import LoadFileAttachment

file_processor = Agent(
    name="File Processor",
    description="Processes and analyzes local files",
    instructions="./instructions.md",
    tools=[LoadFileAttachment]
)
The agent can use both absolute paths and paths relative to the current working directory. Make sure to instruct your agent accordingly on how to use this tool.

Next Steps