agent.py — langchain Source File
Architecture documentation for agent.py, a python file in the langchain codebase. 34 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 0ebc163d_9dba_a521_0e2e_0dd45f356b3e["agent.py"] e6310202_b39e_ec9f_8b57_921c9c39c97d["asyncio"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> e6310202_b39e_ec9f_8b57_921c9c39c97d f75eb023_c1ea_859a_7480_1e57f335d1de["builtins"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> f75eb023_c1ea_859a_7480_1e57f335d1de be45a0bb_0276_f8f1_f985_55cddb92c224["contextlib"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> be45a0bb_0276_f8f1_f985_55cddb92c224 9d14ea65_8b2e_6721_a947_acc89905651f["json"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> 9d14ea65_8b2e_6721_a947_acc89905651f e27da29f_a1f7_49f3_84d5_6be4cb4125c8["logging"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> e27da29f_a1f7_49f3_84d5_6be4cb4125c8 996b2db9_46dd_901f_f7eb_068bafab4b12["time"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> 996b2db9_46dd_901f_f7eb_068bafab4b12 50e20440_a135_6be3_a5a5_67791be5a2a6["abc"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> 50e20440_a135_6be3_a5a5_67791be5a2a6 2bf6d401_816d_d011_3b05_a6114f55ff58["collections.abc"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> 2bf6d401_816d_d011_3b05_a6114f55ff58 927570d8_11a6_5c17_0f0d_80baae0c733e["pathlib"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> 927570d8_11a6_5c17_0f0d_80baae0c733e feec1ec4_6917_867b_d228_b134d0ff8099["typing"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> feec1ec4_6917_867b_d228_b134d0ff8099 a869785a_d507_1688_0b32_0ec94043975a["yaml"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> a869785a_d507_1688_0b32_0ec94043975a 2485b66a_3839_d0b6_ad9c_a4ff40457dc6["langchain_core._api"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> 2485b66a_3839_d0b6_ad9c_a4ff40457dc6 59e0d3b0_0f8e_4b79_d442_e9b4821561c7["langchain_core.agents"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> 59e0d3b0_0f8e_4b79_d442_e9b4821561c7 17a62cb3_fefd_6320_b757_b53bb4a1c661["langchain_core.callbacks"] 0ebc163d_9dba_a521_0e2e_0dd45f356b3e --> 17a62cb3_fefd_6320_b757_b53bb4a1c661 style 0ebc163d_9dba_a521_0e2e_0dd45f356b3e fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
"""Chain that takes in an input and produces an action and action input."""
from __future__ import annotations
import asyncio
import builtins
import contextlib
import json
import logging
import time
from abc import abstractmethod
from collections.abc import AsyncIterator, Callable, Iterator, Sequence
from pathlib import Path
from typing import (
Any,
cast,
)
import yaml
from langchain_core._api import deprecated
from langchain_core.agents import AgentAction, AgentFinish, AgentStep
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
AsyncCallbackManagerForToolRun,
BaseCallbackManager,
CallbackManagerForChainRun,
CallbackManagerForToolRun,
Callbacks,
)
from langchain_core.exceptions import OutputParserException
from langchain_core.language_models import BaseLanguageModel
from langchain_core.messages import BaseMessage
from langchain_core.output_parsers import BaseOutputParser
from langchain_core.prompts import BasePromptTemplate
from langchain_core.prompts.few_shot import FewShotPromptTemplate
from langchain_core.prompts.prompt import PromptTemplate
from langchain_core.runnables import Runnable, RunnableConfig, ensure_config
from langchain_core.runnables.utils import AddableDict
from langchain_core.tools import BaseTool
from langchain_core.utils.input import get_color_mapping
from pydantic import BaseModel, ConfigDict, model_validator
from typing_extensions import Self, override
from langchain_classic._api.deprecation import AGENT_DEPRECATION_WARNING
from langchain_classic.agents.agent_iterator import AgentExecutorIterator
from langchain_classic.agents.agent_types import AgentType
from langchain_classic.agents.tools import InvalidTool
from langchain_classic.chains.base import Chain
from langchain_classic.chains.llm import LLMChain
from langchain_classic.utilities.asyncio import asyncio_timeout
logger = logging.getLogger(__name__)
class BaseSingleActionAgent(BaseModel):
"""Base Single Action Agent class."""
@property
def return_values(self) -> list[str]:
"""Return values of the agent."""
// ... (1733 more lines)
Domain
Subdomains
Classes
Dependencies
- abc
- asyncio
- builtins
- collections.abc
- contextlib
- json
- langchain_classic._api.deprecation
- langchain_classic.agents.agent_iterator
- langchain_classic.agents.agent_types
- langchain_classic.agents.tools
- langchain_classic.chains.base
- langchain_classic.chains.llm
- langchain_classic.utilities.asyncio
- langchain_core._api
- langchain_core.agents
- langchain_core.callbacks
- langchain_core.exceptions
- langchain_core.language_models
- langchain_core.messages
- langchain_core.output_parsers
- langchain_core.prompts
- langchain_core.prompts.few_shot
- langchain_core.prompts.prompt
- langchain_core.runnables
- langchain_core.runnables.utils
- langchain_core.tools
- langchain_core.utils.input
- logging
- pathlib
- pydantic
- time
- typing
- typing_extensions
- yaml
Source
Frequently Asked Questions
What does agent.py do?
agent.py is a source file in the langchain codebase, written in python. It belongs to the AgentOrchestration domain, AgentExcecutor subdomain.
What does agent.py depend on?
agent.py imports 34 module(s): abc, asyncio, builtins, collections.abc, contextlib, json, langchain_classic._api.deprecation, langchain_classic.agents.agent_iterator, and 26 more.
Where is agent.py in the architecture?
agent.py is located at libs/langchain/langchain_classic/agents/agent.py (domain: AgentOrchestration, subdomain: AgentExcecutor, 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