Hi everyone,
I’m using createDeepAgent from `deepagents` package. After upgrading LangChain and related packages (like @langchain/core) to the latest versions, I started running into the following error:
Error: Channel "files" already exists with a different type.
This was working fine before the upgrade.
Has anyone else faced this issue after updating LangChain? what’s the recommended way to resolve it?
Any pointers would be appreciated. Thanks!
Hi,
Can you provide the versions of LangChain, LangGraph, and DeepAgents that you are using?
Any code snippet of how you’re invoking would be helpful as well.
langchain - 1.2.6,
deepagents - 1.3.1
@langchain/langgraph - 1.0.7
Code snippet
import { ChatOpenAI } from "@langchain/openai";
import { SubAgent, createDeepAgent } from "deepagents";
import { Tool } from "langchain";
import { getPrompt } from "../../shared/prompt";
import {initializeAsanaSubAgent} from "./sub-agents";
import { createUserInstructionsMiddleware } from "./middleware";
const PROMPT_NAME = "deep-agent";
export async function initializeAgent(
tools: Tool[],
subAgents: SubAgent[],
modelName?: string
): Promise<ReturnType<typeof createDeepAgent>> {
const systemPrompt = await getPrompt(PROMPT_NAME);
const OPENAI_MODEL = process.env.OPENAI_MODEL || modelName || "gpt-4o";
const model = new ChatOpenAI({
model: OPENAI_MODEL,
});
return createDeepAgent({
model,
systemPrompt,
tools,
middleware: [createUserInstructionsMiddleware()],
subagents: subAgents,
});
}
export const agent = (async () => {
const asanaSubAgent = await initializeAsanaSubAgent();
const subAgents = [asanaSubAgent];
return await initializeAgent([], subAgents);
})() as unknown as ReturnType<typeof createDeepAgent>;
subAgent
export async function initializeAsanaSubAgent(): Promise<SubAgent> {
const systemPrompt = await getPrompt(PROMPT_NAME);
return {
name: "Asana Sub Agent",
description:
"An agent that handles all Asana operations including fetching sections, tickets, task templates, moving tickets, and creating tasks from templates",
systemPrompt,
tools: ASANA_TOOLS,
};
}
Thanks for reporting @Baba-2001 , mind updating the deepagents package to 1.5.0? This should resolve a bug we have fixed in @langchain/langgraph v1.1.1 (see fix(langgraph): add equals method to channels for semantic comparison by dqbd · Pull Request #1901 · langchain-ai/langgraphjs · GitHub). Let me know if you still experience the issue after updating.