Superagent is an open-source agent framework that enables any developer to integrate production-ready AI Assistants into any application in a matter of minutes.
demo.mp4
We post tutorials regularly on our YouTube channel. Make sure to check them out !
Superagent lets you build any AI application/microservice you want, including:
- Question/Answering over Documents (LLM Finetunes/Vectorstores).
- Chatbots.
- Co-pilots & AI assistants.
- Content generation.
- Data aggregation.
- Workflow automation.
- Memory
- Streaming
- Custom finetuning π
- Python/Typescript SDKs
- REST API
- API connectivity
- Vectorization
- Support for proprietary and OSS LLMs
- API concurrency support
For full documentation, visit docs.superagent.sh
To see how to contribute, visit Contribution guidelines
-
Create a Replit REPL by importing the Superagent Github Repository. Link
-
Set the REPL language to
Python
-
Replace the contents of the
.replit
file in your REPL with the followingrun = "chmod 777 ./libs/superagent/replit.sh && cd ./libs/superagent && ./replit.sh" modules = ["python-3.10:v18-20230807-322e88b", "nodejs-18:v3-20230608-f4cd419"] hidden = [".pythonlibs"] [nix] channel = "stable-23_05" [deployment] run = ["sh", "-c", "chmod 777 ./libs/superagent/replit.sh && cd ./libs/superagent && ./replit.sh"] deploymentTarget = "cloudrun"
-
Add all necessary
.env
variables as ReplitSecrets
. Also, add the following additional secret:TZ = Etc/UTC
-
Deploy the REPL using Replit
Autoscale
.
Clone the Superagent repository into a public GitHub repository or Fork it from https://github.com/homanp/superagent/fork.
If you plan to distribute the code, keep the source code public.
Both the API and UI require a database in order to work. We recommend setting this up on Supabase.
Setting up Supabase
Create a Supabase account and project.
We have separated the UI and API into two separate Supabase projects, which is recommended since the app runs on prisma
.
Supabase setup for Superagent UI project:
-
Run the migrations (checkout Superagent UI section for this)
supabase migration up (locally) supabase db push (cloud)
-
Run the following query to setup authentication:
-- inserts a row into public.profiles create function public.handle_new_user() returns trigger language plpgsql security definer set search_path = public as $$ begin insert into public.profiles (user_id) values (new.id); return new; end; $$; -- trigger the function every time a user is created, create trigger on_auth_user_created after insert on auth.users for each row execute procedure public.handle_new_user();
-
Create a Supabase storage
-
Set storage permissions: Set the following policy for
storage.objects
Setting up Github OAuth in UI
-
Create a new Github OAuth app in your Github account
-
Copy the
CLIENT_ID
andCLIENT_SECRET
Β and paste them into the.env
Β variables in the Superagent UI project. -
Set the following callback URL
<YOUR_SUPABASE_URL>/auth/v1/callback
-
Navigate to your Supabase project you have created for Superagent UI and paste the
CLIENT_ID
andCLIENT_SECRET
![Screenshot 2023-09-15 at 09 08 52](https://private-user-images.githubusercontent.com/2464556/268204427-abd1e2fb-df90-413a-b674-766343683f6c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQxNDk5MDgsIm5iZiI6MTcyNDE0OTYwOCwicGF0aCI6Ii8yNDY0NTU2LzI2ODIwNDQyNy1hYmQxZTJmYi1kZjkwLTQxM2EtYjY3NC03NjYzNDM2ODNmNmMucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDgyMCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA4MjBUMTAyNjQ4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTZjZTU3NWMyNWViNjBhZGZkYzVjZDczMzMzOTJlNDIwODNmMTVhNWJmOTk5ZWQ1NGFjNGJmNTgwNGU2ODY3NiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.r7Imn30P7QINb3mOLpPfeCwv1EyUPvrsTAIO8e5-xXk)
NOTE: You can enable any provider using the steps above.
Superagent API
-
Navigate to
/libs/superagent
-
Rename the
env.example
to.env
and make sure you have all mandatory values set -
Create a virtual environment
virtualenv venv source venv/bin/activate
-
Install dependencies
poetry install
-
Run database migrations
poetry run prisma migrate dev
-
Start the server
uvicorn app.main:app --reload
Superagent UI
-
Navigate to
/libs/ui
-
Rename the
env.example
to.env
and make sure you have all mandatory values set -
Install the dependencies:
npm install
-
Run migrations:
supabase migrate up (local) supabase db push (cloud)
-
Run the development server
npm run dev
Superagent legacy
Please refer to the README in /libs/legacy
for further instructions.
Run locally with docker and docker compose
In the .docker
folder, there are multiple docker-compose files.
The main docker-compose.yml
file will start the API and a Postgres-DB in docker.
The other docker-compose files can be used individually or in combination to start up the necessary bits.
follow the guide in .docker/README.md file to get started
If you are planning to integrate Superagent into your stack, you can use one of the following SDKs:
- Python
- Typescript/Javascript
- Swift (Community)
Superagent is an open-source project, and contributions are welcome. If you want to contribute, you can create new features, fix bugs, or improve the infrastructure. Please refer to the CONTRIBUTING.md file in the repository for more information on how to contribute.