getCurrentTaskInput Error #261

Closed
opened 2026-02-15 18:15:10 -05:00 by yindo · 4 comments
Owner

Originally created by @luizzappa on GitHub (May 19, 2025).

When trying to use the getCurrentTaskInput function to get the task input, the error below is returned:

Error: Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.

My code:

import { Runnable } from "@langchain/core/runnables";
import { getCurrentTaskInput } from "@langchain/langgraph";

export class CustomChain extends Runnable {

  async invoke(input, options) {
     const currentTaskInput = getCurrentTaskInput(); // <-- error here
    // ....
  }
}

Node: v20.17.0
@langchain/langgraph: 0.2.72

Originally created by @luizzappa on GitHub (May 19, 2025). When trying to use the `getCurrentTaskInput` function to get the task input, the error below is returned: **Error: Config not retrievable. This is likely because you are running in an environment without support for AsyncLocalStorage.** My code: ```javscript import { Runnable } from "@langchain/core/runnables"; import { getCurrentTaskInput } from "@langchain/langgraph"; export class CustomChain extends Runnable { async invoke(input, options) { const currentTaskInput = getCurrentTaskInput(); // <-- error here // .... } } ``` Node: v20.17.0 @langchain/langgraph: 0.2.72
yindo closed this issue 2026-02-15 18:15:10 -05:00
Author
Owner

@benjamincburns commented on GitHub (May 20, 2025):

Hmm, it looks like you're creating some Runnable here, but you're not using that Runnable as part of a LangGraph workflow. Is that correct?

getCurrentTaskInput is specifically designed to work from within an executing LangGraph workflow. You can't use it with arbitrary LangChain Runnables (unless you're executing them from with a LangGraph workflow). This is why you had to import this utility function from @langchain/langgraph instead of from some module within @langchain/core. If we'd intended it to work with any arbitrary runnable, it'd be located within @langchain/core - probably somewhere under the runnables module.

Closing, as there's nothing in your original description that indicates that getCurrentTaskInput isn't working as intended. If you are in fact using this from within a LangGraph workflow, please open a new issue with a complete executable Minimal Reproducible Example.

Also if you're new to LangChain and/or LangGraph, I'd recommend you join our community slack, as it's the best place to find help when you're first starting off.

@benjamincburns commented on GitHub (May 20, 2025): Hmm, it looks like you're creating some `Runnable` here, but you're not using that `Runnable` as part of a LangGraph workflow. Is that correct? `getCurrentTaskInput` is specifically designed to work from within an executing LangGraph workflow. You can't use it with arbitrary LangChain `Runnable`s (unless you're executing them from with a LangGraph workflow). This is why you had to import this utility function from `@langchain/langgraph` instead of from some module within `@langchain/core`. If we'd intended it to work with any arbitrary runnable, it'd be located within `@langchain/core` - probably somewhere under the `runnables` module. Closing, as there's nothing in your original description that indicates that `getCurrentTaskInput` isn't working as intended. If you are in fact using this from within a LangGraph workflow, please open a new issue with a complete executable [Minimal Reproducible Example](https://en.wikipedia.org/wiki/Minimal_reproducible_example). Also if you're new to LangChain and/or LangGraph, I'd recommend you [join our community slack](https://www.langchain.com/join-community), as it's the best place to find help when you're first starting off.
Author
Owner

@luizzappa commented on GitHub (May 21, 2025):

@benjamincburns Thanks for the explanation. I’m using this in a workflow, but it's quite deep. I tested placing it directly in a workflow node and it worked. So I understand that the following use case doesn’t work:

LangGraph workflow node ⭢ (invoke) another LangGraph workflow node ⭢ (invoke) ReAct Agent ⭢ (invoke tool) This is the Runnable where I’d like to access the LangGraph state

Using internal APIs, I’m able to access it (example below), but architecturally, is this not supposed to be possible?

export class CustomChain extends Runnable {

  async invoke(input, options) {
     const currentState = options?.configurable?.__pregel_scratchpad?.currentTaskInput;
    // ....
  }
}

@luizzappa commented on GitHub (May 21, 2025): @benjamincburns Thanks for the explanation. I’m using this in a workflow, but it's quite **deep**. I tested placing it directly in a workflow node and it worked. So I understand that the **following use case doesn’t work**: `LangGraph workflow node ⭢ (invoke) another LangGraph workflow node ⭢ (invoke) ReAct Agent ⭢ (invoke tool) This is the Runnable where I’d like to access the LangGraph state` Using internal APIs, I’m able to access it (example below), but architecturally, **is this not supposed to be possible**? ```javascript export class CustomChain extends Runnable { async invoke(input, options) { const currentState = options?.configurable?.__pregel_scratchpad?.currentTaskInput; // .... } } ```
Author
Owner

@benjamincburns commented on GitHub (May 22, 2025):

Reopening this for @dqbd to look at - might be worth making it so getCurrentTaskInput can be passed the current options when one is present so that users who can't get it via ALS don't need to access it via internal API as shown above.

Alternatively, we could consider exposing the current task input in a non-internal field on the options object.

@benjamincburns commented on GitHub (May 22, 2025): Reopening this for @dqbd to look at - might be worth making it so `getCurrentTaskInput` can be passed the current `options` when one is present so that users who can't get it via ALS don't need to access it via internal API as shown above. Alternatively, we could consider exposing the current task input in a non-internal field on the `options` object.
Author
Owner

@dqbd commented on GitHub (May 28, 2025):

Hello @luizzappa! With @langchain/langgraph 0.2.74 you should be able to do the following

async invoke(input, options) {
  const currentTaskInput = getCurrentTaskInput(options); 
}
@dqbd commented on GitHub (May 28, 2025): Hello @luizzappa! With `@langchain/langgraph 0.2.74` you should be able to do the following ```ts async invoke(input, options) { const currentTaskInput = getCurrentTaskInput(options); } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#261