overview.mdx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. ---
  2. title: "Overview"
  3. description: "Understanding Tools in Agentic Systems."
  4. icon: "globe"
  5. ---
  6. Tools are the most important component of any Agentic system. In this guide, we'll cover the basics: what tools are, key characteristics, and the three primary ways you can build or import your own tools.
  7. ## Key Principles of Building Effective Tools
  8. Here are the key principles for building effective tools:
  9. <CardGroup cols={3}>
  10. <Card
  11. title="Standalone"
  12. icon="cube"
  13. >
  14. Tools should run independently with minimal dependencies on other tools or agents. Any agent should be able to use any tool without extra re-prompting.
  15. </Card>
  16. <Card
  17. title="Configurable"
  18. icon="gear"
  19. >
  20. Tools should expose adjustable parameters. The agent should be able to tune modes, thresholds, timeouts, limits, etc to better fit the environment or the task at hand.
  21. </Card>
  22. <Card
  23. title="Composable"
  24. icon="hammer"
  25. >
  26. Outputs of one tool should match the inputs of another tool. They should allow the agent to compose them into workflows autonomously, instead of pre-defined sequences.
  27. </Card>
  28. </CardGroup>
  29. ## What are Tools?
  30. **At a high level, tools represent the capabilities that your agents have.**
  31. Tools enable your agents to perform specific tasks necessary to fulfill their designated roles. For instance, just as a real virtual assistant can search the web or send emails, the virtual assistant agent can be equipped with similar tools.
  32. Below are some more examples of tools:
  33. - **FileWriter:** A tool that allows an agent to write code or text to a file.
  34. - **CommandExecutor:** A tool that allows an agent to execute terminal commands.
  35. - **LeadUpdater:** A tool that allows an agent to update a lead in a CRM.
  36. - **LinkedInProfileScraper:** A tool that allows an agent to scrape a LinkedIn profile.
  37. - **FacebookAdCreator:** A tool that allows an agent to create a Facebook ad.
  38. <Tip>
  39. By themselves, each of these tools is not very useful, however in combination with each other, they allow agents to perform a much wider range of tasks.
  40. For example, `FileWriter` tool by itself can allow the developer agent to write code, however, in combination with the `CommandExecutor` tool, it can also run and test its own code, which instantly makes it more powerful. (We'll cover the key characteristics of tools in a bit.)
  41. </Tip>
  42. **At a low level, tools are essentially just code.**
  43. Whatever the tool you are creating, at the lowest level, it always comes down to code. The only difference is where this code is being executed. For instance, if you are making an API call, it will primarily be executed in the cloud, and if it's a file system tool, it will be executed on the same machine where the agent is running. **Even if you are using a no-code platform to build your tools, like n8n or zapier, at the lowest level, it all still comes down to code.**
  44. This means that agentic systems are much more similar to traditional software programs than you might think...
  45. <img className="block dark:hidden" src="/images/agents-vs-programs-light.png" alt="Tools Diagram" />
  46. <img className="hidden dark:block" src="/images/agents-vs-programs.png" alt="Tools Diagram" />
  47. Just as in a standard program, we have functions that are executed in a loop, in an agentic system, we have tools that are executed by your agents.
  48. And what this allows you to do, is tackle significantly more complex tasks. Tasks where there are so many possible paths that you can't hard code all of the possible conditional logic in advance.
  49. Now, that we understand what tools are, let's cover how you can build your own tools.
  50. ## Built-in Tools
  51. Agency Swarm ships with several ready-to-use tools:
  52. - **IPythonInterpreter** - Execute Python code in an isolated environment
  53. - **PersistentShellTool** - Run shell commands with persistent state
  54. - **LoadFileAttachment** - Load and process local files (images, PDFs)
  55. ```python
  56. from agency_swarm import IPythonInterpreter, PersistentShellTool, LoadFileAttachment
  57. ```
  58. [Learn more about built-in tools →](/core-framework/tools/built-in-tools)
  59. ## 3 Ways to Build Tools
  60. When it comes to building your own tools, you have 3 primary options:
  61. <CardGroup cols={3}>
  62. <Card
  63. title="Custom Tools"
  64. icon="hammer"
  65. href="./custom-tools"
  66. >
  67. Build your own completely custom tools from scratch. (Recommended)
  68. </Card>
  69. <Card
  70. title="OpenAPI Schemas"
  71. icon="file-code"
  72. href="./openapi-schemas"
  73. >
  74. Use public OpenAPI schemas and convert them into tools.
  75. </Card>
  76. <Card
  77. title="MCP Integration"
  78. icon="plug"
  79. href="./mcp-integration"
  80. >
  81. Connect to MCP servers for advanced capabilities.
  82. </Card>
  83. </CardGroup>
  84. **It is recommended to start with custom tools**, as they give you the most flexibility and control. Even if you are connecting to external APIs, we still recommend creating custom tools, as they allow you to have more control over the tool's outputs.
  85. Click on the card of your choice to learn more about each one.