mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 13:52:43 +08:00
* basic microagent structure * start on jinja * add instructions parser * add action instructions * add history instructions * fix a few issues * fix a few issues * fix issues * fix agent encoding * fix up anon class * prompt to fix errors * less debug info when errors happen * add another traceback * add output to finish * fix math prompt * fix pg prompt * fix up json prompt * fix math prompt * fix math prompt * fix repo prompt * fix up repo explorer * update lock * revert changes to agent_controller * refactor microagent registration a bit * create delegate action * delegation working * add finish action to manager * fix tests * rename microagents registry * rename fn * logspam * add metadata to manager agent * fix message * move repo_explorer * add delegator agent * rename agent_definition * fix up input-output plumbing * fix tests * Update agenthub/micro/math_agent/agent.yaml Co-authored-by: Boxuan Li <liboxuan@connect.hku.hk> * Update agenthub/delegator_agent/prompt.py Co-authored-by: Boxuan Li <liboxuan@connect.hku.hk> * Update agenthub/delegator_agent/prompt.py Co-authored-by: Boxuan Li <liboxuan@connect.hku.hk> * remove prompt.py * fix lint * Update agenthub/micro/postgres_agent/agent.yaml Co-authored-by: Boxuan Li <liboxuan@connect.hku.hk> * Update agenthub/micro/postgres_agent/agent.yaml Co-authored-by: Boxuan Li <liboxuan@connect.hku.hk> * fix error --------- Co-authored-by: Boxuan Li <liboxuan@connect.hku.hk> Co-authored-by: Engel Nyst <enyst@users.noreply.github.com>
OpenDevin Server
This is a WebSocket server that executes tasks using an agent.
Install
Follow the instructions in the base README.md to install dependencies and set up.
Start the Server
uvicorn opendevin.server.listen:app --reload --port 3000
Test the Server
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"}}
Supported Environment Variables
LLM_API_KEY=sk-... # Your OpenAI API Key
LLM_MODEL=gpt-3.5-turbo-1106 # Default model for the agent to use
WORKSPACE_BASE=/path/to/your/workspace # Default path to model's workspace
API Schema
There are two types of messages that can be sent to, or received from, the server:
- Actions
- Observations
Actions
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 log
There 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 use
start- starts a new development task. Only sent by the client.task- the task to start
read- reads the content of a file.path- the path of the file to read
write- writes the content to a file.path- the path of the file to writecontent- the content to write to the file
run- runs a command.command- the command to runbackground- if true, run the command in the background
kill- kills a background commandid- the ID of the background command to kill
browse- opens a web page.url- the URL to open
recall- searches long-term memoryquery- the query to search for
think- Allows the agent to make a plan, set a goal, or record thoughtsthought- the thought to record
finish- agent signals that the task is completed
Observations
An 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 log
There are several kinds of observations. Their extras are listed below. This list may grow over time.
read- the content of a filepath- the path of the file read
browse- the HTML content of a urlurl- the URL opened
run- the output of a commandcommand- the command runexit_code- the exit code of the command
recall- the result of a searchquery- the query searched for
chat- a message from the user