Cannot load 'CompiledSubAgents' from deepagents, and Errors when running deepagents

Hello,

When following documentation, aka Subagents - Docs by LangChain

For some reason when I try to import CompiledSubAgents from deepagents.. (Using CompiledSubAgent example code) TS indicates that member is not available within the module. I confirmed CompiledSubAgent does not exist when opening the module. Is the code yet to be written or is the example incorrect?

Also, when running the default code from Subagents - Docs by LangChain (Using SubAgent example code) I get the following error..

file:///home/runner/workspace/node_modules/langchain/dist/agents/nodes/utils.js:30
throw new Error(Middleware "${middleware.name}" has required state fields that must be initialized:\n${requiredFields}\n\nTo fix this, either:\n1. Provide default values in your middleware's state schema using .default():\n   stateSchema: z.object({\n     myField: z.string().default("default value")\n   })\n\n2. Or make the fields optional using .optional():\n   stateSchema: z.object({\n     myField: z.string().optional()\n   })\n\n3. Or ensure you pass these values when invoking the agent:\n   agent.invoke({\n     messages: [...],\n     ${parseResult.error.issues[0]?.path.join(".")}: "value"\n   }));
^

Error: Middleware “todoListMiddleware” has required state fields that must be initialized:

To fix this, either:

Provide default values in your middleware’s state schema using .default():
stateSchema: z.object({
myField: z.string().default(“default value”)
})

Or make the fields optional using .optional():
stateSchema: z.object({
myField: z.string().optional()
})

Or ensure you pass these values when invoking the agent:
agent.invoke({
messages: […],
: “value”
})
at initializeMiddlewareStates (file:///home/runner/workspace/node_modules/langchain/dist/agents/nodes/utils.js:30:9)
at async #initializeMiddlewareStates (file:///home/runner/workspace/node_modules/langchain/dist/agents/ReactAgent.js:433:25)
at async ReactAgent.invoke (file:///home/runner/workspace/node_modules/langchain/dist/agents/ReactAgent.js:487:28)

Here is my npm dependencies:

“dependencies”: {
@google/genai”: “^1.25.0”,
“langchain/community”: “^1.0.3”,
“langchain/core”: “^1.0.5”,
“langchain/google-genai”: “^1.0.1”,
“langchain/langgraph”: “^1.0.2”,
“langchain/openai”: “^1.1.1”,
“langchain/tavily”: “^1.0.0”,
“tavily/core”: “^0.5.12”,
“types/json-stable-stringify”: “^1.2.0”,
“types/pg”: “^8.15.5”,
“deepagents”: “^1.1.1”,
“dotenv”: “^16.4.5”,
“duck-duck-scrape”: “^2.2.7”,
“install”: “^0.13.0”,
“json-stable-stringify”: “^1.3.0”,
“langchain”: “^1.0.0-alpha.9”,
“npm”: “^11.6.2”,
“nunjucks”: “^3.2.4”,
“pg”: “^8.16.3”,
“tiktoken”: “^1.0.22”,
“zod”: “^3.25.76”
}
(not I had to remove the @ sign from langchain dependencies otherwise it wouldnt let me post this message)