---
title: "Building Long-Running Agents with ScaleDown and Deep Agents"
description: "The langchain-scaledown integration offloads context-management decisions in long-running agents (summarizing history, compressing tool results, extracting fields, classifying state) from frontier LLMs to ScaleDown's small, task-specific constrained decoding models, which ScaleDown reports are far faster and cheaper on these narrow tasks."
url: "https://swe.quest/articles/building-long-running-agents-with-scaledown-and-deep-agents-76e2d7318050ea78"
canonical: "https://www.langchain.com/blog/building-long-running-agents-with-scaledown-and-deep-agents"
source: "LangChain"
published: "2026-10-13"
difficulty: "medium"
kind: "Announcement"
reading_minutes: 9
tags: ["ai-agents","llms","python"]
---

# Building Long-Running Agents with ScaleDown and Deep Agents

A post on [LangChain](https://swe.quest/sources/langchain.md), published 2026-10-13, 9 min read, Announcement. Original: [https://www.langchain.com/blog/building-long-running-agents-with-scaledown-and-deep-agents](https://www.langchain.com/blog/building-long-running-agents-with-scaledown-and-deep-agents)

## Summary

The langchain-scaledown integration offloads context-management decisions in long-running agents (summarizing history, compressing tool results, extracting fields, classifying state) from frontier LLMs to ScaleDown's small, task-specific constrained decoding models, which ScaleDown reports are far faster and cheaper on these narrow tasks. It ships middleware for LangChain and Deep Agents. Summarization replaces history past a trigger fraction. Tool compression adds a compression\_query argument that cut a docs page by about 90%. Extraction copies exact values from user messages into agent state. A custom Classify-based circuit breaker can stop looping or drifting runs. ScaleDown calls can also route through the LangSmith LLM Gateway for tracing and spend limits, while open-ended generation stays on a general-purpose model.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [AI agents](https://swe.quest/tags/ai-agents.md) (AI & ML)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)
- [Python](https://swe.quest/tags/python.md) (Languages)

## Prerequisites

- LLM context windows ([easy posts on LLMs](https://swe.quest/tags/llms.md?difficulty=easy))
- LangChain agents ([easy posts on AI agents](https://swe.quest/tags/ai-agents.md?difficulty=easy))
- agent tool calling

## Keywords

ScaleDown, LangChain, Deep Agents, LangSmith, langchain-scaledown, constrained decoding models

## Related posts

- [Context Management for Deep Agents](https://swe.quest/articles/context-management-for-deep-agents-dc1d776470c6aad5.md): LangChain · 2026-10-13 · Medium · 5 min read · AI agents, LLMs, Evaluation
  The Deep Agents SDK manages long-running agent context with three compression techniques triggered at fractions of the model's context window.
- [Run fast, private agents on-device with LFM2.5-24B-A2B](https://swe.quest/articles/run-fast-private-agents-on-device-with-lfm2-5-24b-a2b-52b7fe0729873bfd.md): Hugging Face · 2026-10-13 · Medium · 7 min read · LLMs, AI agents, Model training, Inference & serving, Evaluation
  LFM2.5-24B-A2B is an open-weight 24B-parameter MoE reasoning model with 2B active parameters per token, aimed at running tool-using agents on local hardware.
- [Open Models have crossed a threshold](https://swe.quest/articles/open-models-have-crossed-a-threshold-c54376af892bf600.md): LangChain · 2026-10-13 · Medium · 7 min read · Evaluation, LLMs, AI agents, Cost optimization
  Open-weight models GLM-5 and MiniMax M2.7 now score close to closed frontier models on core agent tasks in LangChain's Deep Agents eval suite.
- [How We Built LangChain’s Paid Media Agent](https://swe.quest/articles/how-we-built-langchain-s-paid-media-agent-c859415582fca684.md): LangChain · 2026-10-29 · Medium · 18 min read · AI agents, LLMs, System design, Ads
  LangChain's Paid Media Agent is a Slack-resident Deep Agent that merges ad-platform data with warehouse pipeline data, produces weekly per-platform PDF reports, answers follow-up questions, and proposes campaign changes for human approval.
- [AI Agent Latency 101: How do I speed up my AI agent?](https://swe.quest/articles/ai-agent-latency-101-how-do-i-speed-up-my-ai-agent-62a7a640683900cd.md): LangChain · 2026-08-26 · Easy · 5 min read · AI agents, Performance engineering, LLMs
  AI agent latency can be cut in five ways: find the bottleneck first (e.g. with per-step tracing and a waterfall view), reduce perceived latency through UX, make fewer LLM calls, make each call faster, and run calls in parallel.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
