Skip to main content

ArcheAI is a lightweight Python framework that simplifies AI agent development. Build smarter, more capable agents with ease using ArcheAI's easy tool integration, LLM interaction, and agent orchestration.

Project description

GITHUB

Welcome to ArcheAI! 🚀

Building AI agents should feel like assembling a dream team, not wrestling with complex code. That's where ArcheAI comes in. ✨

ArcheAI is a lightweight Python framework designed to make AI agent development intuitive, flexible, and downright fun! 🎉

You might be thinking: "Another AI agent framework? What makes ArcheAI different?" 🤔

Why ArcheAI? 💡

Let's face it, building sophisticated AI agents can feel overwhelming. ArcheAI is different because it's built on these core principles:

  • Simplicity First: 🧘 ArcheAI strips away unnecessary complexity, giving you a clean and elegant API that gets straight to the point. Focus on what matters -- building awesome agents!
  • Unleash Your Creativity: 🎨 We believe in giving you the tools, not dictating the path. ArcheAI's modular design empowers you to experiment with different LLMs (like Gemini, Groq, Cohere, OpenAI, and Anthropic), craft custom tools, and define your agent's unique personality.
  • Power in Collaboration: 🤝 Great things happen when minds work together! ArcheAI's TaskForce feature makes it a breeze to orchestrate multiple agents, allowing them to collaborate seamlessly on complex tasks.
  • Built for Exploration: 🔭 The world of AI is constantly evolving. ArcheAI embraces this by providing a flexible foundation that's ready to adapt to new LLMs, tools, and possibilities. The only limit is your imagination!

Installation ⚙️

Get started with ArcheAI in just a few steps:

pip install archeai 

Core Concepts 📚

The Agent Class 👤

The Agent class is the heart of ArcheAI. It represents an individual AI agent within your system.

Attributes

Attribute Description
llm An instance of the LLM (Large Language Model) class that the agent will use for language processing and decision-making.
tools A list of Tool objects that define the actions the agent can perform.
identity A string representing the agent's name or identifier.
description A brief description of the agent's role or purpose.
expected_output A string describing the expected format or style of the agent's responses.
objective The current task or goal that the agent is trying to achieve.
memory A boolean value indicating whether the agent should use memory (to retain context from previous interactions). Defaults to True.
ask_user A boolean value indicating whether the agent should ask the user for input when generating responses. Defaults to True.
memory_dir The directory where the agent's memory files will be stored. Defaults to memories.
max_chat_responses The maximum number of previous conversation turns to store in memory. Defaults to 12.
max_summary_entries The maximum number of summary entries to store in memory. Defaults to 3.
max_iterations The maximum number of iterations the agent will attempt to generate a valid response. Defaults to 3.
check_response_validity A boolean value indicating whether the agent should check the validity of the response before it is returned. Defaults to False.
allow_full_delegation Whether the agent should allow full delegation switching to True would give all the previous responses from different agents. Switching to False would only allow the last response, Defaults to False
verbose A boolean value indicating whether the agent should print verbose output during execution. Defaults to False.

Methods

  • add_tool(tool) Adds a Tool object to the agent's tools list.
  • remove_tool(tool_name) Removes a tool from the agent's tools list by its name.
  • rollout() Executes the agent's main workflow, including processing the objective, using tools, and generating a response.

The Tool Class 🧰

The Tool class represents an action or capability that an agent can perform. Tools can be simple functions, complex operations, or even integrations with external services.

ArcheAI's Tool class is designed to make it incredibly easy to define and use tools within your agents. You don't need to write complex wrappers or adapters. Simply provide the core logic of your tool as a Python function, and ArcheAI will handle the rest!

Example:

from archeai import Tool

def get_weather(city: str):
    """Fetches the current weather for a given city.""" 
    # ... (Implementation to fetch weather data) ... 
    return weather_data 

weather_tool = Tool(func=get_weather, 
                   description="Gets the current weather for a specified city.",
                    params={'city': {'description': 'The city for the weather to find.', 'type': 'str', 'default': 'unknown'}})

In this example, we define a simple tool called weather_tool. The tool uses the get_weather function to fetch weather data for a given city. The description parameter provides a concise explanation of what the tool does, which is helpful for both you and the agent to understand its purpose.

Attributes

Attribute Description
func The Python function that defines the tool's action.
name The name of the tool (automatically derived from the function name).
description A brief description of what the tool does. This is used by the agent to understand the tool's purpose.
returns_value A boolean indicating whether the tool returns a value that can be used by other tools or included in the response. Defaults to True.
instance Optional instance of a class if the tool is a bound method.
llm Optional LLM object for more advanced tool interactions (e.g., using the LLM to help determine tool parameters).
verbose A boolean indicating whether the tool should print verbose output during execution. Defaults to False.
params An Optional dictionary containing information about the tool's parameters (automatically extracted if not provided).

The TaskForce Class 👥

The TaskForce class lets you manage a group of Agent objects, enabling collaboration and complex workflow orchestration.

Attributes

Attribute Description
agents A list of Agent objects that belong to the task force.
objective A overall goal or task that the task force is trying to achieve.
mindmap A Overall Plan or Mind Map for the task force.

Methods

  • rollout() Starts the task force's execution. This method intelligently assigns the objective to the most suitable agent and manages the workflow.

Workflow

Basic Example: Building Your First Team 🧑‍🤝‍🧑

Let's bring it all together with a simple example:

from archeai import Agent, Tool, TaskForce
from archeai.llms import Gemini 

# Initialize your LLM
llm = Gemini()

# Define a greeting tool
def say_hello(name: str):
  return f"Hello there, {name}! 👋" 

def calculate(equation: str):
  return eval(equation)

hello_tool = Tool(func=say_hello, 
                   description="Greets the user by name.",
                    params={'name': {'description': 'The name to greet.', 'type': 'str', 'default': 'unknown'}})

calculate_tool = Tool(func=calculate, 
                   description="Evaluates an equation.",
                    params={'equation': {'description': 'The equation to evaluate.', 'type': 'str', 'default': 'unknown'}})

# Create an agent
greeter = Agent(llm=llm, 
                tools=[hello_tool], 
                identity="Friendly Greeter",
                memory=False,
                verbose=True)

math_magician = Agent(llm=llm, 
                tools=[calculate_tool], 
                identity="Math Magician",
                memory=False,
                verbose=True)

# Assemble your task force!
my_taskforce = TaskForce(agents=[greeter, math_magician], 
                         objective="Hi I am Mervin greet me, can you solve `3-4*2*5/4/2.1*6` for me and give a explanation.") 

# Start the interaction
response = my_taskforce.rollout() 

This basic example shows how to create a simple agent with a tool and then use a TaskForce to manage its execution.

Important Questions 🧐

What is MindMap?

A mind map is a visual representation of the task force's workflow. It is a visual representation of the task force's goals and how it is going to achieve them. It is automatically generated if not provided.

What does allow_full_delegation mean?

By default, allow_full_delegation is set to False. Setting it to True will allow the agent to delegate all the previous responses from different agents.

🤝 Contributing

Contributions are welcome! Please feel free to open an issue or submit a pull request.

📄 License

This project is licensed under the MIT License.

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

archeai-0.0.2.tar.gz (30.7 kB view details)

Uploaded Source

Built Distribution

archeai-0.0.2-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file archeai-0.0.2.tar.gz.

File metadata

  • Download URL: archeai-0.0.2.tar.gz
  • Upload date:
  • Size: 30.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for archeai-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e3af034b81745cb8b0c9fd38f979dd6d731f4f802e8aa27f3966f546cbd1540b
MD5 93ddfa0c60a935a771fe4ace59c34d5b
BLAKE2b-256 64f94064aa8d6991994f9c89fafc44d27ba89d8a6081ab95517f17384c0e3ecb

See more details on using hashes here.

File details

Details for the file archeai-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: archeai-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.10

File hashes

Hashes for archeai-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 85387507c9dde4cdabe99501e8aebdc8a8f9c8ef99bd386460029e2161ac1632
MD5 59a24c68d8f0cb5f308243489935675c
BLAKE2b-256 cddff1b492e6f6da03d381fb3a786a0ab4de2d98dad3251b2879ccbb953b5cb2

See more details on using hashes here.

Supported by

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