langchain.agents.agent_iterator.AgentExecutorIterator

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

Iterator for AgentExecutor.

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

Attributes

agent_executor

callback_manager

callbacks

color_mapping

final_outputs

inputs

name_to_tool_map

tags

run_manager

timeout_manager

Methods

__init__(agent_executor, inputs[, ...])

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

build_callback_manager()

Create and configure the callback manager based on the current callbacks and tags.

raise_stopasynciteration(output)

Raise a StopAsyncIteration exception with the given output.

raise_stopiteration(output)

Raise a StopIteration exception with the given output.

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.

__init__(agent_executor: AgentExecutor, inputs: Any, callbacks: Callbacks = None, *, tags: Optional[list[str]] = None, include_run_info: bool = False, async_: bool = False)[source]

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

build_callback_manager() None[source]

Create and configure the callback manager based on the current callbacks and tags.

async raise_stopasynciteration(output: Any) NoReturn[source]

Raise a StopAsyncIteration exception with the given output. Close the timeout context manager.

raise_stopiteration(output: Any) NoReturn[source]

Raise a StopIteration exception with the given output.

reset() None[source]

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

update_iterations() None[source]

Increment the number of iterations and update the time elapsed.