Skip to content

LangChain sample agent fails to build #121

@Alive-Fish

Description

@Alive-Fish

Original issue: OfficeDev/microsoft-365-agents-toolkit#14847

Following the article https://learn.microsoft.com/en-us/microsoft-agent-365/developer/quickstart-nodejs-langchain

Created the LangChain sample from the toolkit samples gallery

npm run build fails with

> langchain-sample@2025.11.6 build
> tsc

src/client.ts:37:3 - error TS2769: No overload matches this call.
  The last overload gave the following error.
    Object literal may only specify known properties, and 'instructions' does not exist in type 'CreateAgentParams<Record<string, any>, undefined, AnyAnnotationRoot, ResponseFormat> & { responseFormat: ResponseFormat; middleware?: readonly AgentMiddleware<...>[] | undefined; }'.

37   instructions: `You are a helpful assistant with access to tools.
     ~~~~~~~~~~~~

  node_modules/langchain/dist/agents/index.d.cts:183:18
    183 declare function createAgent<StructuredResponseFormat extends Record<string, any> = Record<string, any>, StateSchema extends AnyAnnotationRoot | InteropZodObject | undefined = undefined, ContextSchema extends AnyAnnotationRoot | InteropZodObject = AnyAnnotationRoot, const TMiddleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[]>(params: CreateAgentParams<StructuredResponseFormat, StateSchema, ContextSchema, ResponseFormat> & {
                         ~~~~~~~~~~~
    The last overload is declared here.

src/client.ts:73:43 - error TS2554: Expected 5 arguments, but got 4.
                                             ~~~~~~~~~~~~~~~~~~~~~

  node_modules/@microsoft/agents-a365-tooling-extensions-langchain/dist/esm/McpToolRegistrationService.d.ts:19:127
    19     addToolServersToAgent(agent: ReactAgent, authorization: Authorization, authHandlerName: string, turnContext: TurnContext, authToken: string): Promise<ReactAgent>;   
                                                                                                                                     ~~~~~~~~~~~~~~~~~
    An argument for 'authToken' was not provided.


Found 2 errors in the same file, starting at: src/client.ts:37

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions