Home / Function/ system_prompt() — langchain Function Reference

system_prompt() — langchain Function Reference

Architecture documentation for the system_prompt() function in types.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  c4a59089_da41_a954_42aa_55bb544a2202["system_prompt()"]
  5ed84231_3781_3fca_c94d_14d881170944["ModelRequest"]
  c4a59089_da41_a954_42aa_55bb544a2202 -->|defined in| 5ed84231_3781_3fca_c94d_14d881170944
  style c4a59089_da41_a954_42aa_55bb544a2202 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/langchain/agents/middleware/types.py lines 158–166

    def system_prompt(self) -> str | None:
        """Get system prompt text from system_message.

        Returns:
            The content of the system message if present, otherwise `None`.
        """
        if self.system_message is None:
            return None
        return self.system_message.text

Subdomains

Frequently Asked Questions

What does system_prompt() do?
system_prompt() is a function in the langchain codebase, defined in libs/langchain_v1/langchain/agents/middleware/types.py.
Where is system_prompt() defined?
system_prompt() is defined in libs/langchain_v1/langchain/agents/middleware/types.py at line 158.

Analyze Your Own Codebase

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

Try Supermodel Free