Agentic AI Foundations Series · Part 3 of 6
Part 3: LangChain and the OpenAI Agents SDK – Your Agent Toolbox
You don't need to write code for this exam. You need to know which building block does which job.
LangChain: the Lego set
LangChain is a framework of reusable pieces you snap together. Think of building a RAG app over your EBS runbooks:
- Document loader reads the runbook PDFs.
- Text splitter cuts them into small chunks.
- Embeddings turn each chunk into a vector.
- Vector store saves the vectors (Oracle AI Vector Search works here).
- Retriever finds the chunks that match a question.
- Prompt template builds the prompt with variables like {question} and {context}.
- Chat model calls the LLM.
- Output parser turns the reply into clean JSON or a list.
The glue is LCEL, LangChain Expression Language. It joins steps with a pipe, just like Unix: prompt | model | parser.
For agents, add tools (any function, often marked with @tool) and memory (chat history).
LangGraph: when you need loops and branches
LangGraph models an agent as a flowchart:
- Nodes = steps (call LLM, run tool).
- Edges = arrows between steps; conditional edges choose the next step.
- State = shared data passed around.
- Checkpointer = saves progress so you can pause for human approval and resume, much like a restartable patch session.
OpenAI Agents SDK: small and simple
This SDK has only a handful of primitives:
- Agent – name + instructions + tools + model.
- Runner – runs the loop (
run,run_sync,run_streamed). - Function tool – a Python function turned into a tool with
@function_tool. - Handoff – pass control to another agent (triage → billing).
- Guardrails – input/output checks; a tripwire stops the run when triggered.
- Sessions – automatic conversation memory.
- Tracing – built-in log of every LLM call, tool call, and handoff.
It can also use MCP servers as tool sources and call agents as tools.
Remember for the exam
- Text splitter = chunking; retriever = fetching relevant chunks.
- LCEL pipe: prompt | model | parser.
- LangGraph = nodes, edges, state, checkpointer.
- Agents SDK: Agent, Runner, tools, handoffs, guardrails (tripwire), sessions, tracing.
Self-check
- Which LangChain component breaks documents into chunks? (Text splitter)
- Which OpenAI Agents SDK primitive executes the agent loop? (Runner)
- What saves LangGraph state so a run can pause and resume? (Checkpointer)
No comments:
Post a Comment