Building Long-Running Agents with ScaleDown and Deep Agents
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.
Related posts
- Context Management for Deep Agents
LangChain mediumAdeptThe Deep Agents SDK manages long-running agent context with three compression techniques triggered at fractions of the model's context window. Tool results over 20,000 tokens are offloaded to a filesystem and replaced with a path plus a 10-line preview. Old write/edit tool inputs are replaced with file pointers once context passes 85%, and summarization runs as a last resort, producing a structured summary while saving the full history to disk for later retrieval. To evaluate these mechanisms, the team forces compression early (10-25% of the window) to generate more events and uses targeted evals such as needle-in-the-haystack recovery to catch goal drift and lost details.
- Run fast, private agents on-device with LFM2.5-24B-A2B
Hugging Face mediumAdeptLFM2.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. It keeps LFM2's 40-layer hybrid of gated short convolutions and GQA with 64 experts and top-4 routing. The context window grows from 32K to 131K tokens, the vocabulary doubles to 128K, pre-training scales to ~33T tokens, and post-training runs SFT, teacher specialization, two on-policy distillation stages and agentic RL inside harnesses like OpenClaw and Hermes Agent. It leads larger MoEs such as Qwen3.6-35B-A3B on most tool-use and instruction-following benchmarks but trails on knowledge and coding tasks like SWE-Bench Verified. It decodes 184 tok/s on an M5 Max and up to 21K tok/s on a B300, and ships with transformers code and an OpenAI-compatible harness configuration.
- Open Models have crossed a threshold
LangChain mediumAdeptOpen-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. GLM-5 reached 0.64 correctness, MiniMax M2.7 0.57, and Claude Opus 4.6 0.68, across 138 tests covering file ops, tool use, retrieval, memory and summarization. The open models are far cheaper and faster: about $12/day versus $250/day for 10M output tokens, and 0.65s versus 2.56s latency. The eval metrics are defined (correctness, solve rate, step and tool-call ratios), and switching Deep Agents to an open model is a one-line change, with the harness adapting context management and model identity to each model.
- How We Built LangChain’s Paid Media Agent
LangChain mediumAdeptLangChain'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. It runs in a sandboxed microVM. Context is split into layers: a short map-like system prompt, progressively disclosed skills, a company wiki, live tools and deterministic code. Moving calculations into Python and keeping the model for judgment cut a reporting run from 18 minutes and about $3 (3.9M tokens) to 85 seconds, roughly 40x cheaper. Other lessons: merge separate Slack and scheduled graphs into one runtime with per-entry-point capability profiles, and define a source of truth per metric instead of forcing one normalized schema.
- AI Agent Latency 101: How do I speed up my AI agent?
LangChain easyNoviceAI 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. Streaming intermediate steps such as plans, retrieval results or thinking tokens can raise user satisfaction without changing total time, and event-triggered background agents hide latency entirely. General-purpose multi-agent supervisor or swarm setups make many LLM calls, so mixing code with explicitly routed calls reduces them. Smaller models and shorter context speed up individual calls at some cost to accuracy, and guardrail checks, multi-document extraction or multi-model calls can run concurrently.