Files
OpenHands/docs/modules/python/agenthub/codeact_agent/codeact_agent.md
Xingyao Wang 435f47ca0e Improve the both frontend and backend for CodeActAgent (#1494)
* improve the both frontend and backend for CodeActAgent

* fix linter

* update integration test
2024-05-02 02:07:40 +08:00

1.2 KiB

sidebar_label, title
sidebar_label title
codeact_agent agenthub.codeact_agent.codeact_agent

truncate_observation

def truncate_observation(observation: str, max_chars: int = 5000) -> str

Truncate the middle of the observation if it is too long.

CodeActAgent Objects

class CodeActAgent(Agent)

The Code Act Agent is a minimalist agent. The agent works by passing the model a list of action-observation pairs and prompting the model to take the next step.

__init__

def __init__(llm: LLM) -> None

Initializes a new instance of the CodeActAgent class.

Arguments:

  • llm (LLM): The llm to be used by this agent

step

def step(state: State) -> Action

Performs one step using the Code Act Agent. This includes gathering info on previous steps and prompting the model to make a command to execute.

Arguments:

  • state (State): used to get updated info and background commands

Returns:

  • CmdRunAction(command) - command action to run
  • AgentEchoAction(content=INVALID_INPUT_MESSAGE) - invalid command output

Raises:

  • NotImplementedError - for actions other than CmdOutputObservation or AgentMessageObservation