Home / Function/ test_state_schema_single_custom_field() — langchain Function Reference

test_state_schema_single_custom_field() — langchain Function Reference

Architecture documentation for the test_state_schema_single_custom_field() function in test_state_schema.py from the langchain codebase.

Entity Profile

Dependency Diagram

graph TD
  eb30ef1e_0aac_26de_b328_c531c7006312["test_state_schema_single_custom_field()"]
  3d4a3f09_0839_f785_dcfd_f1e7b13e3204["test_state_schema.py"]
  eb30ef1e_0aac_26de_b328_c531c7006312 -->|defined in| 3d4a3f09_0839_f785_dcfd_f1e7b13e3204
  style eb30ef1e_0aac_26de_b328_c531c7006312 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

libs/langchain_v1/tests/unit_tests/agents/test_state_schema.py lines 36–53

def test_state_schema_single_custom_field() -> None:
    """Test that a single custom state field is preserved through agent execution."""

    class CustomState(AgentState[Any]):
        custom_field: str

    agent = create_agent(
        model=FakeToolCallingModel(
            tool_calls=[[{"args": {"x": 1}, "id": "call_1", "name": "simple_tool"}], []]
        ),
        tools=[simple_tool],
        state_schema=CustomState,
    )

    result = agent.invoke({"messages": [HumanMessage("Test")], "custom_field": "test_value"})

    assert result["custom_field"] == "test_value"
    assert len(result["messages"]) == 4

Domain

Subdomains

Frequently Asked Questions

What does test_state_schema_single_custom_field() do?
test_state_schema_single_custom_field() is a function in the langchain codebase, defined in libs/langchain_v1/tests/unit_tests/agents/test_state_schema.py.
Where is test_state_schema_single_custom_field() defined?
test_state_schema_single_custom_field() is defined in libs/langchain_v1/tests/unit_tests/agents/test_state_schema.py at line 36.

Analyze Your Own Codebase

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

Try Supermodel Free