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]¶

Bases: BaseAgentExecutorIterator

Iterator for AgentExecutor.

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

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.

Attributes

agent_executor

callback_manager

callbacks

color_mapping

final_outputs

inputs

name_to_tool_map

tags

run_manager

timeout_manager

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.

property agent_executor: AgentExecutor¶
property callback_manager: Union[langchain.callbacks.manager.AsyncCallbackManager, langchain.callbacks.manager.CallbackManager]¶
property callbacks: Optional[Union[List[langchain.callbacks.base.BaseCallbackHandler], langchain.callbacks.base.BaseCallbackManager]]¶
property color_mapping: dict[str, str]¶
property final_outputs: Optional[dict[str, Any]]¶
property inputs: dict[str, str]¶
property name_to_tool_map: dict[str, langchain.tools.base.BaseTool]¶
run_manager: Optional[Union[langchain.callbacks.manager.AsyncCallbackManagerForChainRun, langchain.callbacks.manager.CallbackManagerForChainRun]]¶
property tags: Optional[List[str]]¶
timeout_manager: Any¶