This is a WebSocket server that executes tasks using an agent.
Create a .env file with the contents
OPENAI_API_KEY=<YOUR OPENAI API KEY>
Install requirements:
python3.12 -m venv venv
source venv/bin/activate
python -m pip install -r requirements.txt
uvicorn opendevin.server.listen:app --reload --port 3000
You can use websocat to test the server: https://github.com/vi/websocat
websocat ws://127.0.0.1:3000/ws
{"action": "start", "args": {"task": "write a bash script that prints hello"}}
OPENAI_API_KEY=sk-... # Your OpenAI API Key
LLM_MODEL=gpt-4-0125-preview # Default model for the agent to use
WORKSPACE_DIR=/path/to/your/workspace # Default path to model's workspace
There are two types of messages that can be sent to, or received from, the server:
An action has three parts:
action: The action to be takenargs: The arguments for the actionmessage: A friendly message that can be put in the chat logThere are several kinds of actions. Their arguments are listed below. This list may grow over time.
initialize - initializes the agent. Only sent by client.
model - the name of the model to usedirectory - the path to the workspaceagent_cls - the class of the agent to usestart - starts a new development task. Only sent by the client.
task - the task to startread - reads the contents of a file.
path - the path of the file to readwrite - writes the contents to a file.
path - the path of the file to writecontents - the contents to write to the filerun - runs a command.
command - the command to runbackground - if true, run the command in the backgroundkill - kills a background command
id - the ID of the background command to killbrowse - opens a web page.
url - the URL to openrecall - searches long-term memory
query - the query to search forthink - Allows the agent to make a plan, set a goal, or record thoughts
thought - the thought to recordfinish - agent signals that the task is completedAn observation has four parts:
observation: The observation typecontent: A string representing the observed dataextras: additional structured datamessage: A friendly message that can be put in the chat logThere are several kinds of observations. Their extras are listed below. This list may grow over time.
read - the contents of a file
path - the path of the file readbrowse - the HTML contents of a url
url - the URL openedrun - the output of a command
command - the command runexit_code - the exit code of the commandrecall - the result of a search
query - the query searched forchat - a message from the user