Home / File/ agent_iterator.py — langchain Source File

agent_iterator.py — langchain Source File

Architecture documentation for agent_iterator.py, a python file in the langchain codebase. 16 imports, 0 dependents.

File python AgentOrchestration ToolInterface 16 imports 1 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4["agent_iterator.py"]
  a327e534_84f6_5308_58ca_5727d5eda0cf["asyncio"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> a327e534_84f6_5308_58ca_5727d5eda0cf
  2a7f66a7_8738_3d47_375b_70fcaa6ac169["logging"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> 2a7f66a7_8738_3d47_375b_70fcaa6ac169
  0c1d9a1b_c553_0388_dbc1_58af49567aa2["time"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> 0c1d9a1b_c553_0388_dbc1_58af49567aa2
  cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7["collections.abc"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> cfe2bde5_180e_e3b0_df2b_55b3ebaca8e7
  8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3["typing"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> 8e2034b7_ceb8_963f_29fc_2ea6b50ef9b3
  8dfa0cac_d802_3ccd_f710_43a5e70da3a5["uuid"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> 8dfa0cac_d802_3ccd_f710_43a5e70da3a5
  80d582c5_7cc3_ac96_2742_3dbe1cbd4e2b["langchain_core.agents"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> 80d582c5_7cc3_ac96_2742_3dbe1cbd4e2b
  f3bc7443_c889_119d_0744_aacc3620d8d2["langchain_core.callbacks"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> f3bc7443_c889_119d_0744_aacc3620d8d2
  f10c7807_dbfb_545d_042b_5250f9fd7d51["langchain_core.load.dump"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> f10c7807_dbfb_545d_042b_5250f9fd7d51
  ac2a9b92_4484_491e_1b48_ec85e71e1d58["langchain_core.outputs"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> ac2a9b92_4484_491e_1b48_ec85e71e1d58
  81c04601_d095_a27d_4af1_55e771bb2b6b["langchain_core.runnables.utils"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> 81c04601_d095_a27d_4af1_55e771bb2b6b
  43d88577_548b_2248_b01b_7987bae85dcc["langchain_core.tools"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> 43d88577_548b_2248_b01b_7987bae85dcc
  75b56223_6cf5_b347_8586_de20156157a1["langchain_core.utils.input"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> 75b56223_6cf5_b347_8586_de20156157a1
  52a02ed3_b44b_45aa_e71c_064994c739be["langchain_classic.schema"]
  6d59b1ff_6186_2ffc_1ba1_8be7969473b4 --> 52a02ed3_b44b_45aa_e71c_064994c739be
  style 6d59b1ff_6186_2ffc_1ba1_8be7969473b4 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from __future__ import annotations

import asyncio
import logging
import time
from collections.abc import AsyncIterator, Iterator
from typing import (
    TYPE_CHECKING,
    Any,
)
from uuid import UUID

from langchain_core.agents import (
    AgentAction,
    AgentFinish,
    AgentStep,
)
from langchain_core.callbacks import (
    AsyncCallbackManager,
    AsyncCallbackManagerForChainRun,
    CallbackManager,
    CallbackManagerForChainRun,
    Callbacks,
)
from langchain_core.load.dump import dumpd
from langchain_core.outputs import RunInfo
from langchain_core.runnables.utils import AddableDict
from langchain_core.tools import BaseTool
from langchain_core.utils.input import get_color_mapping

from langchain_classic.schema import RUN_KEY
from langchain_classic.utilities.asyncio import asyncio_timeout

if TYPE_CHECKING:
    from langchain_classic.agents.agent import AgentExecutor, NextStepOutput

logger = logging.getLogger(__name__)


class AgentExecutorIterator:
    """Iterator for AgentExecutor."""

    def __init__(
        self,
        agent_executor: AgentExecutor,
        inputs: Any,
        callbacks: Callbacks = None,
        *,
        tags: list[str] | None = None,
        metadata: dict[str, Any] | None = None,
        run_name: str | None = None,
        run_id: UUID | None = None,
        include_run_info: bool = False,
        yield_actions: bool = False,
    ):
        """Initialize the `AgentExecutorIterator`.

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

// ... (373 more lines)

Subdomains

Dependencies

  • asyncio
  • collections.abc
  • langchain_classic.agents.agent
  • langchain_classic.schema
  • langchain_classic.utilities.asyncio
  • langchain_core.agents
  • langchain_core.callbacks
  • langchain_core.load.dump
  • langchain_core.outputs
  • langchain_core.runnables.utils
  • langchain_core.tools
  • langchain_core.utils.input
  • logging
  • time
  • typing
  • uuid

Frequently Asked Questions

What does agent_iterator.py do?
agent_iterator.py is a source file in the langchain codebase, written in python. It belongs to the AgentOrchestration domain, ToolInterface subdomain.
What functions are defined in agent_iterator.py?
agent_iterator.py defines 1 function(s): langchain_classic.
What does agent_iterator.py depend on?
agent_iterator.py imports 16 module(s): asyncio, collections.abc, langchain_classic.agents.agent, langchain_classic.schema, langchain_classic.utilities.asyncio, langchain_core.agents, langchain_core.callbacks, langchain_core.load.dump, and 8 more.
Where is agent_iterator.py in the architecture?
agent_iterator.py is located at libs/langchain/langchain_classic/agents/agent_iterator.py (domain: AgentOrchestration, subdomain: ToolInterface, directory: libs/langchain/langchain_classic/agents).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free