- Notifications
You must be signed in to change notification settings - Fork16
i-am-bee/bee-api
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Warning
This repository has been archived and is no longer actively maintained or updated. It is provided here for historical reference and may contain outdated or unsupported code. Users are encouraged to fork or adapt the contents as needed, but please note that no further updates, bug fixes, or security patches will be applied by the original maintainers.
OpenAI-compatible Assistants API backed byBee Agent Framework
Tip
🚀 The fastest way to setup Bee (UI + API) is throughBee Stack.
- Create
.env
(from.env.example
) and fill in values. - Run
pnpm install
to install dependencies. - Start the server with
pnpm start:dev
- Fastify as the web framework
- MikroORM backed byMongoDB as the database layer
- BullMQ backed byRedis as the job executor
- Bee Agent Framework as the agent execution engine
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 containstatus
changing over time as the background execution progresses. Clients use polling or streaming to watch for status updates of such resources.
The infrastructure consists of:
- REST API server
- MongoDB
- Redis
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.
The codebase contains several types of modules:
*.modules.ts
containing endpoint handlers*.services.ts
containing services for the handlersdtos/*.ts
containing JSON schema definitions for resources*.entity.ts
containing ORM definitions for database entities*.queue.ts
containing BullMQ queues and workers for asynchronous execution
These modules are connected in the following manner
module ---> dto ---> service ---> entity ---> queue ---> entity
OpenAPI schema is auto-generated from thedtos
and exposed on the/docs
endpoint.
The easiest way to run all the dependencies for the bee-api is to:
- Clone the bee-stack repositoryhttps://github.com/i-am-bee/bee-stack
- Navigate to the bee-stack directory.
- Run the infrastructure:
./bee-stack.sh clean./bee-stack.sh start:infra
- Then navigate back to the bee-api repository.
- Install packages:
pnpm install
- When running for the first time seed the database:
pnpm mikro-orm seeder:run
- copy .env.example to .env
cp .env.example .env
Add values the env vars: CRYPTO_CIPHER_KEY, AI_BACKEND and API key for which ever provider you have chosen.
Run the bee-api:
pnpm start:dev
About
API backend for Bee