Home / Function/ _astop() — langchain Function Reference

_astop() — langchain Function Reference

Architecture documentation for the _astop() function in agent_iterator.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  12aabcf0_d15a_c7f2_5864_7db271a88d3d["_astop()"]
  490b6bce_9d4c_017c_89ae_b13ea74223ea["AgentExecutorIterator"]
  12aabcf0_d15a_c7f2_5864_7db271a88d3d -->|defined in| 490b6bce_9d4c_017c_89ae_b13ea74223ea
  2930b993_0ef7_2ec8_a8f2_724346ce4dde["__aiter__()"]
  2930b993_0ef7_2ec8_a8f2_724346ce4dde -->|calls| 12aabcf0_d15a_c7f2_5864_7db271a88d3d
  0a3774fd_ebe1_abde_5275_25554914ae62["_areturn()"]
  12aabcf0_d15a_c7f2_5864_7db271a88d3d -->|calls| 0a3774fd_ebe1_abde_5275_25554914ae62
  style 12aabcf0_d15a_c7f2_5864_7db271a88d3d fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain/langchain_classic/agents/agent_iterator.py lines 390–402

    async def _astop(self, run_manager: AsyncCallbackManagerForChainRun) -> AddableDict:
        """Stop the async iterator.

        Stop the async iterator and raise a StopAsyncIteration exception with
        the stopped response.
        """
        logger.warning("Stopping agent prematurely due to triggering stop condition")
        output = self.agent_executor._action_agent.return_stopped_response(  # noqa: SLF001
            self.agent_executor.early_stopping_method,
            self.intermediate_steps,
            **self.inputs,
        )
        return await self._areturn(output, run_manager=run_manager)

Subdomains

Calls

Called By

Frequently Asked Questions

What does _astop() do?
_astop() is a function in the langchain codebase, defined in libs/langchain/langchain_classic/agents/agent_iterator.py.
Where is _astop() defined?
_astop() is defined in libs/langchain/langchain_classic/agents/agent_iterator.py at line 390.
What does _astop() call?
_astop() calls 1 function(s): _areturn.
What calls _astop()?
_astop() is called by 1 function(s): __aiter__.

Analyze Your Own Codebase

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

Try Supermodel Free