Skip to content
Erik Peterson edited this page Jul 2, 2023 · 6 revisions

AutoPack

AutoPack is a repository of tools for AI Agents, currently tailored for LangChain implementations. It serves as an index of tools called Packs, which are references to LangChain tools hosted on GitHub. Contributing new tools is one of the best ways to support the AutoPack community.

The autopack-tools Python package is a library and CLI designed for interacting with the AutoPack repository.

Capabilities

CLI: autopack

  • Search for Packs: autopack search {query}
  • Install Packs: autopack install {Pack ID}

Python library: autopack

In the autopack Python library, a Pack represents an object containing metadata about a tool (e.g., dependencies, arguments) and serves as a wrapper around a LangChain Tool class.

  • Search for Packs: pack_search(query)
  • Get a Pack: get_pack(pack_id)
  • Get all installed Packs: get_all_installed_packs()
  • Install a Pack: install_pack(pack_id)
  • Select packs using an LLM: select_packs(task_description, llm)

Safety and Security Notice

Both the repository and this library are currently in their early stages and are intended for research purposes only. It is your responsibility to exercise caution and choose and utilize the tools responsibly until further safety and security measures are implemented.

The code referenced in the repository is directly cloned from GitHub. Before using it, exercise the same care you would with any third-party code on your computer or within your application. Since these tools are also employed in AI systems, taking proper precautions is crucial. AutoPack and its maintainers cannot be held responsible for misuse or negligence concerning the repository and library.

Important Note: When installing a Pack, you have the opportunity to review the downloaded code, which will be located in the .autopack directory of your project. You can modify this directory by setting the AUTOPACK_DIR environment variable. As there is no actual code in the AutoPack repository, which solely serves as an index of GitHub repositories, there is no guarantee of the safety and security of each Pack. It is your responsibility to review the Packs you install. Packs are not automatically updated unless re-installed, thus remaining "frozen" by default.

Usage

A comprehensive demonstration of AutoPack's capabilities can be found here. In under 100 lines of code, it enables an LLM to select its own tools from a repository containing over 100 tools and use them instantly. Please note that this demo repository is purely for demonstration purposes and is not intended for actual use.

Pack IDs

Each pack in the AutoPack repository is identified by a fully qualified path based on its GitHub repository. This format ensures uniqueness, prevents namespace collisions, and allows for easy identification of the source code location. Importantly, it enables us to uniquely refer to a pack by its ID while keeping pack names themselves intuitive and understandable for an LLM.

For example, the ID of a pack named web_search hosted in the GitHub repository erik-megarad/my_packs would be:

erik-megarad/my_packs/web_search

Fully Manual

For maximum control, you can manually search for Packs in the repository, install them, and handpick the desired tools for your agent.

As an example:

autopack install erik-megarad/my_tools/disk_usage

Please note that the CLI will prompt you before installing any dependencies required by the Pack.

To use the tool in your agent, retrieve and instantiate it, and pass it during the creation of your agent/agent executor.

llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-16k-0613")
pack = get_pack("erik-megarad/my_tools/disk_usage")
pack.init_tool()

agent_executor = initialize_agent(
    [pack],
    llm,
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
)

Semi-Automatic

If you prefer to manually install the Packs but load them in a more automated fashion, you can utilize the get_all_installed_packs function to retrieve all the Packs you have installed. You can then easily pass them through an LLM call to enable tool selection. You can see an example of this here.

Here is an example:

autopack install erik-megarad/my_tools/disk_usage
autopack install erik-megarad/my_tools/os_info
autopack install hwchase17/langchain/write_file
llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-16k-0613")
packs = get_all_installed_packs()
for pack in packs:
    # Note that some packs require args on init, e.g., for API keys. The repository outlines these args and their types.
    pack.init_tool()

agent_executor = initialize_agent(
    packs,
    llm,
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION
)

Using AI to select packs

The function select_packs will take all of the tools available in the AutoPack repository and ask an LLM to select the right tools for the task given. It will return a list of Pack IDs. As an example,

llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo-16k-0613")

pack_ids = select_packs(task_description, llm)
packs = try_get_packs(pack_ids)

for pack in packs:
    pack.init_tool()

agent_executor = initialize_agent(
    packs,
    llm,
    agent=AgentType.STRUCTURED_CHAT_ZERO_SHOT_REACT_DESCRIPTION,
    verbose=True,
)

agent_executor.run(task_description)

Going Beyond

There is a method available for automatically installing Packs. Use it with extreme caution. Employ install_pack(pack_id, force_dependencies) to install a Pack and optionally install its dependencies as well.

Contributing

We welcome contributions to the AutoPack ecosystem. Here are some ways you can help:

  • Create or update documentation: There is a ton of work that needs to be done to better document AutoPack. This is the best way to help the project at the moment.
  • Create new tools! Expand the AutoPack repository by developing and submitting your own tools. Share your ideas and solutions with the AutoPack community.
  • Submit GitHub repos: If you come across GitHub repositories containing useful tools, submit them to the AutoPack repository. We'll create Packs out of the tools in those repositories by providing the necessary metadata.
  • Try it out for yourself: Test AutoPack in your projects and provide feedback. Share your experiences, report bugs, and suggest improvements by opening issues on GitHub.
  • Contribute code: Help improve AutoPack by opening pull requests. You can choose to work on unresolved issues or implement new features that you believe would enhance the functionality of the library. Please note that the AutoPack library is intentionally designed to be compact and straightforward.

We appreciate your contributions and look forward to your involvement in making AutoPack a vibrant and valuable resource for the autonomous AI community.