i-am-bee / bee-api

API backend for Bee
Apache License 2.0
22 stars 8 forks source link
agents ai api assistants-api bee-agent-framework fastify

Bee API

OpenAI-compatible Assistants API backed by Bee Agent Framework

Getting started

[!TIP]

🚀 The fastest way to setup Bee (UI + API) is through Bee Stack.

  1. Create .env (from .env.example) and fill in values.
  2. Run pnpm install to install dependencies.
  3. Start the server with pnpm start:dev

Technologies

Architecture overview

The Assistants API consists mostly of CRUDL endpoints for managing API resources like assistants, threads, runs and more. Furthermore, some resources are asynchronous in a sense that they contain status changing over time as the background execution progresses. Clients use polling or streaming to watch for status updates of such resources.

Infrastructure

The infrastructure consists of:

The REST API server stores resources in MongoDB database. Redis is used by BullMQ, rate limiter and as pub/sub broker for event streaming. Agent execution is performed by the Bee Agent Framework using various adapters for inference and embeddings.

Server

The codebase contains several types of modules:

These modules are connected in the following manner

module ---> dto
       ---> service ---> entity
                    ---> queue ---> entity

OpenAPI schema is auto-generated from the dtos and exposed on the /docs endpoint.

Dependencies

MongoDB

docker run -d -p 27017:27017 mongo:latest

Redis

 docker run -d -p 6379:6379 redis:latest