One weather agent, built the way each framework's own documentation builds it. Press play on both and watch what really differs.
Checked against the official docs on 21 November 2026
By LangChain
A low-level orchestration framework and runtime for long-running, stateful agents.
pip install -U langgraph langchain langchain-anthropicBy Microsoft
Microsoft's framework for agents and multi-agent workflows, the successor to AutoGen and Semantic Kernel.
pip install agent-framework-foundry azure-identityWatch it run
Press Play to watch it run, or step through with ← →. Then switch to Practice and run it yourself.
# LangGraph: pip install -U langgraph langchain langchain-anthropic ; needs ANTHROPIC_API_KEY set
import operator
from typing import Literal
from typing_extensions import TypedDict, Annotated
from langchain.tools import tool
from langchain.chat_models import init_chat_model
from langchain.messages import AnyMessage, HumanMessage, SystemMessage, ToolMessage
from langgraph.graph import StateGraph, START, END
@tool
def get_weather(city: str) -> str:
"""Get the current weather for `city`."""
return "31 C, humid" if city.lower() == "chennai" else f"No weather data for {city}."
model = init_chat_model("claude-sonnet-4-6", temperature=0)
tools = [get_weather]
tools_by_name = {tool.name: tool for tool in tools}
model_with_tools = model.bind_tools(tools)
class MessagesState(TypedDict):
messages: Annotated[list[AnyMessage], operator.add]
def llm_call(state: dict):
system = SystemMessage(content="You are a helpful assistant that reports the weather.")
return {"messages": [model_with_tools.invoke([system] + state["messages"])]}
def tool_node(state: dict):
result = []
for tool_call in state["messages"][-1].tool_calls:
observation = tools_by_name[tool_call["name"]].invoke(tool_call["args"])
result.append(ToolMessage(content=observation, tool_call_id=tool_call["id"]))
return {"messages": result}
def should_continue(state: MessagesState) -> Literal["tool_node", END]:
return "tool_node" if state["messages"][-1].tool_calls else END
agent_builder = StateGraph(MessagesState)
agent_builder.add_node("llm_call", llm_call)
agent_builder.add_node("tool_node", tool_node)
agent_builder.add_edge(START, "llm_call")
agent_builder.add_conditional_edges("llm_call", should_continue, ["tool_node", END])
agent_builder.add_edge("tool_node", "llm_call")
weather_agent = agent_builder.compile()
messages = weather_agent.invoke({"messages": [HumanMessage(content="What's the weather in Chennai?")]})
messages["messages"][-1].pretty_print()Nothing yet. Press Play.
Watch it run
Press Play to watch it run, or step through with ← →. Then switch to Practice and run it yourself.
# Microsoft Agent Framework (Python). Install: pip install agent-framework-foundry azure-identity
# Sign in with `az login`; replace project_endpoint and model with your Foundry values.
import asyncio
from agent_framework import Agent
from agent_framework.foundry import FoundryChatClient
from azure.identity import AzureCliCredential
def get_weather(city: str) -> str:
"""Get the weather for a given city."""
if city.lower() == "chennai":
return "31 C, humid"
return f"No weather data for {city}."
weather_agent = Agent(
client=FoundryChatClient(
project_endpoint="https://your-foundry-service.services.ai.azure.com/api/projects/your-foundry-project",
model="gpt-5.4-mini",
credential=AzureCliCredential(),
),
name="weather_agent",
instructions="You are a helpful assistant. Use get_weather to answer weather questions.",
tools=[get_weather],
)
async def main():
# Non-streaming: get the complete response at once
result = await weather_agent.run("What's the weather in Chennai?")
print(f"Agent: {result}")
asyncio.run(main())Nothing yet. Press Play.
Translation
| Concept | LangGraph | Microsoft Agent Framework |
|---|---|---|
| AgentA model plus instructions and tools | Compiled StateGraph (no agent class) | Agent, with a chat client |
| ToolA function the model can ask for | @tool, model.bind_tools | Function tools (@tool or plain function) |
| Conversation stateWhat is remembered inside one chat | Checkpointers (thread-scoped) | AgentSession |
| Long-term memoryWhat is remembered across chats | Stores (cross-thread) | Context providers |
| Handing work to another agentMulti-agent delegation | Handoffs / subagents patterns | Handoff orchestration, agents as tools |
| Fixed workflowSteps in an order you decide, not the model | Graph API: state, nodes, edges | Workflows (WorkflowBuilder) |
| Human in the loopPause and ask a person | Interrupts: interrupt(), Command | Tool approval, ctx.request_info() |
| Tracing and evaluationSee what happened, check quality | LangSmith Observability | Observability (OpenTelemetry), Evaluation |
| Deployment in the docsWhere the docs tell you to run it | LangSmith Cloud / Agent Server | Foundry Hosted Agents, self-hosting |
The example agents follow each framework's own quickstart and use the model its docs use; they are shown for reading and were not benchmarked against each other. This site is independent and is not affiliated with LangChain or Microsoft.