openhands.core.main
read_task_from_file
def read_task_from_file(file_path: str) -> str
Read task from the specified file.
read_task_from_stdin
def read_task_from_stdin() -> str
Read task from stdin.
read_input
def read_input(config: AppConfig) -> str
Read input from user based on config settings.
run_controller
async def run_controller(config: AppConfig,
initial_user_action: Action,
sid: str | None = None,
runtime: Runtime | None = None,
agent: Agent | None = None,
exit_on_message: bool = False,
fake_user_response_fn: FakeUserResponseFunc
| None = None,
headless_mode: bool = True) -> State | None
Main coroutine to run the agent controller with task input flexibility. It's only used when you launch openhands backend directly via cmdline.
Arguments:
config
- The app config.initial_user_action
- An Action object containing initial user inputsid
- (optional) The session id. IMPORTANT: please don't set this unless you know what you're doing. Set it to incompatible value will cause unexpected behavior on RemoteRuntime.runtime
- (optional) A runtime for the agent to run on.agent
- (optional) A agent to run.exit_on_message
- quit if agent asks for a message from user (optional)fake_user_response_fn
- An optional function that receives the current state (could be None) and returns a fake user response.headless_mode
- Whether the agent is run in headless mode.
auto_continue_response
def auto_continue_response(
state: State,
encapsulate_solution: bool = False,
try_parse: Callable[[Action | None], str] | None = None) -> str
Default function to generate user responses. Tell the agent to proceed without asking for more input, or finish the interaction.
load_replay_log
def load_replay_log(trajectory_path: str) -> tuple[list[Event] | None, Action]
Load trajectory from given path, serialize it to a list of events, and return two things:
- A list of events except the first action
- First action (user message, a.k.a. initial task)