Skip to main content

A library for pairing LLM agents with tools so they perform open ended tasks

Project description

Archytas: A Tools Interface for AI Agents

Implementation of the ReAct (Reason & Action) framework for Large Language Model (LLM) agents. Mainly targeting OpenAI's GPT-4.

Easily create tools from simple python functions or classes with the @tool decorator. A tools list can then be passed to the ReActAgent which will automagially generate a prompt for the LLM containing usage instructions for each tool, as well as manage the ReAct decision loop while the LLM performs its task.

Tools can be anything from internet searches to custom interpreters for your domain. Archytas provides a few built-in demo tools e.g. datetime, fibonacci numbers, and a simple calculator.

Quicksart

# make sure poetry is installed
pip install poetry

# clone and install
git clone git@github.com:jataware/archytas.git
cd archytas
poetry install

# make sure OPENAI_API_KEY var is set
# or set openai_key in .openai.toml
export OPENAI_API_KEY="sk-..."

# run demo
poetry run chat-repl

Simple Usage

Import pre-made tools from the tools module

from archytas.react import ReActAgent, FailedTaskError
from archytas.tools import datetime_tool, fib_n, calculator

from easyrepl import REPL

# create the agent with the tools list
some_tools = [datetime_tool, fib_n, calculator]
agent = ReActAgent(tools=some_tools+[mytool], verbose=True)

# REPL to interact with agent
for query in REPL()
    try:
        answer = agent.react(query)
        print(answer)
    except FailedTaskError as e:
        print(f"Error: {e}")

Built-in Tools

(TODO)

  • ask_user
  • datetime
  • timestamp
  • fib_n
  • calculator
  • ...

Custom Tools

(TODO)

from archytas.tools import tool

@tool()
def example_tool(arg1:int, arg2:str='', arg3:dict=None) -> int:
    """
    Simple 1 sentence description of the tool

    More detailed description of the tool. This can be multiple lines.
    Explain more what the tool does, and what it is used for.

    Args:
        arg1 (int): Description of the first argument.
        arg2 (str): Description of the second argument. Defaults to ''.
        arg3 (dict): Description of the third argument. Defaults to {}.

    Returns:
        int: Description of the return value

    Examples:
        >>> example_tool(1, 'hello', {'a': 1, 'b': 2})
        3
        >>> example_tool(2, 'world', {'a': 1, 'b': 2})
        4
    """
    return 42

# TODO: class tool example

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

archytas-0.2.2.tar.gz (25.0 kB view details)

Uploaded Source

Built Distribution

archytas-0.2.2-py3-none-any.whl (27.4 kB view details)

Uploaded Python 3

File details

Details for the file archytas-0.2.2.tar.gz.

File metadata

  • Download URL: archytas-0.2.2.tar.gz
  • Upload date:
  • Size: 25.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.11 Linux/5.15.0-1035-azure

File hashes

Hashes for archytas-0.2.2.tar.gz
Algorithm Hash digest
SHA256 9b324c05a983a7ec623ef1ec686a036316a25aa05aa9c87074889a69a8a37c32
MD5 997c1ada751cdb06d70885c462651fb3
BLAKE2b-256 3c75f2309f05228f8a67533564c7233497a92a41810f8dabec58abc84c17cb27

See more details on using hashes here.

File details

Details for the file archytas-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: archytas-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 27.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.10.11 Linux/5.15.0-1035-azure

File hashes

Hashes for archytas-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 491fcffaae13c04bac1cd438d32b3fd3f98f6a43f4b2bb6d96b37fbcc422ce0a
MD5 e1cbb40cbf6c74b5bd72e6d9479d1a1c
BLAKE2b-256 ea175b8df98681b8fe2c0db0cac8c764d5017e43a49509ebfb3be4366421fd2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page