Skip to main content

Making the development of autonomous human-like agents accessible to all

Project description

OpenAGI

Making the development of autonomous human-like agents accessible to all

Python Versions PyPI version Discord Twitter Medium Blog

OpenAGI aims to make human-like agents accessible to everyone, thereby paving the way towards open agents and, eventually, AGI for everyone. We strongly believe in the transformative power of AI and are confident that this initiative will significantly contribute to solving many real-life problems. Currently, OpenAGI is designed to offer developers a framework for creating autonomous human-like agents.

👉 Join our Discord community!

Installation

  1. Setup a virtual environment.
# For Mac and Linux users
python3 -m venv venv
source venv/bin/activate

# For Windows users
python -m venv venv
venv/scripts/activate
  1. Install the openagi
pip install openagi

or

git clone https://github.com/aiplanethub/openagi.git
pip install -e .

Example (Manual Agent Execution)

Workers are used to create a Multi-Agent architecture.

Follow this example to create a Trip Planner Agent that helps you plan the itinerary to SF.

from openagi.agent import Admin
from openagi.planner.task_decomposer import TaskPlanner
from openagi.actions.tools.ddg_search import DuckDuckGoSearch
from openagi.llms.openai import OpenAIModel
from openagi.worker import Worker

plan = TaskPlanner(human_intervene=False)
action = DuckDuckGoSearch

import os
os.environ['OPENAI_API_KEY'] = "sk-xxxx"
config = OpenAIModel.load_from_env_config()
llm = OpenAIModel(config=config)

trip_plan = Worker(
        role="Trip Planner",
        instructions="""
        User loves calm places, suggest the best itinerary accordingly.
        """,
        actions=[action],
        max_iterations=10)

admin = Admin(
    llm=llm,
    actions=[action],
    planner=plan,
)
admin.assign_workers([trip_plan])

res = admin.run(
    query="Give me total 3 Days Trip to San francisco Bay area",
    description="You are a knowledgeable local guide with extensive information about the city, it's attractions and customs",
)
print(res)

Example (Autonomous Multi-Agent Execution)

Lets build a Sports Agent now that can run autonomously without any Workers.

from openagi.planner.task_decomposer import TaskPlanner
from openagi.actions.tools.tavilyqasearch import TavilyWebSearchQA
from openagi.agent import Admin
from openagi.llms.gemini import GeminiModel

import os
os.environ['TAVILY_API_KEY'] = "<replace with Tavily key>"
os.environ['GOOGLE_API_KEY'] = "<replace with Gemini key>"
os.environ['Gemini_MODEL'] = "gemini-1.5-flash"
os.environ['Gemini_TEMP'] = "0.1"

gemini_config = GeminiModel.load_from_env_config()
llm = GeminiModel(config=gemini_config)

# define the planner
plan = TaskPlanner(autonomous=True,human_intervene=True)

admin = Admin(
    actions = [TavilyWebSearchQA],
    planner = plan,
    llm = llm,
)
res = admin.run(
    query="I need cricket updates from India vs Sri lanka 2024 ODI match in Sri Lanka",
    description=f"give me the results of India vs Sri Lanka ODI and respective Man of the Match",
)
print(res)

Long Term Memory like never before

With LTM, OpenAGI agents can now:

  • Recall past interactions to provide continuity in conversations.
  • Learn and adapt based on user inputs over time.
  • Deliver contextually relevant responses by referencing previous conversations.
  • Improve their accuracy and efficiency with each successive interaction.
import os
from openagi.agent import Admin
from openagi.llms.openai import OpenAIModel
from openagi.memory import Memory
from openagi.planner.task_decomposer import TaskPlanner
from openagi.worker import Worker
from openagi.actions.tools.ddg_search import DuckDuckGoSearch

memory = Memory(long_term=True)

os.environ['OPENAI_API_KEY'] = "-"
config = OpenAIModel.load_from_env_config()
llm = OpenAIModel(config=config)

web_searcher = Worker(
    role="Web Researcher",
    instructions="""
    You are tasked with conducting web searches using DuckDuckGo.
    Find the most relevant and accurate information based on the user's query.
    """,
    actions=[DuckDuckGoSearch], 
)

admin = Admin(
    actions=[DuckDuckGoSearch],
    planner=TaskPlanner(human_intervene=False),
    memory=memory,
    llm=llm,
)
admin.assign_workers([web_searcher])

query = input("Enter your search query: ")
description = f"Find accurate and relevant information for the query: {query}"

res = admin.run(query=query,description=description)
print(res)

Documentation

For more queries find documentation for OpenAGI at openagi.aiplanet.com

Use Cases:

  • Education: In education, agents can provide personalized learning experiences. They adapt and tailor learning content based on student's progress, performance and interests. It can extend to automating various other administrative tasks and assist teachers in improving their productivity.
  • Finance and Banking: Financial services can use agents for fraud detection, risk assessment, personalized banking advice, automating trading, and customer service. They help in analyzing large volumes of transactions to identify suspicious activities and offer tailored investment advice.
  • Healthcare: Agents can be deployed to monitor patients, provide personalized health recommendations, manage patient data, and automate administrative tasks. They can also assist in diagnosing diseases based on symptoms and medical history.

Get in Touch

For any queries/suggestions/support connect us at openagi@aiplanet.com

Contribution guidelines

OpenAGI thrives in the rapidly evolving landscape of open-source projects. We wholeheartedly welcome contributions in various capacities, be it through innovative features, enhanced infrastructure, or refined documentation.

For a comprehensive guide on the contribution process, please click here.

Support

📚 Documentation 💬 Discord Community 📝 Issue Tracker

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

openagi-0.3.0.tar.gz (58.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openagi-0.3.0-py3-none-any.whl (85.2 kB view details)

Uploaded Python 3

File details

Details for the file openagi-0.3.0.tar.gz.

File metadata

  • Download URL: openagi-0.3.0.tar.gz
  • Upload date:
  • Size: 58.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Darwin/23.6.0

File hashes

Hashes for openagi-0.3.0.tar.gz
Algorithm Hash digest
SHA256 380884f93f319365826930482fcef555f31b2d663232ccbc00c4b28ed6d2d5db
MD5 9f334c6260a8bee8ceff2369f20cdab7
BLAKE2b-256 8c79c14ec201617f3ae6c5a864cb3e882f86d1842b3caa3aedce47af1e16e3bb

See more details on using hashes here.

File details

Details for the file openagi-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: openagi-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 85.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.10.11 Darwin/23.6.0

File hashes

Hashes for openagi-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 96948a2a36dc4375a1e22265019ef04559e16956e9ac450db11c613ecf74d11b
MD5 8f8cf0a27a61b6d04b7f33ef52c24d4e
BLAKE2b-256 a6ae07cfbaa93db974d9ccc97040abd2cc980ba2baee1ca01ba20c19f2a8a8af

See more details on using hashes here.

Supported by

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