Semi-Autonomous Personal Intelligent Agent from Large language models
Sapial is a open framework for building personal agents that can be trained on your own data. It is built on top of Deno, Transforemrs, Langchain, and llama-index.
Why Deno?
Deno is a secure, user-friendly runtime for JavaScript, TypeScript, and WebAssembly, built on V8, Rust, and Tokio. It supports TypeScript natively, provides built-in development tools, and accommodates existing npm modules. Distributed as a single executable, Deno doubles as both a runtime and package manager, using browser-compatible protocols for loading modules. It's an ideal environment for modern programming and a great alternative for utility scripts previously written in Bash or Python.
Sapial is broadly divided into three parts:
- Python backend services, exposed over local FastAPI bridge
- Deno runtime (middleware), for running the agent
- Client Interfaces, that connect to the Deno runtime via local HTTP API
-
Install Deno
To check if you already have it installed, run
deno --version
If Deno is installed, you should see a message like
deno 1.x.x
wherex.x
represents a version of denoIf you get
command not found
proceed with installation according to your OSMacOS and Linux
Using Shell
curl -fsSL https://deno.land/x/install/install.sh | sh
or using Homebrew
brew install deno
-
To check if you already have it installed, run
python --version
If Python is installed, you should see a message like
python 2.x.x
wherex.x
represents a version of PythonIf you get
command not found
proceed with installation according to your OSWindows
Directly through python website
or, using Scoop
scoop install main/python
or, using Chocolatey
choco install python --pre
In case you didn't have Python installed, make sure to restart your computer before proceeding to the next steps!
Usually Pip is automatically installed with python
To check if you already have it installed, run
pip --version
If you get
command not found
proceed with installation according to your OSMacOS and Linux
Using cli
python -m ensurepip --upgrade
-
Setup a Python Virtual Environment
To setup the virtual environment, run this command in the terminal
pip install virtualenv
To use venv in your project, change directory into
services
by runningcd services
nd then run
python -m venv venv
This will create a vurtual environment inside
services
folder namedvenv
run
cd ..
in your terminal to get back to the root folder -
To install, run
pip install -r ./services/requirements.txt
in your terminal -
In the root of directory, create a new file named
.env
Open
.env
file using editor of your choice and add your OpenAI API keyYour
.env
file should look like thisOPENAI_API_KEY = "your_API_KEY"
To start an agent, run the following command in your terminal
deno run --allow-all --unstable ./agents/alice.ts
In a separate terminal, start the CLI client by running
cd /clients/cli
deno run --allow-all httpClient.ts
To check if everything is working properly, type any prompt in the latter terminal
Alternatively, you can start a web client to use a web interface
To start a web client, run yarn && yarn dev
By default, the server will spin up on port 3000
Proceed to localhost:3000
and send a message to start interacting with AI
We appreciate and highly encourage community contributions!
-
If you're not sure, here's how to fork the repo.
-
To clone your repo, you can run the command in the terminal of your choice
git clone git@github.com:[your_github_handle]/sapial.git && cd sapial
-
Create new branch and make changes
git checkout -b new_branch_name
Make changes where necessary and save them by running
git add --all git commit -m "Use a message that best describes changes"
Push the changes to your repo
git push
-
After your changes are committed to your GitHub fork, submit a pull request (PR) to the
main
branch of thesapial-ai/sapial
repo
Kill the fastAPI server on agent crash lsof -i :8000 -> kill -9
- add logging
- start implementing basic agent architectures
- add formatting to text
- add a retriever using llama-index
- tools and plugins
- share notes and repo with Andrew
- define personas
- define personal alignment stratgies
- Refactor http server to be a class
- Add authentication for agents and clients using LibP2P