The AgentApplication or ActivityHandler instance to process incoming activities.
OptionalauthConfiguration: AuthConfigurationOptional custom authentication configuration. If not provided, configuration will be loaded from environment variables using loadAuthConfigFromEnv().
This function sets up an Express server with the necessary middleware and routes for handling agent requests. It configures JWT authorization middleware and sets up the message endpoint. The server will listen on the port specified in the PORT environment variable (or 3978 by default) and logs startup information including the SDK version and configured app ID.
import { AgentApplication, TurnState } from '@microsoft/agents-hosting';
import { startServer } from '@microsoft/agents-hosting-express';
const app = new AgentApplication<TurnState>();
app.onMessage('hello', async (context, state) => {
await context.sendActivity('Hello, world!');
});
startServer(app);
Starts an Express server for handling Agent requests.