-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Problem
The current GCP deployment documentation at https://learn.microsoft.com/en-us/microsoft-agent-365/developer/deploy-agent-gcp#create-project provides a basic Express.js implementation that doesn't properly handle Bot Framework token acquisition and response routing.
The documented sample code uses a simple Express endpoint that returns a reply object directly:
app.post("/api/messages", (req, res) => {
console.log("Received activity:", JSON.stringify(req.body, null, 2));
// Echo activity
const reply = {
type: "message",
text: `You said: ${req.body?.text}`
};
res.status(200).send(reply);
});This approach has led partners (including DBS and others) to implement custom getBotFrameworkToken() functions and manual token management, which is unnecessary and error-prone.
Expected Behavior
The documentation should demonstrate the correct pattern using CloudAdapter from @microsoft/agents-hosting, which handles Bot Framework token acquisition and reply routing automatically.
Recommended Solution
Update the GCP deployment documentation to align with the patterns used in our official samples:
Entry point pattern (from nodejs/openai/sample-agent/src/index.ts):
server.post('/api/messages', (req: Request, res: Response) => {
const adapter = agentApplication.adapter as CloudAdapter;
adapter.process(req, res, async (context) => {
await agentApplication.run(context);
});
});Sending responses (from nodejs/openai/sample-agent/src/agent.ts):
await turnContext.sendActivity(response);Key Points to Include in Documentation
CloudAdapterreads theserviceUrlfrom the incoming activity- It handles Bot Framework token acquisition internally
- It routes replies back to Teams without custom token logic
@microsoft/agents-hostingis platform-agnostic and works on any platform (Azure, GCP, AWS)- No manual token management is required
Impact
- Partners are implementing workarounds with custom token management
- Increased support burden due to incorrect implementation patterns
- Security risks from improper token handling
- Inconsistency between documentation and official samples
Related Resources
- Official samples: https://github.com/microsoft/Agent365-samples
- Correct implementation reference: nodejs/openai/sample-agent
- Current problematic documentation: https://learn.microsoft.com/en-us/microsoft-agent-365/developer/deploy-agent-gcp#create-project
Customer Feedback Source
Multiple partners (DBS, Wajeed Shaikh) have reported following the current documentation and needing to implement custom token management solutions.