motleycrew.agents.llama_index.llama_index_react

Classes

ReActLlamaIndexMotleyAgent([prompt_prefix, ...])

Wrapper for the LlamaIndex implementation of ReAct agent.

class motleycrew.agents.llama_index.llama_index_react.ReActLlamaIndexMotleyAgent(prompt_prefix: str | None = None, description: str | None = None, name: str | None = None, tools: Sequence[MotleySupportedTool] | None = None, force_output_handler: bool = False, llm: LLM | None = None, verbose: bool = False, max_iterations: int = 10)

Bases: LlamaIndexMotleyAgent

Wrapper for the LlamaIndex implementation of ReAct agent.

__init__(prompt_prefix: str | None = None, description: str | None = None, name: str | None = None, tools: Sequence[MotleySupportedTool] | None = None, force_output_handler: bool = False, llm: LLM | None = None, verbose: bool = False, max_iterations: int = 10)
Parameters:
  • prompt_prefix – Prefix to the agent’s prompt. Can be used for providing additional context, such as the agent’s role or backstory.

  • description

    Description of the agent.

    Unlike the prompt prefix, it is not included in the prompt. The description is only used for describing the agent’s purpose when giving it as a tool to other agents.

  • name

    Name of the agent. The name is used for identifying the agent when it is given as a tool to other agents, as well as for logging purposes.

    It is not included in the agent’s prompt.

  • tools – Tools to add to the agent.

  • force_output_handler – Whether to force the agent to return through an output handler. If True, at least one tool must have return_direct set to True.

  • llm – LLM instance to use.

  • verbose – Whether to log verbose output.

  • max_iterations – Maximum number of iterations for the agent. Passed on to the max_iterations parameter of the ReActAgent.