langchain.agents.agent.BaseMultiActionAgent

class langchain.agents.agent.BaseMultiActionAgent[source]

Bases: BaseModel

Base Multi Action Agent class.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

abstract async aplan(intermediate_steps: List[Tuple[AgentAction, str]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) Union[List[AgentAction], AgentFinish][source]

Given input, decided what to do.

Parameters
  • intermediate_steps – Steps the LLM has taken to date, along with the observations.

  • callbacks – Callbacks to run.

  • **kwargs – User inputs.

Returns

Actions specifying what tool to use.

dict(**kwargs: Any) Dict[source]

Return dictionary representation of agent.

get_allowed_tools() Optional[List[str]][source]
abstract plan(intermediate_steps: List[Tuple[AgentAction, str]], callbacks: Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]] = None, **kwargs: Any) Union[List[AgentAction], AgentFinish][source]

Given input, decided what to do.

Parameters
  • intermediate_steps – Steps the LLM has taken to date, along with the observations.

  • callbacks – Callbacks to run.

  • **kwargs – User inputs.

Returns

Actions specifying what tool to use.

return_stopped_response(early_stopping_method: str, intermediate_steps: List[Tuple[AgentAction, str]], **kwargs: Any) AgentFinish[source]

Return response when agent has been stopped due to max iterations.

save(file_path: Union[Path, str]) None[source]

Save the agent.

Parameters

file_path – Path to file to save the agent to.

Example: .. code-block:: python

# If working with agent executor agent.agent.save(file_path=”path/agent.yaml”)

tool_run_logging_kwargs() Dict[source]
property return_values: List[str]

Return values of the agent.

Examples using BaseMultiActionAgent