Key facts

  • Building without LangChain can be reasonable when the agent is a small, changing state machine.
  • The first artifact should be the graph and shared-state contract, not a provider wrapper catalog.
  • Adopt LangChain, LangGraph, LlamaIndex, or a managed platform when their infrastructure saves more work than they add.

When building without LangChain is reasonable

Building without LangChain is reasonable when the agent is still a small, changing state machine. If you can name each state, action, and shared-store key in one screen, a local graph often teaches you more than adopting a broad agent ecosystem on day one.

This is not an argument that LangChain is bad. LangChain can be useful when its model abstractions, tool harness, middleware, ecosystem, and LangGraph foundation remove more work than they add. The mistake is treating every agent as if its hardest problem is framework selection. Early on, the hard problem is usually discovering the workflow.

Draw the graph before writing prompts

Start with the states the agent can be in: plan, retrieve, read, decide, answer, ask for clarification, repair output, or stop. Then label the action edges. A decision node returning search, answer, or clarify is easier to test than a prompt that says "do the right thing."

Next, define the shared state. Keep it boring: question, plan, search_query, evidence, draft_answer, validation_errors, final_answer. If the shared state feels vague, the graph is not ready. Use the agent graph designer to sketch the flow and export a skeleton before wiring any model calls.

"Action-based Transitions"

Pocket Flow Flow docs

Use a small runtime boundary

A small runtime should know how to run nodes, follow action-labeled transitions, retry a node, call fallback when needed, and pass a shared state object. It should not need to own every model provider, vector database, search API, prompt library, or deployment target.

That boundary keeps the agent portable. You can call OpenAI, Anthropic, local models, a search API, or a database inside node code without turning those utilities into the orchestration framework itself. When the same utility appears across multiple graphs, promote it deliberately.

decide - "search" -> retrieve
decide - "answer" -> answer
retrieve - "decide" -> decide
answer - "repair" -> repair
answer - "done" -> stop

Know when to stop being minimal

Minimal does not mean heroic. If the agent must resume after worker failure, pause for human approval, persist memory, stream progress, replay traces, manage permissions, evaluate outputs, or coordinate many data connectors, a heavier runtime may be the honest choice.

Use the framework overhead calculator to make that discussion explicit. The verdict should be "this operational need is now real," not "small is always better" or "frameworks are always safer."

A lightweight agent checklist

  1. Name the agent state in plain data.
  2. Draw the action graph before writing prompts.
  3. Create one node per stable unit of work.
  4. Keep provider calls outside the graph runtime.
  5. Test transitions with deterministic fakes.
  6. Adopt heavier infrastructure when operations become the hard problem.

If this checklist feels too constrained, that is useful information. It means you are no longer evaluating a tiny agent graph; you are evaluating an orchestration platform, data framework, or production agent runtime.

Sources used on this page

  • Pocket Flow documentation The Pocket. Accessed July 6, 2026. Primary source for the 100-line claim, Graph + Shared Store abstraction, core patterns, and utility philosophy.
  • Pocket Flow Node documentation The Pocket. Accessed July 6, 2026. Primary source for prep, exec, post, retries, and fallback behavior.
  • Pocket Flow Flow documentation The Pocket. Accessed July 6, 2026. Primary source for action-based transitions, branching, loops, and nested flows.
  • LangChain overview LangChain. Accessed July 6, 2026. Primary source for LangChain create_agent, integrations, middleware, and LangGraph relationship.
  • LangGraph overview LangChain. Accessed July 6, 2026. Primary source for durable execution, persistence, human-in-the-loop, memory, and production orchestration claims.

Cite this page

Build agents without LangChain. PocketFlow AI Guide. Updated July 6, 2026. https://pocketflowai.com/build-agents-without-langchain/

PocketFlow AI Guide. "Build agents without LangChain." Accessed July 6, 2026. https://pocketflowai.com/build-agents-without-langchain/