Module 4 cheat sheet: Production & Beyond

Trace, cache and rate-limit for real users, read old LangChain code, and build custom flows with LangGraph.

All modules๐Ÿ“– Glossary

Key ideas

Production one-liners

set_llm_cache(InMemoryCache())
limiter = InMemoryRateLimiter(requests_per_second=0.5)
llm = ChatGroq(model="openai/gpt-oss-20b", rate_limiter=limiter,
               timeout=30, max_retries=2)
os.environ["LANGSMITH_TRACING"] = "true"

Old โ†’ new

OldNew
LLMChainprompt | llm | parser
ConversationChaincheckpointer + thread_id
BufferWindowMemorytrim_messages
RetrievalQALCEL RAG chain
initialize_agentcreate_agent
.run().invoke()

LangGraph agent

b = StateGraph(MessagesState)
b.add_node("assistant", assistant)
b.add_node("tools", ToolNode(tools))
b.add_edge(START, "assistant")
b.add_conditional_edges("assistant", tools_condition)
b.add_edge("tools", "assistant")
g = b.compile(checkpointer=InMemorySaver(), interrupt_before=["tools"])

Common mistakes

  • Caching personal answers across users.
  • No timeouts or retries.
  • Copying 2023 tutorials without converting.
  • No recursion limit on custom graphs.

Created by Ajeetkumar ยท EasyLearnSpace