Skip to main content

Long analyses

Learn how a growing context affects the agent, and keep a long analysis reliable with subagents and handoffs.

How context affects the agent​

The context is everything the agent can see at once: your messages, its replies, and every tool result, including code, logs, and tables. The agent has no separate memory. Your earlier instructions, the wells you excluded, and the results you accepted exist only as text in the context. The model has a fixed context limit, and your AI app shows how much of it the chat uses.

As the context grows:

  • Earlier details get less attention. The agent can miss or misremember an early instruction, a threshold, or a finding, even though the text is still in the context.
  • Quality drops before the limit. The decline is gradual and depends on the model and the task. As a rule of thumb, expect a noticeable drop once the chat uses about 50–70% of the context.
  • Replies slow down. The model reads the whole context for each reply, so a long chat can respond more slowly and use more of your usage limit.

Watch for these signs: the agent repeats a step it already did, asks for information you already gave, or ignores an earlier decision.

Compaction​

When a chat nears the context limit, many AI apps compact it: they replace the earlier conversation with a shorter summary so the chat can continue. The summary loses information:

  • Details can be lost. Exact values, such as QC thresholds, well exclusions, and file paths, might be dropped or paraphrased.
  • Errors can be carried forward. If the summary gets a fact wrong, the agent treats the wrong fact as true for the rest of the chat.
  • Work can repeat. The agent might lose track of what it finished, and run a step again.

Do not rely on compaction for a long analysis. A handoff note that you review keeps the facts you choose.

Use subagents for longer analysis sessions​

A heavy step, such as loading a run or a differential expression comparison, can use a large share of the context on its own. A subagent runs that step outside your chat. A subagent is a separate agent that your agent starts for one task. It works in its own context, and only its short result comes back to your chat.

Two roles describe how to prompt for this:

  • Director: Your chat. It keeps the plan, the well map, and the results you accepted, and decides what to do next. It does not run heavy steps itself.
  • Analyst: A subagent that the director starts for one heavy step. Its code and logs stay in its own context.

The director's context holds only decisions and summaries, so it grows slowly and the chat stays reliable for longer. Not every AI app supports subagents. If yours does not, use a handoff instead.

Tell the agent it is the director, and say which steps go to analysts. Follow these rules:

  • Give the analyst the design. The analyst does not see this chat, so include the run, the wells, and the thresholds in the request.
  • Expect text back. An analyst cannot return a figure or loaded data. Keep decisions, and small plots of features you already picked, in the director.
  • In a sandbox, each analyst uses its own sandbox. Do not give an analyst the director's sandbox ID. Analysts can run comparisons in parallel.

This example prompt makes the chat the director and starts two analysts:

You are the director. Do not run the comparison in this chat.
Start one analyst for Protein and one for 3′ transcriptome. Do not give them this sandbox ID.
Each analyst mounts run Cytos_PlateA_20260312.
Design: DMSO = wells A1, A2, A3. 10 µM drug = wells B1, B3. Exclude B2 and B4.
QC thresholds: <thresholds we accepted>.
Return a short text summary of the results, and save the full results table to the session outputs.

Hand off to a new chat​

Start a new chat when the chat uses about 50–70% of the context, when you see the signs of a long context, or when another person continues the work. Hand off before the AI app compacts the chat.

  1. Tell the agent to save figures, tables, code, and parameters to the session outputs.
  2. Ask for a handoff note.
  3. Start a new chat on Claude Opus 5.5 and higher. Paste the note as the first message, and put the next request under it.
Write a handoff for a new chat. Use this shape:

Organization: <org name>
Run: <run name> (<run id>)
Sandbox ID: <sandbox id>. Reuse it if it is still available. Otherwise, mount the run and load the checkpoint.
Wells: DMSO = <wells>. Drug = <wells>. Excluded: <wells and why>.
Modality and QC thresholds: <modality>, <thresholds>
Packages to install first: <contents or path of requirements-added.txt>
Cells passing QC: <counts per well>
Checkpoint in the Analyses bucket: <path>
Done: QC. Do not rerun it.
Next: compare DMSO and drug.

The new chat gets the note, not the variables from this chat. It can reuse the sandbox, with its loaded data, for up to 7 days after the sandbox was last used. After that, only files saved to the Analyses bucket remain.

See also​