Skip to content

ai-graphic/superagent

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Superagent

The Open Source AI Assistant Framework & API

GitHub Contributors GitHub Last Commit GitHub Issues GitHub Pull Requests GitHub License Discord


DemoUse casesFeaturesDocsDiscordTutorialsSDKsContributions


Superagent allows any developer to add powerful AI assistants to their applications. These assistants use large language models (LLM), retrieval augmented generation (RAG), and generative AI to help users.

Fully open-source. Backed by Y Combinator. Part of YC W24.


🎥 Demo

sdxl-4k.mp4

✨ Use cases

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 agent.

👀 Features:

  • Memory
  • Streaming
  • Python and Typescript SDKs
  • REST API
  • API connectivity
  • Vectorization
  • Support for third-party vector stores (e.g Weaviate, Pinecone)
  • Support for proprietary and open-source LLMs
  • API concurrency support

🛠️ Run locally:

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:

  1. Run the migrations (checkout Superagent UI section for this)

    supabase migration up (locally)
    supabase db push (cloud)
  2. 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();
  3. Create a Supabase storage

  4. Set storage permissions: Set the following policy for storage.objects Screenshot 2023-09-14 at 23 27 35

Setting up Github OAuth in UI
  1. Create a new Github OAuth app in your Github account

  2. Copy the CLIENT_ID and CLIENT_SECRET and paste them into the .env variables in the Superagent UI project.

  3. Set the following callback URL

    <YOUR_SUPABASE_URL>/auth/v1/callback
  4. Navigate to your Supabase project you have created for Superagent UI and paste the CLIENT_ID and CLIENT_SECRET

Screenshot 2023-09-15 at 09 08 52

NOTE: You can enable any provider using the steps above.

Superagent API
  1. Navigate to /libs/superagent

  2. Rename the env.example to .env and make sure you have all mandatory values set

  3. Create a virtual environment

    virtualenv venv
    source venv/bin/activate
  4. Install dependencies

    poetry install
  5. Run database migrations

    poetry run prisma migrate dev
  6. Start the server

    uvicorn app.main:app --reload
Superagent UI
  1. Navigate to /libs/ui

  2. Rename the env.example to .env and make sure you have all mandatory values set

  3. Install the dependencies:

    npm install
  4. Run migrations:

    supabase migrate up (local)
    supabase db push (cloud)
  5. Run the development server

    npm run dev
    

📋 Documentation:

For full documentation, examples and setup guidelines, visit docs.superagent.sh

🔗 SDKs

If you are planning to integrate Superagent into your stack, you can use one of the following SDKs:

🫶 Contributions:

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.

To see how to contribute, visit Contribution guidelines

To help with contributions, you can search, navigate, and understand Superagent's source code using Onboard AI's free tool LearnThisRepo. learnthisrepo.com/superagent

About

🥷 The open framework for building AI Assistants

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 42.5%
  • Python 37.9%
  • MDX 15.8%
  • PLpgSQL 1.5%
  • JavaScript 1.0%
  • Shell 0.6%
  • Other 0.7%