Skip to content

Commit

Permalink
init commit
Browse files Browse the repository at this point in the history
  • Loading branch information
lalalune committed Feb 13, 2024
0 parents commit d14850d
Show file tree
Hide file tree
Showing 62 changed files with 17,482 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
**/node_modules/*
**/coverage/*
**/dist/*
**/types/*
25 changes: 25 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"env": {
"node": true,
"browser": true,
"es2021": true
},
"extends": [
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint",
"prettier"
],
"rules": {
"prettier/prettier": "error"
}
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.dev.vars
.wrangler
node_modules
.env
concatenated-output.ts
embedding-cache.json
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"tabWidth": 2,
"useTabs": false
}
73 changes: 73 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# bgent <a href="https://discord.gg/qetWd7J9De"><img style="float: right" src="https://dcbadge.vercel.app/api/server/qetWd7J9De" alt=""></a>

Flexible, scalable and customizable agents to do your bidding.

<img src="resources/image.jpg">

[![License](https://img.shields.io/badge/License-MIT-blue)](https://github.com/lalalune/bgent/blob/main/LICENSE)
[![stars - bgent](https://img.shields.io/github/stars/lalalune/bgent?style=social)](https://github.com/lalalune/bgent)
[![forks - bgent](https://img.shields.io/github/forks/lalalune/bgent?style=social)](https://github.com/lalalune/bgent)

## Features

- Simple and extensible
- Customizable to your use case
- Retrievable memory and document store
- Serverless artchitecture, deployable in minutes at scale with Cloudflare and Supabase
- Multi-agent and room support
- Reflection and summarization
- Goal-directed behavior

## Installation

```bash
npm install bgent
```

## Try the agent

```
npm run dev
```

## Database setup

This library uses Supabase as a database. You can set up a free account at [supabase.io](https://supabase.io) and create a new project.

### TODO: Add script and instructions for deploying fresh copy of database

### TODO: Local supabase deployment instructions

## Usage

```javascript
const runtime = new BgentRuntime({
serverUrl: "https://api.openai.com/v1",
token: process.env.OPENAI_API_KEY,
supabase: createClient(
process.env.SUPABASE_URL,
process.env.SUPABASE_ANON_KEY,
),
});
```

## Examples

There are two examples which are set up for cloudflare in `src/agents`

- The `simple` example is a simple agent that can be deployed to cloudflare workers
- The `cj` example is a more complex agent that has the ability to introduce users to each other

### Custom actions

Actions come in two flavors -- generic `actions` which run at any time they are considered valid, and `evaluators` which run when a condition is met at the end of a conversation turn.

You can pass your own custom actions and evaluators into the BgentRuntime instance. Check out the `src/agents/cj` example for a simple example of how to do this.

### Deployment

Deploying to cloudflare is easy. `npm run deploy` will walk you through a deployment with wrangler, Cloudflare's deployment tool.

# Contributions Welcome

If you like this library and want to contribute in any way, please feel free to submit a PR and I will review it. Please note that the goal here is simplicity and accesibility, using common language and few dependencies.
12 changes: 12 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/** @type {import('ts-jest').JestConfigWithTsJest} */
export default {
preset: 'ts-jest',
testEnvironment: 'node',
rootDir: './src',
testMatch: ['**/*.test.ts'],
globals: {
__DEV__: true,
__TEST__: true,
__VERSION__: '0.0.1'
}
}
Loading

0 comments on commit d14850d

Please sign in to comment.