P2P agent pattern: deterministic workflow outside, swappable agentic core inside on LangGraph

hwchase17 · x · 2026-11-16

vitalflux shares their procure-to-pay agent architecture on LangChain: a deterministic shell (load context → agent core → exit gate → write back) wrapping a single swappable AgentCore.run(context) interface. Today it's a createagent loop; for messy cases (multiple invoices, disputes) createdeepagent drops in. Drawn from Anthropic's "Building effective agents": workflows for well-defined tasks, agency only where flexibility is needed. Rule of thumb from the diagram: if you can draw the flowchart use a workflow, if not use an agent, and keep unskippable rule checks in code since prompts are probabilistic.

Original post →

More from coding & agent

coding & agent channel →