diff --git a/nodejs/langchain/sample-agent/.env.example b/nodejs/langchain/sample-agent/.env.example index 8e647630..a417a469 100644 --- a/nodejs/langchain/sample-agent/.env.example +++ b/nodejs/langchain/sample-agent/.env.example @@ -28,12 +28,12 @@ USE_AGENTIC_AUTH=false connections__service_connection__settings__clientId= connections__service_connection__settings__clientSecret= connections__service_connection__settings__tenantId= -connections__service_connection__settings__authority= # Set service connection as default connectionsMap__0__serviceUrl=* connectionsMap__0__connection=service_connection # AgenticAuthentication Options +agentic_type=agentic agentic_altBlueprintConnectionName=service_connection agentic_scopes=ea9ffc3e-8a23-4a7d-836d-234d7c7565c1/.default # Prod Agentic scope \ No newline at end of file diff --git a/nodejs/langchain/sample-agent/package.json b/nodejs/langchain/sample-agent/package.json index bdc6f4e5..448e3a5e 100644 --- a/nodejs/langchain/sample-agent/package.json +++ b/nodejs/langchain/sample-agent/package.json @@ -23,9 +23,8 @@ "@langchain/langgraph": "*", "@langchain/mcp-adapters": "*", "@langchain/openai": "*", - "@microsoft/agents-activity": "1.1.0-alpha.58", - "@microsoft/agents-hosting": "1.1.0-alpha.58", - "@microsoft/agents-hosting-express": "1.1.0-alpha.58", + "@microsoft/agents-activity": "^1.1.0-alpha.85", + "@microsoft/agents-hosting": "^1.1.0-alpha.85", "dotenv": "^17.2.3", "express": "^5.1.0", "langchain": "^1.0.1", diff --git a/nodejs/langchain/sample-agent/src/index.ts b/nodejs/langchain/sample-agent/src/index.ts index b83868c5..85bd9eff 100644 --- a/nodejs/langchain/sample-agent/src/index.ts +++ b/nodejs/langchain/sample-agent/src/index.ts @@ -4,36 +4,29 @@ import { configDotenv } from 'dotenv'; configDotenv(); import { AuthConfiguration, authorizeJWT, CloudAdapter, Request } from '@microsoft/agents-hosting'; -import express, { Response } from 'express'; +import express, { Response } from 'express' import { agentApplication } from './agent'; const authConfig: AuthConfiguration = {}; -const adapter = new CloudAdapter(authConfig); -const app = express(); -app.use(express.json()); -app.use(authorizeJWT(authConfig)); +const server = express() +server.use(express.json()) +server.use(authorizeJWT(authConfig)) -app.post('/api/messages', async (req: Request, res: Response) => { - await adapter.process(req, res, async (context) => { - await agentApplication.run(context); - }); -}); +server.post('/api/messages', (req: Request, res: Response) => { + const adapter = agentApplication.adapter as CloudAdapter; + adapter.process(req, res, async (context) => { + await agentApplication.run(context) + }) +}) -const port = process.env.PORT || 3978; -const server = app.listen(port, () => { - console.log(`\nServer listening to port ${port} for appId ${authConfig.clientId} debug ${process.env.DEBUG}`); +const port = process.env.PORT || 3978 +server.listen(port, async () => { + console.log(`\nServer listening to port ${port} for appId ${authConfig.clientId} debug ${process.env.DEBUG}`) }).on('error', async (err) => { console.error(err); process.exit(1); }).on('close', async () => { - console.log('Kairo is shutting down...'); -}); - -process.on('SIGINT', () => { - console.log('Received SIGINT. Shutting down gracefully...'); - server.close(() => { - console.log('Server closed.'); - process.exit(0); - }); + console.log('Server closed'); + process.exit(0); }); \ No newline at end of file