• Stars
    star
    404
  • Rank 106,897 (Top 3 %)
  • Language
    Python
  • Created about 1 year ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A python native agent framework

GeneralAgent: From LLM to Agent

GeneralAgent can control itself and use stack memory, to finish complex tasks automatically.

Self-Call

DEMO

Stack Memory

DEMO

Features

  • GeneralAgent support serialization, include python state.
  • Build-in interpreters: Python, AppleScript, Shell, File, Plan, Retrieve Embedding etc.
  • Agent Builder: Create agents using natural language and use them immediately, without coding.
  • Self-Control & Stack Memory: GeneralAgent can control itself and has a stack memory. More detail in paper
  • Function Search and Use: search from thousands of functions and use them.
  • AthenaAgent is a TypeScript port of GeneralAgent.

DEMO

DEMO

Usage

Set Enviroment

wget https://github.com/CosmosShadow/GeneralAgent/blob/main/.env.example
cp .env.example .env
vim .env
# Then configure environment variables in the .env file.
# OPENAI_API_KEY is necessary.
# SERPER_API_KEY is necessary for google search.

docker

# pull docker
docker pull cosmosshadow/general-agent

# run
docker run \
-p 3000:3000 \
-p 7777:7777 \
-v `pwd`/.env:/workspace/.env \
-v `pwd`/data:/workspace/data \
--name=agent \
--privileged=true \
-d cosmosshadow/general-agent

# open web with localhost:3000

Local installation and usage

Installation

pip install GeneralAgent

WebUI

# export Enviroment Variable in .env
export $(grep -v '^#' .env | sed 's/^export //g' | xargs)

git clone https://github.com/CosmosShadow/GeneralAgent
cd GeneralAgent

# Web npm install
cd webui/web/ && npm install && cd ../../
cd webui/server/server/ts_builder && npm install && cd ../../../../

# Start Server
cd webui/server/server/
uvicorn app:app --host 0.0.0.0 --port 7777

# Start Web
cd webui/web
npm run start

Python usage

Basic Use

A Music Generation Agent

from GeneralAgent.agent import Agent
from GeneralAgent import skills
role_prompt = """You are a music creator."""
functions = [skills.generate_music]
agent = Agent.with_functions(functions, role_prompt)
result = agent.run("Soft piano sound")
print(result)

# The execution of the python code is completed, and the result is as follows:
# ff4bc8c264cf.wav
# The music has been generated. You can download the audio file from the following link:
# [Download the music](./ff4bc8c264cf.wav)

More Examples

Development

License

The intended purpose and licensing of GeneralAgent is solely for research use.

The source code is licensed under Apache 2.0.

Paper

General Agent: Self-Call and Stack Memory

Join us

Scan the QR code below with WeChat

wechat