One diagram to teach LangChain tool calling: how AIMessage and ToolMessage pair up
ghumare64 · x · 2026-11-14
A minimal visual explainer of LangChain's tool-calling message flow, proposed as the right starting point for teaching the framework:
- AIMessage: content is an empty string; the model's request for a tool lives in the parsed toolcalls field, containing the tool name (e.g. add), args {a: 2, b: 3}, and a call id call1.
- ToolMessage: carries the tool's result (content "5", name add, status success) and repeats the toolcallid (call1) of the call it answers.
Key insight: the tool request is already parsed in toolcalls (content empty), and each ToolMessage links back to its AIMessage via the shared call id — understanding this pairing is the foundation for everything else in LangChain.
More from coding & agent
- T3 Code adds MCP connector so any agent can control it and swap models freely — koltregaskes · 2026-11-14
- Data curation RL is just SWE envs: code pretraining data increasingly consists of Claude-built, less-sloppy repos — willcb · 2026-11-14
- Solo dev builds real-time conference translation platform for 70 languages with an agentic harness — evisoft · 2026-11-14
- Open-source Blender add-on runs NVIDIA Kimodo, ARDY and MotionBricks locally for AI motion generation — bdsqlsz · 2026-11-14
- paperjam: self-hosted Rust document archive with a native MCP server and MRZ check-digit validation — ilodezis · 2026-11-14
- TestPrune: pruning regression tests to unblock AI-driven autonomous bug fixing — burkov · 2026-11-14