# Synchronous vs Background Agents

> What synchronous and background agents are, when each one fits, and what a job that runs alone needs, explained simply for your AI interview.

**In short:** A synchronous agent works while the user waits and answers in the same session. A background agent takes a job, works alone for minutes or hours, and returns the result later. Background agents need saved progress, stop rules and a way to collect results.

AI and LLM interview question Q195, Agents and tool use. Intermediate, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/synchronous-vs-background-agents

## Say it in 30 seconds

A synchronous agent works while the user waits, and the answer comes back in the same session. A background agent takes a job, works on its own for minutes or hours, and the result is collected later. The background kind needs saved progress, stop rules and a human check before risky steps, because nobody watches each step. I use the synchronous kind for live chat and the background kind for big jobs like overnight claims triage.

## Say it in 2 minutes

There are two ways to run an agent. In a synchronous run, the request stays open and the user waits for the answer. A live chat is the typical case: the customer types, the agent looks up the order and replies within a minute, and nobody leaves the screen.

A background run works differently. The job is submitted with its task and its limits, and a job ID comes back at once. The agent keeps working on its own, sometimes for hours. The result is collected later, either by polling the job ID or by a webhook, a message to my system that says it is done. Picture a claims team with 6,000 storm claims to read overnight.

Background is harder, because nobody watches each step. So I save progress after every step, so a crash resumes instead of starting over. I cap the steps and the spend, so a loop cannot run all night. Any risky action, like a payment, waits for a person. And retries must not repeat a side effect, so a retry never sends the same letter twice.

My rule of thumb: if a user is waiting for the answer, go synchronous. If the work is big, can wait and can be checked later, go background, and design it for failure from the first day.

## What are synchronous and background agents, in plain words?

An agent is an AI program that plans its steps and calls tools to finish a task. The question here is how the work gets back to the person who asked for it.

In a synchronous run, the request stays open and you wait for the answer. In a background run, you hand over the job, get a job ID straight away, and come back later for the result.

Think of a bank loan desk. A teller checks your form while you stand at the counter, which is synchronous. A mortgage file sent to the back office, and emailed back two days later, is background. The work is the same kind. What differs is who waits.

In an AI product, a claims assistant that answers an adjuster on a live call is synchronous. A job that reads 6,000 storm claims overnight is background. OpenAI calls the second kind background mode, and Anthropic's batch service uses the same asynchronous idea for plain requests.

- **Synchronous:** The request stays open, and the answer comes back in the same session.
- **Background job:** Work an agent does on its own after you submit it, with the result collected later.
- **Polling:** Asking the job, by its ID, whether it has finished yet.
- **Checkpoint:** A saved copy of progress after a step, so a crash can resume from there.
- **Stopping condition:** A rule that ends a run, such as a maximum number of steps or a spend cap.

## How do the two modes differ?

- **Synchronous: The user waits.** The connection stays open and the answer comes back in the same session. Best for a chat reply or a quick lookup.
- **Background: The job runs alone.** The agent takes the job, works for minutes or hours, and the result is collected later. Best for big, slow work that can wait.
- **The trade-off: Who waits, and how long it runs.** Synchronous keeps the user waiting for the answer. Background allows long work, but nobody is waiting on it, so it needs saved progress and rules.

Anthropic's Agent SDK hosting guide gives examples of long-running agent work. It lists a deep research job that pauses and resumes over hours as one case, next to a customer support agent that loads ticket history across interactions.

*Diagram, Two ways to run an agent: Top: the user asks and waits for the answer in one go. Bottom: the job is submitted, the user leaves, and the result is collected later. Both paths end in a result, and only the waiting differs.*
1. The user asks, and the agent works while the connection stays open.
2. The answer comes back in the same session, so the user never leaves.
3. The job is submitted, and the agent carries on without the user.
4. The result is collected later by job ID, or pushed by a webhook.

Worked example, with made-up numbers. A motor insurer gets 6,000 claims after a storm weekend. Synchronous: an adjuster on a call asks for a summary of the photos and the policy, and gets it back in about 20 seconds. Background: an overnight job reads all 6,000 claims, tags the damage type, drafts the first letter, and lists any claim with a missing photo. By 7am, 5,870 drafts are ready and 130 claims wait on a list for a person.

## What does a background agent need to work?

Nobody watches each step, so the job has to survive a crash, report where it is, and stop on its own. Five parts do that.

1. **Saved progress:** Save a checkpoint after each step. Microsoft's architecture guide makes the same point for long-running work: keep shared state outside the agent's memory. That is what lets a run pick up after a crash.
2. **A way to collect the result:** Poll the job ID until it is done, or receive a webhook (a message the service sends to your system when the job ends). OpenAI's background mode says to poll by ID when webhooks cannot be received.
3. **Stop rules:** Cap the steps, the time and the spend for each job. Anthropic's guide suggests stopping conditions, such as a maximum number of iterations, to maintain control.
4. **A person before risky steps:** Payments, sent letters and deletes wait for a human. Anthropic's guide says agents can pause for human feedback at checkpoints.
5. **Cancel, and safe retries:** The owner can cancel a running job. OpenAI shows a cancel call for a background response that is still running. Make each retry safe, so a retry does not send the same letter twice.

> "Use background mode to run long-running Responses API requests asynchronously, including multi-step agent runs." (OpenAI)
>
> "For orchestrations that span multiple user interactions or long-running tasks, persist shared state externally rather than relying only on in-memory context." (Microsoft)
>
> "Agents can then pause for human feedback at checkpoints or when encountering blockers." (Anthropic)

Two costs to name. Anthropic's guide warns that agents bring higher costs and the chance of errors that build on each other, so one wrong early step can spread. And OpenAI's background mode keeps response data for a while even when storing is switched off, so check where a job's data lives before you use it on sensitive work.

*Diagram, Life of a background job: A job starts with its limits set, and the agent saves progress after each step. It ends with a saved result or a stop at a cap that keeps the partial work, and a risky step can pause it for a person first.*
1. The job starts with its task and its limits already set.
2. When the task is finished, the result is saved for the user.
3. A risky step, like a payment, waits for a person before it runs.
4. A step or spend cap is hit, so the job stops and keeps its partial work.

> **Tip:** Asked how to make a background job safe? Name the parts in order: saved progress, a way to collect results, stop rules, a human check before risky steps, and retries that are safe.

### How would you choose a mode for a real team?

A payments team wants an agent that flags duplicate supplier invoices. Start with one question: does someone wait for the answer? A clerk checking an invoice in front of them needs it now, so that check runs synchronously inside the portal. The nightly sweep of 2 million invoices, which reads the attachments and flags likely duplicates, runs in the background.

The background sweep gets a checkpoint every 1,000 invoices, a spend cap for each night, and a review list that a person works through. The agent alone never pays or blocks a supplier. The numbers are made up, but the shape of the job is real.

1. **Ask who waits:** If a person is waiting, the answer must be synchronous. If nobody waits, the work can move to the background.
2. **Estimate length and cost:** Time the work on a sample and scale it up. A sweep that takes nine hours needs a job that survives the night.
3. **Design the safety:** Checkpoints, caps, a review queue, and no automatic payment.
4. **Test the failure:** Stop the job halfway, then check that it resumes, does not repeat a flag, and still stops at its cap.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] The plain difference: in one mode the user waits, in the other the job runs alone.
- [ ] A real example of each, and the reason for choosing it.
- [ ] Background jobs need saved progress, a way to collect results, cancel, and stop rules.
- [ ] Retries must not repeat an action that changes the outside world, like a sent email or a payment.
- [ ] A person checks risky steps before they run.
- [ ] Cost and data: caps per job, and where the job's data is kept.

**Common traps**

- Trap: "Background agents are just faster synchronous ones." Better: They are a different shape. The job runs alone, so it needs saved progress, a way to collect results and stop rules.
- Trap: "Let it run until it finishes." Better: Set caps on steps, time and spend. A looping agent can run up a large bill all night.
- Trap: "Keep the progress in memory, it is fine." Better: A crash wipes memory. Save a checkpoint after each step so the job resumes where it stopped.

## Can you spot the unsafe job design?

**Spot the unsafe design:** Your claims team wants an agent to re-read 6,000 claims overnight. Which job design is safe?

A. Keep all progress in memory and send the summary when the job ends.
B. Save a checkpoint after each claim, cap the spend, and send risky steps to a person.
C. Let the agent send each approval itself, since the model is confident.
D. Retry every failed claim from the very first claim of the night.

**Answer:** B. Checkpoints let a crash resume where it stopped, the spend cap stops a runaway loop, and a person signs off on risky steps. The other choices lose progress, trust the model with approvals, or repeat work and letters.

**Quick check:** A live chat assistant must answer a customer's refund question before the customer closes the window. Which mode fits?

A. A background job that emails the answer tomorrow
B. A synchronous reply, with the customer waiting
C. An overnight batch with results within 24 hours
D. A background job, checked every hour

**Answer:** B. Someone is waiting in the chat, so the answer must come back in the same session. Background and batch modes trade that wait for later results, which a customer in a live chat will not accept.

## Can you answer these from memory?

**Flash cards**

- **What is a synchronous agent?** The user waits, and the answer comes back in the same session.
- **What is a background agent?** A job the agent works on alone, with the result collected later by polling or webhook.
- **What does a background job need first?** Saved progress, so a crash resumes from the last checkpoint, not the start.
- **Why set step and spend caps?** A stopping condition keeps a looping agent from running all night and running up the bill.
- **Why are retries risky?** A retry can repeat a sent email or a payment unless each side effect is made safe.
- **Who approves risky steps?** A person, before the action runs, for example a payment.

## Likely follow-up questions

- Q194 How do you design stop conditions? https://designervenkat.online/interview/ai/how-do-you-design-stop-conditions
- Q187 How do you control agent cost? https://designervenkat.online/interview/ai/how-do-you-control-agent-cost
- Q190 How do you trace and debug an agent run? https://designervenkat.online/interview/ai/how-do-you-trace-and-debug-an-agent-run
- Q193 When should an agent ask a clarifying question? https://designervenkat.online/interview/ai/when-should-an-agent-ask-a-clarifying-question
- Q198 How do you roll out a new agent version safely? https://designervenkat.online/interview/ai/how-do-you-roll-out-a-new-agent-version-safely

## Learn it in depth

- [AI Agents](https://designervenkat.online/learn/ai-engineering/ai-agents)
- [Agent SDKs](https://designervenkat.online/learn/ai-engineering/agent-sdks)
