Toggle Menu
Prev Up Next

# `langchain.agents.agent_iterator`.AgentExecutorIterator

class langchain.agents.agent_iterator.AgentExecutorIterator(agent_executor: AgentExecutor, inputs: Any, callbacks: Callbacks = None, *, tags: Optional[list[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, include_run_info: bool = False, yield_actions: bool = False)

  Iterator for AgentExecutor.

  Initialize the AgentExecutorIterator with the given AgentExecutor, inputs, and optional callbacks.

  Attributes

  `agent_executor` |
  `color_mapping` |
  `inputs` |
  `name_to_tool_map` |
  `callbacks` |
  `tags` |
  `metadata` |
  `run_name` |
  `include_run_info` |
  `yield_actions` |

  Methods

  `__init__`(agent_executor, inputs[, ...]) | Initialize the AgentExecutorIterator with the given AgentExecutor, inputs, and optional callbacks.
  `make_final_outputs`(outputs, run_manager) |
  `reset`() | Reset the iterator to its initial state, clearing intermediate steps, iterations, and time elapsed.
  `update_iterations`() | Increment the number of iterations and update the time elapsed.

  Parameters

    - agent_executor (AgentExecutor) –

    - inputs (Any) –

    - callbacks (Optional[Union[List[BaseCallbackHandler], BaseCallbackManager]]) –

    - tags (Optional[list[str]]) –

    - metadata (Optional[Dict[str, Any]]) –

    - run_name (Optional[str]) –

    - include_run_info (bool) –

    - yield_actions (bool) –

  __init__(agent_executor: AgentExecutor, inputs: Any, callbacks: Callbacks = None, *, tags: Optional[list[str]] = None, metadata: Optional[Dict[str, Any]] = None, run_name: Optional[str] = None, include_run_info: bool = False, yield_actions: bool = False)

    Initialize the AgentExecutorIterator with the given AgentExecutor, inputs, and optional callbacks.

    Parameters

      - agent_executor (AgentExecutor) –

      - inputs (Any) –

      - callbacks (Callbacks) –

      - tags (Optional[list[str]]) –

      - metadata (Optional[Dict[str, Any]]) –

      - run_name (Optional[str]) –

      - include_run_info (bool) –

      - yield_actions (bool) –

  make_final_outputs(outputs: Dict[str, Any], run_manager: Union[CallbackManagerForChainRun, AsyncCallbackManagerForChainRun]) → AddableDict
    Parameters

      - outputs (Dict[str, Any]) –

      - run_manager (Union[CallbackManagerForChainRun, AsyncCallbackManagerForChainRun]) –

    Return type

      AddableDict

  reset() → None

    Reset the iterator to its initial state, clearing intermediate steps, iterations, and time elapsed.

    Return type

      None

  update_iterations() → None

    Increment the number of iterations and update the time elapsed.

    Return type

      None