Engel Nyst 84a814c447 Additions to agent docs (#3434) преди 1 година
..
controller 84a814c447 Additions to agent docs (#3434) преди 1 година
core 2b1e73365b Fix typing for fake user response function (#3438) преди 1 година
events 7d331acffa Handle error observations in codeact (#3383) преди 1 година
llm be2ea6ab35 logging fixes (#3393) преди 1 година
memory 1d49ef253b [Runtime] Reduce dependency to speed up CI and reduce image size (#3195) преди 1 година
runtime 944f934475 remove 1s sleep from _ensure_session (runtime) (#3439) преди 1 година
security f9f96dd429 Use generic types (#3414) преди 1 година
server 9cb0bf97c1 Fix restore cli sessions (#3409) преди 1 година
storage 275ea706cf Remove remaining global config (#3099) преди 1 година
README.md 5d920489fc docs: improve documentation (#3425) преди 1 година
__init__.py cd58194d2a docs(docs): start implementing docs website (#1372) преди 1 година

README.md

OpenDevin Architecture

This directory contains the core components of OpenDevin.

This diagram provides an overview of the roles of each component and how they communicate and collaborate. OpenDevin System Architecture Diagram (July 4, 2024)

Classes

The key classes in OpenDevin are:

  • LLM: brokers all interactions with large language models. Works with any underlying completion model, thanks to LiteLLM.
  • Agent: responsible for looking at the current State, and producing an Action that moves one step closer toward the end-goal.
  • AgentController: initializes the Agent, manages State, and drive the main loop that pushes the Agent forward, step by step
  • State: represents the current state of the Agent's task. Includes things like the current step, a history of recent events, the Agent's long-term plan, etc
  • EventStream: a central hub for Events, where any component can publish Events, or listen for Events published by other components
    • Event: an Action or Observeration
      • Action: represents a request to e.g. edit a file, run a command, or send a message
      • Observation: represents information collected from the environment, e.g. file contents or command output
  • Runtime: responsible for performing Actions, and sending back Observations
    • Sandbox: the part of the runtime responsible for running commands, e.g. inside of Docker
  • Server: brokers OpenDevin sessions over HTTP, e.g. to drive the frontend
    • Session: holds a single EventStream, a single AgentController, and a single Runtime. Generally represents a single task (but potentially including several user prompts)
    • SessionManager: keeps a list of active sessions, and ensures requests are routed to the correct Session

Control Flow

Here's the basic loop (in pseudocode) that drives agents.

while True:
  prompt = agent.generate_prompt(state)
  response = llm.completion(prompt)
  action = agent.parse_response(response)
  observation = runtime.run(action)
  state = state.update(action, observation)

In reality, most of this is achieved through message passing, via the EventStream. The EventStream serves as the backbone for all communication in OpenDevin.

flowchart LR
  Agent--Actions-->AgentController
  AgentController--State-->Agent
  AgentController--Actions-->EventStream
  EventStream--Observations-->AgentController
  Runtime--Observations-->EventStream
  EventStream--Actions-->Runtime
  Frontend--Actions-->EventStream

Runtime

Please refer to the documentation to learn more about Runtime.