mirror of
https://github.com/OpenHands/OpenHands.git
synced 2025-12-26 05:48:36 +08:00
* docs(docs): start implementing docs website * update video url * add autogenerated codebase docs for backend * precommit * update links * fix config and video * gh actions * rename * workdirs * path * path * fix doc1 * redo markdown * docs * change main folder name * simplify readme * add back architecture * Fix lint errors * lint * update poetry lock --------- Co-authored-by: Jim Su <jimsu@protonmail.com>
46 lines
1.0 KiB
Markdown
46 lines
1.0 KiB
Markdown
---
|
|
sidebar_label: agent
|
|
title: agenthub.planner_agent.agent
|
|
---
|
|
|
|
## PlannerAgent Objects
|
|
|
|
```python
|
|
class PlannerAgent(Agent)
|
|
```
|
|
|
|
The planner agent utilizes a special prompting strategy to create long term plans for solving problems.
|
|
The agent is given its previous action-observation pairs, current task, and hint based on last action taken at every step.
|
|
|
|
#### \_\_init\_\_
|
|
|
|
```python
|
|
def __init__(llm: LLM)
|
|
```
|
|
|
|
Initialize the Planner Agent with an LLM
|
|
|
|
**Arguments**:
|
|
|
|
- llm (LLM): The llm to be used by this agent
|
|
|
|
#### step
|
|
|
|
```python
|
|
def step(state: State) -> Action
|
|
```
|
|
|
|
Checks to see if current step is completed, returns AgentFinishAction if True.
|
|
Otherwise, creates a plan prompt and sends to model for inference, returning the result as the next action.
|
|
|
|
**Arguments**:
|
|
|
|
- state (State): The current state given the previous actions and observations
|
|
|
|
|
|
**Returns**:
|
|
|
|
- AgentFinishAction: If the last state was 'completed', 'verified', or 'abandoned'
|
|
- Action: The next action to take based on llm response
|
|
|