LangChain 1 · Agents and tools
Return structured output from an agent
Pass a Pydantic class as response_format and read the parsed result.
agent = create_agent(model="anthropic:claude-sonnet-5-5", tools=[], response_format=Movie)
result = agent.invoke({"messages": [{"role": "user", "content": "Tell me about Inception."}]})
result["structured_response"]
Official LangChain 1 documentation