Home / Class/ TestCreateAgentSystemMessage Class — langchain Architecture

TestCreateAgentSystemMessage Class — langchain Architecture

Architecture documentation for the TestCreateAgentSystemMessage class in test_system_message.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  67239a10_78a9_dbf5_c896_a977a47fe9a2["TestCreateAgentSystemMessage"]
  a610b8e2_10fe_f60e_5de4_dde05dd5afb7["test_system_message.py"]
  67239a10_78a9_dbf5_c896_a977a47fe9a2 -->|defined in| a610b8e2_10fe_f60e_5de4_dde05dd5afb7
  7f038115_cb69_df91_7e38_3598eba03d38["test_create_agent_with_various_system_prompts()"]
  67239a10_78a9_dbf5_c896_a977a47fe9a2 -->|method| 7f038115_cb69_df91_7e38_3598eba03d38

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_system_message.py lines 310–354

class TestCreateAgentSystemMessage:
    """Test create_agent with various system message inputs."""

    @pytest.mark.parametrize(
        "system_prompt",
        [
            None,
            "You are a helpful assistant",
            SystemMessage(content="You are a helpful assistant"),
            SystemMessage(
                content="You are a helpful assistant",
                additional_kwargs={"role": "system_admin", "priority": "high"},
                response_metadata={"model": "gpt-4", "temperature": 0.7},
            ),
            SystemMessage(
                content=[
                    {"type": "text", "text": "You are a helpful assistant"},
                    {
                        "type": "text",
                        "text": "Follow these rules carefully",
                        "cache_control": {"type": "ephemeral"},
                    },
                ]
            ),
        ],
        ids=[
            "none",
            "string",
            "system_message",
            "system_message_with_metadata",
            "system_message_with_complex_content",
        ],
    )
    def test_create_agent_with_various_system_prompts(
        self, system_prompt: SystemMessage | str | None
    ) -> None:
        """Test create_agent accepts various system_prompt formats."""
        model = GenericFakeChatModel(messages=iter([AIMessage(content="Hello")]))

        agent = create_agent(
            model=model,
            system_prompt=system_prompt,
        )

        assert agent is not None

Frequently Asked Questions

What is the TestCreateAgentSystemMessage class?
TestCreateAgentSystemMessage is a class in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_system_message.py.
Where is TestCreateAgentSystemMessage defined?
TestCreateAgentSystemMessage is defined in libs/langchain_v1/tests/unit_tests/agents/test_system_message.py at line 310.

Analyze Your Own Codebase

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

Try Supermodel Free