agentlab.agents.most_basic_agent.most_basic_agent
Functions
Classes
|
|
|
- class agentlab.agents.most_basic_agent.most_basic_agent.MostBasicAgent(temperature: float, use_chain_of_thought: bool, chat_model_args: BaseModelArgs)
Bases:
Agent- get_action(obs)
Updates the agent with the current observation, and returns its next action (plus an info dict, optional).
Parameters:
- obs:
The current observation of the environment, after it has been processed by obs_preprocessor(). By default, a BrowserGym observation is a dict with the following entries: - “chat_messages”: list[str], messages between the agent and the user. - “goal”: str, the current goal. - “open_pages_urls”: list[str], open pages. - “active_page_index”: int, the index of the active page. - “url”: str, the current URL. - “screenshot”: 3D np.array, the current screenshot. - “dom_object”: dict, the current DOM object. See DOMSnapshot from chrome devtools. - “axtree_object”: dict, the current AXTREE object. See Accessibility Tree from chrome devtools. - “extra_element_properties”: dict[bid, dict[name, value]] extra properties of elements in the DOM. - “focused_element_bid”: str, the bid of the focused element. - “last_action”: str, the last action executed. - “last_action_error”: str, the error of the last action. - “elapsed_time”: float, the time elapsed since the start of the episode.
Returns:
- action: str
The action to be processed by action_mapping() (if any), and executed in the environment.
- info: AgentInfo
Additional information about the action. with the following entries being handled by BrowserGym:
“think”: optional chain of thought
“messages”: list of messages with the LLM
“stats”: dict of extra statistics that will be saved and aggregated.
“markdown_page”: str, string that will be displayed by agentlab’s xray tool.
“extra_info”: dict, additional information that will be saved and aggregated.
- class agentlab.agents.most_basic_agent.most_basic_agent.MostBasicAgentArgs(agent_name: str = 'BasicAgent', temperature: float = 0.1, use_chain_of_thought: bool = False, chat_model_args: 'BaseModelArgs' = None)
Bases:
AgentArgs- chat_model_args: BaseModelArgs = None
- close()
Close the agent’s LLM models after running the experiment.
- make_agent() Agent
Comply the experiments.loop API for instantiating the agent.
- prepare()
Prepare the agent’s LLM models before running the experiment.
- set_reproducibility_mode()
Optional method to set the agent in a reproducibility mode.
This should adjust the agent configuration to make it as deterministic as possible e.g. setting the temperature of the model to 0.
This is only called when reproducibility is requested.
- Raises:
NotImplementedError – If the agent does not support reproducibility.
- agentlab.agents.most_basic_agent.most_basic_agent.experiment_config()