L12275 / GeneralAgent

GeneralAgent,一个简单、通用、可定制的Agent框架。Agent Builder:使用自然语言创建代理并立即使用它们,无需编码。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GeneralAgent: From LLM to Agent

EN doc CN doc License

A simple, general, customizable Agent framework

Features

  • Simple、Fast、Stable: stable with GPT3.5.
  • GeneralAgent support serialization, include python state.
  • Build-in interpreters: Python, AppleScript, Shell, File, Plan, Retrieve Embedding etc.
  • Dynamic UI: Agent can create dynamic ui to user who can use.
  • Agent Builder: Create agents using natural language and use them immediately, without coding.
  • AthenaAgent is a TypeScript port of GeneralAgent.

Architecture

GeneralAgent

Architecture

WebUI

WebUI

Demo

Version 0.0.11

agent builder

agent created

Version 0.03

webui

Version 0.0.2

GeneralAgent.Demo.mp4

Usage

docker

# pull docker
docker pull cosmosshadow/general-agent

# make .env
# download .env.example and copy to .env, then configure environment variables in the .env file, such as OPENAI_API_KEY, etc.
wget https://github.com/CosmosShadow/GeneralAgent/blob/main/.env.example
cp .env.example .env
vim .env
# Configure environment variables in the .env file, such as OPENAI_API_KEY, etc.

# 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

Set environment variables

# download .env.example and copy to .env, then configure environment variables in the .env file, such as OPENAI_API_KEY, etc.
wget https://github.com/CosmosShadow/GeneralAgent/blob/main/.env.example
cp .env.example .env
vim .env

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

Command line tool

GeneralAgent
# or
GeneralAgent --workspace ./test --new --auto_run
# worksapce: Set workspace directory, default ./general_agent
# new: if workspace exists, create a new workspace, like ./general_agent_2023xxx
# auto_run: if auto_run, the agent will run the code automatically, default no

WebUI

git clone https://github.com/CosmosShadow/GeneralAgent
cd GeneralAgent
# Preparation
cd webui/web/ && npm install && cd ../../
cd webui/server/server/ts_builder && npm install && cd ../../../../
# Start the server
cd webui/server/server/
uvicorn app:app --host 0.0.0.0 --port 7777
# Start the web service
cd webui/web
npm run start

Python usage

Please refer to the code for usage

Development

Others

  • GeneralAgent uses litellm to access various platforms of large models.

  • If you access local LLM and Embedding, you can refer to the code: llm_inference.py, rewrite the following three methods:

from GeneralAgent import skills

def llm_inference(messages, model_type='normal', stream=False, json_schema=None):
     pass
skills.llm_inference = llm_inference

def embedding_single(text) -> [float]:
     pass
skills.embedding_single = embedding_single

def embedding_batch(texts) -> [[float]]:
     pass
skills.embedding_batch = embedding_batch

Join us

Scan the QR code below with WeChat

wechat

discord is comming soon.

About

GeneralAgent,一个简单、通用、可定制的Agent框架。Agent Builder:使用自然语言创建代理并立即使用它们,无需编码。

License:MIT License


Languages

Language:Python 76.8%Language:TypeScript 19.9%Language:JavaScript 1.6%Language:HTML 0.7%Language:Shell 0.6%Language:CSS 0.3%Language:Dockerfile 0.2%