LangChain blueprint · Software engineering
Pull request review assistant
A LangChain v1 agent built with create_agent reviews each pull request against a repo checklist, using tools to fetch the diff and files, run linters and post review comments. It must never request changes or post a blocking review without a human approving it through HumanInTheLoopMiddleware.
- Steps
- 8
- Subjective questions
- 33
- Objective questions
- 33
The problem and the outcome
Problem: Maintainers spend review time on mechanical issues such as style, missing tests and checklist items, and reviews arrive late or vary in quality. Fully automated bots that block merges without judgement frustrate contributors.
Outcome: Every pull request gets a fast first-pass review with line comments tied to checklist items and linter output. Blocking 'request changes' reviews only go out after a maintainer approves, edits or rejects the agent's draft.
Architecture
How it works, step by step
- A developer opens or pushes to a pull request; the GitHub App webhook verifies the signature and enqueues a job keyed by repo, PR number and head SHA, dropping duplicates and superseding older SHAs.
- A worker starts the create_agent agent with thread_id set to the repo, PR and SHA, and loads the repo's review checklist from the LangGraph store under a namespace such as ("checklists", repo).
- The agent calls diff and file tools, adapted from a GitHub MCP server with MultiServerMCPClient, to read the changed hunks and only the surrounding files it needs.
- The agent calls run_linters, which runs the repo's configured linters in a sandboxed container on the checked-out SHA and returns structured findings.
- The model, created with init_chat_model, walks the checklist item by item and returns a structured review via response_format: findings with file, line, checklist item, severity and suggested fix.
- Non-blocking comments are posted directly, but any call to the request_changes tool is paused by HumanInTheLoopMiddleware (interrupt_on with approve/edit/reject), and the checkpointer persists the paused state.
- The maintainer sees the draft review in a dashboard or Slack and approves, edits the comments, or rejects; the worker resumes the same thread with that decision.
- On approval the post tool submits the review to the GitHub reviews API against the exact head SHA, and the review, decision and reviewer are written to the audit log.
Tech stack
- LangChain v1 create_agent with middleware
- HumanInTheLoopMiddleware for the request_changes tool
- langchain-mcp-adapters MultiServerMCPClient with a GitHub MCP server
- LangGraph Postgres checkpointer and LangGraph store for checklists
- init_chat_model with model fallback and tool retry middleware
- SummarizationMiddleware for large diffs
- Sandboxed container running repo linters (e.g. ruff, eslint)
- GitHub App webhooks plus a job queue
Key design decisions
- Gate only blocking actions (request_changes) behind HumanInTheLoopMiddleware; inline suggestions post freely, so humans review decisions rather than every comment.
- Key the thread and every post to the head SHA, so a new push supersedes stale work and comments never land on outdated lines.
- Run linters as a deterministic tool and let the model explain and prioritise their output, instead of asking the model to spot style issues itself.
- Store checklists per repo in a LangGraph store so teams edit rules as data without redeploying the agent.
- Use response_format for a typed review object so posting, deduplication and audit are code, not prompt parsing.
Common mistakes
- Running HumanInTheLoopMiddleware without a checkpointer means the interrupt cannot be resumed, and the paused review is lost.
- Feeding the whole repo or huge diffs into context; fetch hunks and files on demand and let SummarizationMiddleware trim long histories.
- Treating PR content as instructions: comments or code in the diff can contain prompt injection, so tools must be scoped read-only except the gated post tool.
- Executing untrusted PR code in linters without a sandbox exposes secrets; run on fork PRs with no credentials.
- Posting duplicate comments on every push; deduplicate by file, line and checklist item before posting.
What to measure
- Share of agent comments resolved or accepted versus dismissed by maintainers
- Approval, edit and reject rates on gated request_changes drafts
- Time from PR opened to first review
- False-positive rate on sampled reviews graded against the checklist
- Tokens and cost per reviewed PR
Most-asked interview questions
Subjective questions 33
1Why put a human in the loop only for request changes, and how do you implement it in LangChain v1?Asked almost every time
Blocking a contributor is a high-cost action, while an inline suggestion is cheap to ignore. So I gate the request_changes tool, not every comment. In LangChain v1 I pass HumanInTheLoopMiddleware to create_agent with interrupt_on for that tool and allowed decisions approve, edit and reject. The agent needs a checkpointer, because the interrupt pauses the LangGraph run and persists state on the thread. My worker surfaces the draft to a maintainer, then resumes the same thread_id with their decision. Edit lets them fix wording or drop findings before posting. This keeps humans focused on judgement calls, and the reject rate becomes a direct quality signal for the checklist and prompt.
Sourced from Docs by LangChain (MCP)
2Walk me through the end-to-end architecture of this pull request review assistant.Asked almost every time
A GitHub App webhook receives pull request events, verifies the HMAC signature and enqueues a job keyed by repo, PR number and head SHA. A worker picks up the job and builds a create_agent agent. It uses a model from init_chat_model, GitHub tools adapted from an MCP server via MultiServerMCPClient, a sandboxed run_linters tool, and middleware that includes HumanInTheLoopMiddleware on request_changes. The agent loads the repo checklist from the LangGraph store, reads the diff, runs linters and returns findings through response_format. Non-blocking comments are posted directly. Blocking reviews pause, the checkpointer persists the state, and the review waits for a maintainer decision in a dashboard or Slack. On approval, the review is submitted against the head SHA and written to the audit log.
Sourced from Docs by LangChain (MCP)
3Why do you key jobs by repo, PR number and head SHA, and how do deduplication and supersession work?Asked almost every time
Webhooks are delivered at least once, and developers push in bursts, so the key does two jobs. The same repo, PR and SHA means the same code, so a redelivered event is a duplicate and is dropped. A newer SHA on the same repo and PR makes older jobs obsolete. The queue marks those jobs superseded, and running workers check that flag before posting anything. This keeps cost proportional to distinct commits rather than to events. It also stops a review of stale code from landing after the developer has already pushed a fix. I would enforce the key with a unique constraint in the job store, not only with in-memory checks, so it survives worker restarts and multiple webhook replicas.
Sourced from Docs by LangChain (MCP)
4How do you make posting review comments idempotent when workers retry or crash?Asked almost every time
A worker can crash after GitHub accepts a comment but before we record it, so a retry might post twice. I compute deterministic keys: - per finding, from repo, PR, SHA, file, line and checklist item - per review, from repo, PR, SHA and thread Before posting, the tool checks the audit store for the key. After posting, it records the ID GitHub returns. If the record is missing after a crash, the tool lists existing review comments on the PR and matches a hidden marker embedded in each comment body. This makes the post tool safe under at-least-once execution. That matters because tool retries and resumes from checkpoints can re-run calls.
Sourced from Docs by LangChain (MCP)
5What happens if the developer pushes a new commit while a blocking review is paused waiting for a maintainer?Asked almost every time
The paused review targets an old SHA. Approving it could block the PR over code that has already been fixed. When the newer SHA arrives, the webhook enqueues a new job and marks the old thread superseded. The dashboard or Slack message is updated to show the draft as stale, and the server refuses approve actions for superseded threads. As a final guard, the post tool checks the PR's current head before submitting and refuses if the head has moved. Reviews are also submitted with commit_id set to the reviewed SHA. The new commit gets its own review from scratch, which may re-raise issues that still apply.
Sourced from Docs by LangChain (MCP)
6How would you evaluate whether the review assistant is actually useful?Asked almost every time
Offline, I build a set of historical PRs with known issues and real maintainer comments. I measure precision and recall per checklist item and severity, watching false blocking findings most closely. Online, I track: - approve, edit and reject rates on request_changes - the share of comments resolved versus dismissed I start in shadow mode, generating reviews without posting and comparing them with human reviews. Every prompt, model or checklist change must pass the offline suite before rollout. Tracing each run shows tool calls, tokens and the reasoning path, so bad reviews can be debugged. The headline metric is useful comments per PR, not comment volume.
Sourced from Docs by LangChain (MCP)
7How do you make sure no code path can post a blocking review without human approval?Asked almost every time
HumanInTheLoopMiddleware is the primary gate, but it only covers tools listed in interrupt_on. If the general post tool could submit a review with a blocking event, the model could bypass the gate. So I add defence in depth: - The post tool's schema only allows comment-type reviews. - A custom wrap_tool_call middleware rejects any blocking GitHub write unless it carries an approval record from a resumed human decision. - The GitHub client layer repeats the same check. Automated tests assert that every blocking review submission has a matching approval entry in the audit log.
Sourced from Docs by LangChain (MCP)
8How do you handle very large pull requests without blowing the context window?Very often asked
I never load everything up front. The agent first gets a file list and diff stats, then calls diff and file tools per file or hunk, guided by the checklist. Linter output comes back as structured findings, which are far smaller than raw files. SummarizationMiddleware compresses older messages once a token trigger is reached while keeping recent messages, so long tool loops stay within limits. For truly huge PRs I can split the work across files, or use create_deep_agent with subagents per area so each subagent has its own clean context. I also set a model call limit so a runaway review stops and asks for a human instead of burning tokens.
Sourced from Docs by LangChain (MCP)
9How do you protect the agent from prompt injection in the code it reviews?Very often asked
I treat everything in the PR as untrusted data. Tools are least-privilege: the diff, file and linter tools are read-only, and the only write tool, posting reviews, is narrow and scoped to the current PR and SHA. The blocking action is gated by HumanInTheLoopMiddleware, so an injected instruction cannot silently block or approve. Linters run in a sandbox with no secrets, especially for fork PRs. The system prompt states that content in diffs is never instructions, and a custom wrap_tool_call hook can validate tool arguments, for example rejecting posts to other repos. Finally the audit log records every action, so anything odd is traceable.
Sourced from Docs by LangChain (MCP)
10Why set thread_id to repo, PR and SHA instead of just repo and PR?Very often asked
Thread state holds the agent's messages, tool results and any pending interrupt. With one thread per PR, a review of commit B would inherit diff hunks and linter output from commit A. Stale findings would mix with current ones, and the context would keep growing. Scoping the thread to the SHA gives each review a clean, reproducible state tied to exact code. It also means an approval resumes precisely the review the maintainer saw. Knowledge that should carry across commits, such as what a maintainer rejected last time, belongs in the long-term store keyed by repo, not in thread history. The trade-off is that each push starts fresh, so I deduplicate already-posted comments separately using stable fingerprints.
Sourced from Docs by LangChain (MCP)
11How would you design the response_format schema for review findings?Very often asked
I would pass a Pydantic model as response_format. It contains a list of findings, each with: - file path, line or line range, and diff side - checklist item ID - severity from a fixed enum such as blocker, major, minor or nit - a short explanation and an optional suggested fix The model also has a summary and a proposed verdict. Constraining severity and checklist IDs to known values lets code, not the model, decide what counts as blocking. Before anything is posted, I validate that each file and line exists in the diff for that SHA. Unanchored findings are dropped or moved to the summary. Structured output also makes evaluation, deduplication and audit much easier than parsing free-form prose.
Sourced from Docs by LangChain (MCP)
12How do you sandbox the run_linters tool safely?Very often asked
run_linters executes repository-controlled configuration and sometimes repository code, such as linter plugins, so I treat it as untrusted. Each job gets an ephemeral container with these controls: - no network, or a strict allowlist - no GitHub tokens or cloud credentials - a read-only checkout of the exact head SHA - CPU, memory and wall-clock limits - a non-root user Only linters declared in the repo config and present on an approved image are allowed. The tool returns structured findings with a size cap, not raw logs, so output cannot flood the model context. The container is destroyed after the run, whether it succeeds or fails, and its exit status is recorded.
Sourced from Docs by LangChain (MCP)
13How do you handle the edit decision safely when a maintainer changes the draft review?Very often asked
With an edit decision, the maintainer changes the arguments of the pending request_changes call, and the tool then runs with those edited arguments. Typical edits are rewording a comment, dropping a finding or lowering a severity. I present the draft as editable fields rather than raw JSON. The edited payload is validated against the same schema before resuming: files and lines must exist in the diff, text lengths are capped, and disallowed mentions are stripped. The audit log stores both the original model proposal and the edited version, with the editor's identity. That difference is valuable feedback for tuning prompts and checklists. Invalid edits are rejected in the UI, and the thread is not resumed until they are fixed.
Sourced from Docs by LangChain (MCP)
14How would you estimate capacity and scale this system?Very often asked
I would work from stated assumptions and then measure. Say an organisation produces a few thousand distinct PR commits a day after deduplication, with peaks several times the average during working hours. Each review is a handful of model calls plus one linter container run. Linting is often the slowest step, so worker concurrency is sized by available sandbox containers rather than by LLM calls. Token cost scales with diff size, so I would measure the distribution of changed lines per PR and set per-review budgets. The key metrics are queue depth, time to first comment and cost per review. Checkpointer and store load is modest, roughly a few writes per agent step per thread.
Sourced from Docs by LangChain (MCP)
15How do you keep reviews running during a model provider outage?Very often asked
I configure model fallback middleware with an ordered list of alternative models created via init_chat_model. If the primary model fails, the next one is tried. Because output goes through response_format, every fallback must support structured output reliably. Each must also be evaluated on the same review benchmark, because a weaker model raising false blockers is worse than a delayed review. If all models fail, the queue retries the job with backoff. The checkpointer has saved progress, so the job resumes from the last completed step instead of rerunning linters. If it still fails, the worker posts a neutral status note so developers aren't left waiting silently.
Sourced from Docs by LangChain (MCP)
16How do you deal with GitHub API rate limits and transient failures?Very often asked
Tool retry middleware handles transient failures such as timeouts and 5xx responses, using exponential backoff with jitter and a capped number of attempts. Rate limits need more than retries: - The GitHub client respects rate-limit headers and retry-after values. - Workers share a per-installation token bucket, so one busy organisation cannot starve others. Retries are safe only for reads or idempotent writes, which is why posting uses idempotency keys. Non-retryable errors, such as a 404 for a deleted branch or a 422 for an invalid comment position, either go back to the agent as a tool error or fail the job cleanly. They should never be retried blindly.
Sourced from Docs by LangChain (MCP)
17What GitHub App permissions and credential handling would you use?Very often asked
I apply least privilege. The app needs: - read access to contents and pull requests - write access to pull request reviews and comments - pull request webhook events It gets no admin, workflow or settings permissions. Installation tokens are short-lived, minted per job and scoped to the target repository where possible. Tokens live only in the worker process. They never appear in the model context, prompts, traces or the linter sandbox. The webhook secret and the app's private key are kept in a secrets manager and rotated. The agent reaches GitHub only through its tools, and each tool enforces which operations it may perform, regardless of what the model asks.
Sourced from Docs by LangChain (MCP)
18How do you protect secrets and personal data that appear in diffs?Very often asked
Diffs sometimes contain leaked credentials or personal data. Sending them to an external model or echoing them in a comment is a real exposure. I run a secret scanner over the diff before the model sees it. Matches are replaced with placeholders, and the leak is raised as its own finding routed to the security team. PIIMiddleware can redact or mask emails, phone numbers and similar patterns in model inputs, and block outputs that would post them. Repositories whose policy forbids external model providers can be routed to an approved provider or excluded. Logs and traces get the same redaction, and diff content is kept only for a short retention period.
Sourced from Docs by LangChain (MCP)
19How do you make sure findings land on the correct lines in the GitHub diff?Very often asked
Models often get line numbers wrong, and GitHub inline comments must anchor to lines present in the diff for that commit. I give the model hunks annotated with explicit new-file line numbers and require file and line in the structured output. Then code validates each finding deterministically against the parsed diff. If a line falls outside every hunk, I try snapping it to the nearest changed line in the same hunk. Otherwise the finding moves into the review summary. Comments are submitted with the reviewed SHA as the commit ID and the correct diff side, so they stay attached properly as the PR evolves.
Sourced from Docs by LangChain (MCP)
20How do you keep the bot from flooding PRs with noisy comments?Very often asked
Developers ignore a noisy bot, so I use several controls: - a per-repo severity threshold for inline comments - merging duplicate instances of an issue into one comment - capping inline comments per review and summarising the rest - suppressing issues linters already report, unless the agent adds real context Across pushes, new findings are compared with those already posted on earlier SHAs using a stable fingerprint, and unchanged issues are not reposted. Checklist items that maintainers consistently dismiss are down-weighted through long-term memory. I track the dismissed-comment rate per checklist item and tune the checklist before touching the prompt.
Sourced from Docs by LangChain (MCP)
21How do you verify that the person approving in Slack or the dashboard is allowed to?Very often asked
Resuming with a decision is a privileged action. The dashboard authenticates users. Slack interactions are verified with Slack's request signing, and Slack users are mapped to GitHub identities. At the moment of decision, the server checks that the person has maintainer or write rights on that repository, using GitHub permissions as the source of truth. The decision is bound to the thread ID and SHA, created server-side and single-use, so it cannot be replayed onto another PR. Organisations can also forbid PR authors from deciding on reviews of their own changes. Every decision records the verified identity in the audit log.
Sourced from Docs by LangChain (MCP)
22How would you roll this out safely to an engineering organisation?Very often asked
I roll out in stages: 1. Shadow mode on a few volunteer repositories. The agent runs fully but writes only to the dashboard, and maintainers rate the findings. 2. Non-blocking comments enabled. 3. The request_changes path enabled, behind human approval. Each stage is controlled by a per-repo feature flag. New models, prompts or checklists go through an offline regression suite, then a canary on a subset of repositories, comparing approve and reject rates. A kill switch disables all posting instantly. Integration tests run against a test GitHub organisation, so production repositories are never used for experiments.
Sourced from Docs by LangChain (MCP)
23How do you handle pull requests from forks or first-time contributors?Very often asked
Fork PRs are untrusted code and untrusted text. The linter sandbox already assumes hostile code, but for forks I tighten it further: no network, no repo-specific secrets and possibly a reduced linter set. The checklist and agent configuration are loaded from the store or the base branch, never from the fork, so a PR cannot rewrite its own review rules. Posting always uses our app's installation token. Nothing supplied by the fork is used as a credential. To limit abuse and cost, maintainers can require a label or approval before the assistant reviews a first-time contributor's PR.
Sourced from Docs by LangChain (MCP)
24Why use a GitHub MCP server through the MCP adapters rather than writing your own GitHub tools?Often asked
A GitHub MCP server accessed through MultiServerMCPClient gives the agent ready-made tools for diffs, file contents and comments. These are exposed as ordinary LangChain tools, so middleware such as tool retry and human-in-the-loop applies to them unchanged, and other teams can reuse the same server. The trade-off is less control. MCP servers can expose far more tools than you need, including write operations. I would filter the loaded tools to a small read-only allowlist. Write actions like posting comments and request_changes stay as my own wrapped tools, so I control idempotency and policy. I would also pin the server version so tool schemas don't drift.
Sourced from Docs by LangChain (MCP)
25What should the agent do after a maintainer rejects a request_changes call?Often asked
On reject, request_changes does not run. The agent receives the rejection, optionally with the maintainer's reason, as feedback. I set the follow-up in policy rather than leaving it to the model. Usually the agent may either post the findings as non-blocking comments or a summary, or end with no review. It must not try another blocking path. A model call limit stops it looping on alternatives. The rejection and reason are written to the audit log. Repeated rejections of the same checklist item are recorded in the long-term store, so future reviews treat that item more cautiously.
Sourced from Docs by LangChain (MCP)
26Why add a model call limit, and what happens when a review hits it?Often asked
Agent loops can run away. The model may keep requesting files, re-running linters or retrying after a rejection. The model call limit middleware caps model calls per run or thread, which puts a hard ceiling on cost and latency per review. When the cap is hit, I end gracefully: the agent posts whatever validated findings exist as a partial summary, clearly marked incomplete, instead of discarding the work. I pair the cap with tool-level rules, such as running run_linters once per SHA, and a token budget scaled to diff size. Tracking how often reviews hit the cap shows whether the limit or the prompts need adjusting.
Sourced from Docs by LangChain (MCP)
27What would the audit log data model look like?Often asked
Each record captures: - repo, PR number, head SHA and thread ID - checklist version and the model actually used, including any fallback - the proposed review payload and the human decision type - the edited payload, if any, and the decider's identity and timestamp - the review ID GitHub returns Records are append-only and stored with restricted write access, so nobody can quietly rewrite an approval. I index by repo and PR for investigations and by reviewer for accountability. Keeping the proposal and the final version separately makes edit and rejection rates easy to measure. Personal data is minimised, and retention follows the organisation's policy.
Sourced from Docs by LangChain (MCP)
28How could the agent learn from maintainer feedback over time?Often asked
The LangGraph store persists across threads. Alongside checklists under ("checklists", repo), I would keep a namespace such as ("review_feedback", repo). Its documents capture rejected or edited findings: the checklist item, the code pattern and the maintainer's reason. When a review starts, the worker loads relevant feedback, optionally using the store's semantic search, and adds it to the system prompt. Writes are controlled. Feedback is recorded only from explicit maintainer decisions, never from the model's self-assessment. It also stays visible and reviewable, so one hasty rejection cannot silently disable a checklist item for the whole repository.
Sourced from Docs by LangChain (MCP)
29When would you use create_deep_agent instead of create_agent for this workflow?Often asked
create_deep_agent pre-assembles filesystem access, summarization, subagents and prompt caching, which suits long, multi-step tasks. For most PRs, create_agent with a few tools and explicitly chosen middleware is simpler, cheaper and easier to audit, because I know exactly what runs. I would consider a deep agent for very large or cross-cutting PRs. There, delegating modules to subagents and keeping working notes in a filesystem genuinely helps. Whichever I choose, the human approval gate on request_changes must be configured and tested explicitly. I would not assume any preset provides it.
Sourced from Docs by LangChain (MCP)
30How do you version checklists so a review is consistent with what the maintainer approves?Often asked
Checklists change, and a paused review might be resumed after someone edits one. I store checklists in the LangGraph store with a version field. When a review starts, the version used is recorded in thread state and in the audit log. A resumed review keeps the version it started with, so the maintainer approves exactly what was checked. Checklist changes go through review, ideally sourced from a file in the repository that is synced to the store, which gives history and ownership. When evaluation shows a regression, it can be traced to a specific checklist version.
Sourced from Docs by LangChain (MCP)
31How do you isolate data between repositories and organisations?Often asked
Isolation comes from these measures: - Store namespaces include organisation and repo, and thread IDs include the repo. - Store reads are scoped by the installation the job came from, never by values the model supplies. - Installation tokens only cover that installation's repositories. - Linter sandboxes are per job, with no shared volumes. - Queues use fair scheduling per installation, so one large monorepo cannot starve others. - Model provider choice can differ per tenant where data-handling rules require it. Dashboards and audit views filter results by the viewer's own GitHub permissions.
Sourced from Docs by LangChain (MCP)
32What do you do with paused reviews that nobody approves or rejects?Often asked
Interrupted threads can wait forever. I set a per-repo response window: the system sends a Slack reminder, then expires the review. On expiry, the worker resumes the thread with a reject decision, recorded as expired rather than as a human choice. The agent then posts the findings as non-blocking comments instead. Supersession by a newer SHA also expires a review. The dashboard shows how long each review has been pending, so maintainers can triage. Checkpoint data for expired threads is cleaned up according to the retention policy. The system must never auto-approve on timeout, because that would break the human approval rule.
Sourced from Docs by LangChain (MCP)
33What levers do you have to control LLM cost per review?Often asked
The main levers are: - Send only relevant hunks and the surrounding files actually needed. - Use SummarizationMiddleware to compress older messages once history passes a token threshold. - Use the LLM tool selector so the model sees only relevant tools. - Cap model calls per review. - Route docs-only or trivial PRs to a cheaper model, or rely on linters alone. - Drop superseded SHAs before any model call. Prompt caching helps where the provider supports it, because the system prompt and checklist are stable across reviews. I track cost per review and per repository so expensive outliers show up quickly.
Sourced from Docs by LangChain (MCP)
Objective questions 33
1Which LangChain v1 component pauses the agent before the request_changes tool runs so a maintainer can approve, edit or reject?Asked almost every time
Why: HumanInTheLoopMiddleware interrupts on configured tools and offers approve, edit and reject decisions before the tool executes.
Sourced from Docs by LangChain (MCP)
2How should the webhook handler confirm that an incoming event really came from GitHub?Asked almost every time
Why: GitHub signs webhook payloads with the shared secret. Verifying the HMAC over the raw body is the reliable authenticity check, and headers or names can be spoofed.
Sourced from Docs by LangChain (MCP)
3How does the agent return findings with file, line, checklist item, severity and suggested fix as validated data?Asked almost every time
Why: response_format gives structured output that matches a defined schema, so downstream code can validate and post the findings reliably.
Sourced from Docs by LangChain (MCP)
4Which decisions can be configured for request_changes in HumanInTheLoopMiddleware's interrupt_on?Asked almost every time
Why: interrupt_on is configured per tool, with allowed decisions chosen from approve, edit and reject.
Sourced from Docs by LangChain (MCP)
5What is required for a paused human-in-the-loop review to be resumed later on the same PR thread?Very often asked
Why: Short-term state is thread-scoped through the checkpointer, which persists the interrupted run so it can resume with the human's decision.
Sourced from Docs by LangChain (MCP)
6Which function builds this agent in LangChain v1 Python?Very often asked
Why: LangChain v1 builds agents with create_agent (createAgent in JS) from a model, tools and an optional system prompt, running on LangGraph.
Sourced from Docs by LangChain (MCP)
7What role does MultiServerMCPClient play in this workflow?Very often asked
Why: The LangChain MCP adapters, including MultiServerMCPClient, expose MCP server tools as LangChain tools.
Sourced from Docs by LangChain (MCP)
8What identifies a duplicate review job in this design?Very often asked
Why: Jobs are keyed by repo, PR number and head SHA, so redelivered events for the same code are dropped.
Sourced from Docs by LangChain (MCP)
9A developer pushes a new commit while an older SHA's job is still queued. What should happen to the older job?Very often asked
Why: Newer SHAs supersede older ones, which prevents stale reviews of code that has already changed.
Sourced from Docs by LangChain (MCP)
10The primary model provider returns errors. Which built-in middleware tries alternative models in order?Very often asked
Why: Model fallback middleware tries the configured fallback models in order when a model call fails.
Sourced from Docs by LangChain (MCP)
11Which custom middleware hook would you use to block any blocking GitHub write that lacks an approval record?Very often asked
Why: wrap_tool_call wraps tool execution, so it can inspect a tool call's arguments and refuse it before it runs.
Sourced from Docs by LangChain (MCP)
12Which strategies does PIIMiddleware support for patterns like emails and phone numbers in diffs?Very often asked
Why: PIIMiddleware can redact, mask or block detected PII such as emails and phone numbers.
Sourced from Docs by LangChain (MCP)
13Why should the review be submitted to the GitHub reviews API with the exact head SHA?Very often asked
Why: Pinning the review to the reviewed commit stops feedback from being attached to newer code the agent never saw.
Sourced from Docs by LangChain (MCP)
14Where does run_linters execute?Very often asked
Why: Linters run in a sandbox on the exact SHA, which isolates untrusted repository code and keeps results reproducible.
Sourced from Docs by LangChain (MCP)
15Which output may the agent post to the PR without human approval?Very often asked
Why: Only non-blocking comments are posted directly. request_changes is paused for maintainer approval.
Sourced from Docs by LangChain (MCP)
16Which checkpointer choice suits production, where approvals can arrive hours later on a different worker?Very often asked
Why: Paused state must survive restarts and be resumable from any worker, which needs durable shared persistence.
Sourced from Docs by LangChain (MCP)
17A worker crashes right after GitHub accepts a comment, and the job is retried. What prevents a duplicate comment?Very often asked
Why: Idempotency keys make the post tool safe under at-least-once execution, because existing posts can be detected before posting again.
Sourced from Docs by LangChain (MCP)
18Where should per-repository review checklists live so they persist across all PR threads?Often asked
Why: LangGraph stores hold long-term JSON documents by namespace and key, shared across threads, unlike thread-scoped checkpointer state.
Sourced from Docs by LangChain (MCP)
19What string format does init_chat_model accept to select the review model?Often asked
Why: init_chat_model takes an identifier like "provider:model", which makes it easy to switch providers or add fallbacks.
Sourced from Docs by LangChain (MCP)
20What is a direct consequence of including the head SHA in thread_id?Often asked
Why: Short-term memory is thread-scoped through the checkpointer, so a new SHA means a new thread and a clean state.
Sourced from Docs by LangChain (MCP)
21Which configuration fits SummarizationMiddleware for long reviews?Often asked
Why: SummarizationMiddleware takes a trigger such as a token threshold and a keep setting such as the number of recent messages to retain.
Sourced from Docs by LangChain (MCP)
22The agent keeps requesting more files and never finishes. Which built-in middleware puts a hard ceiling on this?Often asked
Why: A model call limit caps how many model calls a run can make, which bounds cost and latency.
Sourced from Docs by LangChain (MCP)
23What does the edit decision do for a paused request_changes call?Often asked
Why: Edit means the human changes the pending tool call's arguments before it executes.
Sourced from Docs by LangChain (MCP)
24What happens when the maintainer rejects the paused request_changes call?Often asked
Why: Reject stops the tool call from executing and returns feedback to the agent, which then follows the configured policy.
Sourced from Docs by LangChain (MCP)
25Which fields does the workflow require in the audit log on approval?Often asked
Why: Step 8 writes the review, the decision and the reviewer to the audit log for accountability.
Sourced from Docs by LangChain (MCP)
26For which failure is tool retry middleware most appropriate?Often asked
Why: Tool retry handles transient tool errors. Logic, policy and security failures should not be retried.
Sourced from Docs by LangChain (MCP)
27How are items organised in LangGraph long-term stores?Often asked
Why: LangGraph stores hold JSON documents addressed by namespace and key and can support semantic search.
Sourced from Docs by LangChain (MCP)
28No maintainer responds to a paused blocking review within the allowed window. What is the correct behaviour?Often asked
Why: Blocking reviews require human approval, so a timeout must not approve. It should expire safely and be logged as such.
Sourced from Docs by LangChain (MCP)
29Which hook would you use to inject repo-specific feedback into the messages just before each model call?Sometimes asked
Why: before_model runs ahead of each model invocation and can adjust the state or messages the model will see.
Sourced from Docs by LangChain (MCP)
30The GitHub MCP server exposes many tools. Which built-in middleware narrows them to the relevant ones for each model call?Sometimes asked
Why: The LLM tool selector chooses the relevant subset of tools, which reduces prompt size and the chance of misuse.
Sourced from Docs by LangChain (MCP)
31What is the JavaScript equivalent of create_agent in LangChain v1?Sometimes asked
Why: LangChain v1 exposes create_agent in Python and createAgent in JS.
Sourced from Docs by LangChain (MCP)
32Which capabilities does create_deep_agent pre-assemble?Sometimes asked
Why: Deep Agents pre-assemble filesystem tools, summarization, subagents and prompt caching for long tasks.
Sourced from Docs by LangChain (MCP)
33To retrieve similar past review comments by meaning, which LangChain components would you combine?Sometimes asked
Why: RAG in LangChain is built from document loaders, text splitters, embeddings, vector stores and retrievers.
Sourced from Docs by LangChain (MCP)
Track your progress through every blueprint in your dashboard.
Start learning