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, run_id: Optional[UUID] = None, include_run_info: bool = False, yield_actions: bool = False)[source]¶

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

run_id

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]) –

  • run_id (Optional[UUID]) –

  • 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, run_id: Optional[UUID] = None, include_run_info: bool = False, yield_actions: bool = False)[source]¶

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]) –

  • run_id (Optional[UUID]) –

  • include_run_info (bool) –

  • yield_actions (bool) –

make_final_outputs(outputs: Dict[str, Any], run_manager: Union[CallbackManagerForChainRun, AsyncCallbackManagerForChainRun]) AddableDict[source]¶
Parameters
Return type

AddableDict

reset() None[source]¶

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

Return type

None

update_iterations() None[source]¶

Increment the number of iterations and update the time elapsed.

Return type

None