LangChain Reference home pageLangChain ReferenceLangChain Reference
  • GitHub
  • Main Docs
Deep Agents
LangChain
LangGraph
Integrations
LangSmith
  • Overview
  • Agent
  • Middleware
  • Backends
  • Sandboxes
  • Skills
  • Subagents
  • Types
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
  • Vitest
⌘I

LangChain Assistant

Ask a question to get started

Enter to send•Shift+Enter new line

Menu

OverviewAgentMiddlewareBackendsSandboxesSkillsSubagentsTypes
Modal
Daytona
Deno
Node VFS
Sandbox Standard Tests
Vitest
Language
Theme
JavaScriptdeepagentsutilsDeferred
Class●Since v1.12

Deferred

A one-shot promise whose settlement is controlled externally.

Use this when one part of a workflow must wait for an event that is owned elsewhere—for example, a queued mutation waiting for the worker that will push it. Deferred is awaitable because it implements PromiseLike, and .promise is available when a concrete Promise is required.

The first call to resolve or reject wins; later calls are ignored. This class deliberately does not provide cancellation, reset, or notification semantics. It models exactly one eventual outcome.

Copy
class Deferred

Constructors

constructor
constructor→ Deferred<T>

Properties

property
promise: Promise<T>

Methods

method
reject
method
resolve
method
then→ Promise<TResult1 | TResult2>

Attaches callbacks for the resolution and/or rejection of the Promise.

View source on GitHub