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

Refactor agent interface a bit #74

Merged
merged 11 commits into from
Mar 21, 2024
Merged

Refactor agent interface a bit #74

merged 11 commits into from
Mar 21, 2024

Conversation

rbren
Copy link
Collaborator

@rbren rbren commented Mar 20, 2024

Right now, the LangChain agent also includes all its own logic for running commands, browsing, reading/writing files, etc. That needs to get factored out so that all agents can use it.

From what I can tell from the recent refactor, we basically just instantiate an agent with a task, and call run(), then it continues until it finishes.

This refactors things so that we have a flow more like this:

  • server receives a task request
  • server instantiates an agent
  • server starts a control loop:
    • in each iteration, call agent.step()
    • agent.step() is allowed to send at most 1 LLM prompt
    • agent.step() returns an action, one of:
      • read file
      • write file
      • run cmd
      • browse
      • no-op
    • looper executes the action
      • and optionally passes messages on to e.g. the client browser

@neubig neubig requested review from xingyaoww and neubig March 21, 2024 00:43
Copy link
Contributor

@neubig neubig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great to me! I also looped in @xingyaoww in case he wants to take a look before we merge this in.

.gitignore Show resolved Hide resolved
@xingyaoww xingyaoww added architecture Related to architecture, including frontend and backend agent framework Strategies for prompting, agent, etc labels Mar 21, 2024
opendevin/lib/event.py Show resolved Hide resolved
opendevin/agent.py Show resolved Hide resolved
opendevin/controller.py Show resolved Hide resolved
@xingyaoww xingyaoww merged commit b84463f into All-Hands-AI:main Mar 21, 2024
xcodebuild pushed a commit to xcodebuild/OpenDevin that referenced this pull request Mar 31, 2024
* start moving files

* initial refactor

* factor out command management

* fix command runner

* add workspace to gitignore

* factor out command manager

* remove dupe add_event

* update docs

* fix init

* fix langchain agent after merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent framework Strategies for prompting, agent, etc architecture Related to architecture, including frontend and backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants