built-in-tools.mdx 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. ---
  2. title: "Built-in Tools"
  3. description: "Ready-to-use tools that ship with Agency Swarm framework."
  4. icon: "toolbox"
  5. ---
  6. 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.
  7. ## Quick Overview
  8. <CardGroup cols={3}>
  9. <Card
  10. title="IPythonInterpreter"
  11. icon="code"
  12. >
  13. Execute Python code in an isolated environment with persistent state.
  14. </Card>
  15. <Card
  16. title="PersistentShellTool"
  17. icon="terminal"
  18. >
  19. Run shell commands in a persistent terminal session.
  20. </Card>
  21. <Card
  22. title="LoadFileAttachment"
  23. icon="file"
  24. >
  25. Load and process local images and PDF files.
  26. </Card>
  27. </CardGroup>
  28. ## Tool Details
  29. <Accordion title="IPythonInterpreter" icon="code" defaultOpen>
  30. Executes Python code in an isolated IPython environment with persistent state between calls.
  31. ### Use Cases
  32. <CardGroup cols={2}>
  33. <Card icon="chart-line">
  34. **Data Analysis**
  35. Analyze and process datasets
  36. </Card>
  37. <Card icon="calculator">
  38. **Calculations**
  39. Perform mathematical and statistical operations
  40. </Card>
  41. <Card icon="flask">
  42. **Testing**
  43. Test code snippets in a safe environment
  44. </Card>
  45. <Card icon="file-code">
  46. **Scripts**
  47. Run Python scripts and automation
  48. </Card>
  49. </CardGroup>
  50. ### Usage Example
  51. ```python
  52. from agency_swarm import Agent
  53. from agency_swarm.tools import IPythonInterpreter
  54. data_analyst = Agent(
  55. name="Data Analyst",
  56. description="Analyzes data using Python",
  57. instructions="./instructions.md",
  58. tools=[IPythonInterpreter]
  59. )
  60. ```
  61. </Accordion>
  62. <Accordion title="PersistentShellTool" icon="terminal">
  63. Similar to the Agents SDK `LocalShellTool`, but works with any model. Executes shell commands in a persistent terminal session, maintaining state across multiple commands.
  64. ### Use Cases
  65. <CardGroup cols={2}>
  66. <Card icon="terminal">
  67. **CLI Commands**
  68. Execute command-line operations
  69. </Card>
  70. <Card icon="folder-tree">
  71. **File Operations**
  72. Navigate and manage file systems
  73. </Card>
  74. <Card icon="github">
  75. **Git Operations**
  76. Version control and repository management
  77. </Card>
  78. <Card icon="hammer">
  79. **Build Operations**
  80. Run build scripts and compile code
  81. </Card>
  82. </CardGroup>
  83. ### Usage Example
  84. ```python
  85. from agency_swarm import Agent
  86. from agency_swarm.tools import PersistentShellTool
  87. devops_agent = Agent(
  88. name="DevOps Agent",
  89. description="Manages deployment and infrastructure",
  90. instructions="./instructions.md",
  91. tools=[PersistentShellTool]
  92. )
  93. ```
  94. </Accordion>
  95. <Accordion title="LoadFileAttachment" icon="file">
  96. Loads local files and returns them in the appropriate format for the agent to view.
  97. <Warning>
  98. Only supports images and PDF files. For other file types, use the `FileSearch` and `CodeInterpreter` tools from the Agents SDK.
  99. </Warning>
  100. ### Use Cases
  101. <CardGroup cols={2}>
  102. <Card icon="image">
  103. **Image Processing**
  104. Load and analyze image files
  105. </Card>
  106. <Card icon="file-pdf">
  107. **PDF Reading**
  108. Extract and process PDF content
  109. </Card>
  110. <Card icon="upload">
  111. **User Files**
  112. Handle user-uploaded file attachments
  113. </Card>
  114. <Card icon="magnifying-glass">
  115. **File Analysis**
  116. Inspect and analyze local files
  117. </Card>
  118. </CardGroup>
  119. ### Usage Example
  120. ```python
  121. from agency_swarm import Agent
  122. from agency_swarm.tools import LoadFileAttachment
  123. file_processor = Agent(
  124. name="File Processor",
  125. description="Processes and analyzes local files",
  126. instructions="./instructions.md",
  127. tools=[LoadFileAttachment]
  128. )
  129. ```
  130. <Note>
  131. 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.
  132. </Note>
  133. </Accordion>
  134. ---
  135. ## Next Steps
  136. <CardGroup cols={3}>
  137. <Card
  138. title="Custom Tools"
  139. icon="hammer"
  140. href="/core-framework/tools/custom-tools/step-by-step-guide"
  141. >
  142. Build your own tools from scratch
  143. </Card>
  144. <Card
  145. title="OpenAPI Schemas"
  146. icon="file-code"
  147. href="/core-framework/tools/openapi-schemas"
  148. >
  149. Convert APIs into tools
  150. </Card>
  151. <Card
  152. title="MCP Integration"
  153. icon="plug"
  154. href="/core-framework/tools/mcp-integration"
  155. >
  156. Use Model Context Protocol tools
  157. </Card>
  158. </CardGroup>