Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best way for multi-session / muti-user support? Advice needed #968

Open
KonstantinMastak opened this issue Jan 25, 2024 · 1 comment
Open
Labels
Enhancement New feature or request

Comments

@KonstantinMastak
Copy link

KonstantinMastak commented Jan 25, 2024

First of all thanks for a great project! I'm now looking for a way to give several users an access to the interpreter simultanoiusly, so I need "sessions" feature.

I saw PR "feat:Add support for containerized Code execution, and utilities ( upload / download fn ). #459" but the proposed solution seems to be very complex and overengineered. So I'm looking for other ways to accomplish this and want to share my thoughts and listen to community advices.

What I want to get:

  1. Several sessions can be run simultaniosly
  2. Sessions are more or less isolated, i.e. user of one session can't write such prompt that can affect files and flow of other sessions.
  3. Sessions persist so that we can return to dialogue in 1-2 weeks and continue it from the point we left it, and with files we uploaded/processed to the moment
  4. Not too much overhead fo each session in terms of memory and hard drive

What solutions are possible?

  1. We can make 1 session = 1 docker container, but it seems to be non-realistic solution because of huge memory and cpu overhead, also a lot of DevOps headache.

  2. We can have 1 docker where we run several instances of open-interpreter inside one container. But what about sessions and file storage? We can bind external volume with subfolders where 1 subfolder = 1 session, and we can name that folder like session GUID. But how to make Open Interpreter work with particular folder as its root and whatever user writes in his prompt there should be no way how Open Interpreter can come to the subfolder of other session with any file read/write operation from executed Python script?

  3. I'm thinking about using venv somehow to separate user sessions, but it seems to be overhead in storing the same set of Python libraries several times (for each session), also I don't know how fast is it to create new venv instances for each session. Still we have open problem with storing and separating uploads/processed files of each session.

How do you think what is the best solution?

@KonstantinMastak KonstantinMastak added the Enhancement New feature or request label Jan 25, 2024
@GitTom
Copy link

GitTom commented Jan 25, 2024

Perhaps multiple containers? It certainly would be the ideal solution for isolation.

When I decided to give OI a try I just assumed that a Docker container would be the best way, so I was a bit surprised at the uncertainty about this option in the docs. I'm not really sure what the concern is, and I think this method should be promoted for techie users since it is a safe way to use OI.

Regarding your concern about the resources requirements of using multiple containers, I would comment that I started from an Alpine image, and that image (with a bunch of stuff installed) is now 660 MB. I would imagine that, if size is a priority and some effort were made, it could be reduced a decent amount.

For the record, here is how I used it. I used a dev container, which is a slight variation on a docker container and it allowed me to use images with VSCode built-in. My devcontainer.json (like a docker file) looks like this ...

{
	"name": "Alpine",
	// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
	"image": "mcr.microsoft.com/devcontainers/base:alpine-3.19",

	// Features to add to the dev container. More info: https://containers.dev/features.
	// "features": {},

	"containerEnv": {
		"OPENAI_API_KEY": "...",
		"GCP_API_KEY": "..."
	}
}

Managing this from within VSCode works very well (you need the Dev Containers extension).

I think I had to install pip.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants