### Raw Log Output Example (Bash) Source: https://github.com/microsoft/agents/blob/main/samples/python/quickstart/README.md Example of raw log output from the Quickstart Agent sample when using a basic logging configuration. ```bash ======== Running on http://localhost:3978 ======== (Press CTRL+C to quit) Acquiring token using Confidential Client Application. Using cached client credentials for MSAL authentication. Acquiring token using Confidential Client Application. ... ``` -------------------------------- ### Build and Run the Sample Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/named-pipe-agent/README.md Build the sample to install dependencies and then start the agent. The agent will create named pipes and wait for a client connection. ```bash npm run build ``` ```powershell Copy-Item env.TEMPLATE .env # edit if needed npm start ``` -------------------------------- ### Formatted Log Output Example (Bash) Source: https://github.com/microsoft/agents/blob/main/samples/python/quickstart/README.md Example of formatted log output from the Quickstart Agent sample when using a custom formatter for the logging configuration. ```bash ======== Running on http://localhost:3978 ======== (Press CTRL+C to quit) 2025-08-06 09:39:24,539 - microsoft_agents.authentication.msal.msal_auth - INFO - Acquiring token using Confidential Client Application. (msal_auth.py:55) 2025-08-06 09:39:24,658 - microsoft_agents.authentication.msal.msal_auth - INFO - Using cached client credentials for MSAL authentication. (msal_auth.py:117) 2025-08-06 09:39:24,824 - microsoft_agents.authentication.msal.msal_auth - INFO - Acquiring token using Confidential Client Application. (msal_auth.py:55) ... ``` -------------------------------- ### Start the Agent Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/otel/README.md Start the Node.js agent application. This command should be executed from the agent's root directory after all dependencies have been installed. ```bash npm start ``` -------------------------------- ### Start the Sample Application Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/copilotstudio-webchat-react/README.md Execute this command to build the React application and start a development server with hot reload. The application will be accessible at http://localhost:3000. ```bash npm run start ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/microsoft/agents/blob/main/samples/python/agent-framework/README.md Install all required Python packages for the agent framework sample using pip. This command reads from the requirements.txt file. ```bash pip install -r requirements.txt ``` -------------------------------- ### Install Dependencies Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/cards/README.md Install the necessary Node.js packages for the agent. ```bash npm install ``` -------------------------------- ### Run the Agent Source: https://github.com/microsoft/agents/blob/main/samples/python/agent-framework/README.md Start the agent application. The server will be accessible at http://localhost:3978. ```bash python -m src.main ``` -------------------------------- ### Install GitHub Copilot CLI Source: https://github.com/microsoft/agents/blob/main/samples/dotnet/copilot-sdk/README.md Install the GitHub Copilot CLI globally using npm. This is a prerequisite for using the Copilot SDK. ```bash npm install -g @github/copilot ``` -------------------------------- ### Install Agents Playground Source: https://github.com/microsoft/agents/blob/main/samples/dotnet/azure-ai-streaming/README.md Use winget to install the Agents Playground for interacting with your agent. ```bash winget install agentsplayground ``` -------------------------------- ### Install Node.js Dependencies Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/copilot-sdk/README.md Installs the necessary packages for the Node.js Copilot SDK project. Run this command in the project's root directory. ```bash npm install ``` -------------------------------- ### Start Aspire Dashboard with PowerShell Source: https://github.com/microsoft/agents/blob/main/samples/dotnet/otel/README.md An alternative to the Docker command for starting the .NET Aspire Dashboard locally using a provided PowerShell script. ```powershell ./start_dashboard.ps1 ``` -------------------------------- ### Authentication Configuration Example Source: https://github.com/microsoft/agents/blob/main/AgentErrorCodesJS.md An example of a valid authentication configuration object, including client ID, client secret, and tenant ID. Ensure these values are correct for your environment. ```typescript const authConfig = { clientId: 'valid-id', clientSecret: 'valid-secret', tenantId: 'valid-tenant-id' }; ``` -------------------------------- ### Verify Plugin Installation Source: https://github.com/microsoft/agents/blob/main/agent-plugins/README.md Verify that the plugins have been successfully installed and are recognized by your CLI environment. This command lists all installed plugins. ```bash /plugin ``` -------------------------------- ### Program.cs with Custom Routes Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-net/skills/agents-sdk-dotnet/SKILL.md This example demonstrates how to add custom routes, such as a health check endpoint, alongside the standard agent endpoints. It builds upon the basic setup by including an additional `MapGet` call. ```csharp var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); app.MapAgentRootEndpoint(); app.MapAgentApplicationEndpoints(requireAuth: !app.Environment.IsDevelopment()); app.MapGet("/health", () => Results.Json(new { ok = true })); app.Run(); ``` -------------------------------- ### Start Test Tool Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/cards/README.md Launch the Teams App Test Tool to interact with the agent running on localhost:3978. ```bash npm run test-tool ``` -------------------------------- ### Start Agent Application Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-net/skills/agents-sdk-dotnet-debugging/SKILL.md Run your agent application to check for startup errors. Use '--verbosity detailed' for more detailed logs. ```bash dotnet run ``` ```bash dotnet run --verbosity detailed ``` -------------------------------- ### Set Copilot Model and Start Agent Host Source: https://github.com/microsoft/agents/blob/main/samples/dotnet/copilot-sdk/README.md Optionally set a different Copilot model using an environment variable before starting the agent host. This example uses PowerShell. ```powershell $env:COPILOT_MODEL = "gpt-4.1" dotnet run ``` -------------------------------- ### Start Agent in Anonymous Mode Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/quickstart/README.md Build the project and start the agent for anonymous mode. The agent will listen on port 3978. ```bash npm run build npm run start:anon ``` -------------------------------- ### Start Agents Playground Source: https://github.com/microsoft/agents/blob/main/samples/dotnet/azure-ai-streaming/README.md Launch the Agents Playground from your command prompt to access the agent testing interface. ```bash agentsplayground ``` -------------------------------- ### startConversation Activity Example Source: https://github.com/microsoft/agents/blob/main/specs/activity/protocol-activity.md This event activity is sent from the channel to the bot to initiate a new conversation. It activates the Conversation Start system topic. ```json { "type": "event", "name": "startConversation" } ``` -------------------------------- ### Start Agent with OpenTelemetry Import Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/otel/README.md This script starts the agent with OpenTelemetry instrumentation enabled. Ensure the instrumentation file is correctly referenced. ```json "start": "node --env-file .env --import ./dist/instrumentation.js ./dist/agent.js" ``` -------------------------------- ### Install Agents Playground Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-js/skills/agents-sdk-typescript-debugging/SKILL.md Install the Agents Playground globally using npm. This tool acts as a mock connector and channel client for local testing. ```bash npm install -g agentsplayground ``` -------------------------------- ### Configure Agent Start Script Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-js/skills/agents-sdk-typescript-debugging/SKILL.md Ensure your `package.json` start script includes the `--env-file` flag for Node.js (v20+) to load environment variables from a `.env` file. ```json "start": "node --env-file .env ./dist/index.js" ``` -------------------------------- ### Check Node.js Version Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/copilotstudio-client/README.md Verify that Node.js version 20 or higher is installed. This is a prerequisite for running the sample. ```bash node --version ``` -------------------------------- ### BlobStorageConfig Initialization Example Source: https://github.com/microsoft/agents/blob/main/AgentErrorCodes.md Illustrates how to initialize BlobStorageConfig with a connection string and container name. Ensure the connection string and container name are valid. ```python config = BlobStorageConfig(connection_string="...", container_name="...") ``` -------------------------------- ### Configure OAuth for .NET (appsettings.json) Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-sdk-common/skills/agents-sdk-provision/references/oauth-setup.md Example JSON configuration for .NET applications to set up user authorization and specify OAuth handlers. ```json { "AgentApplication": { "UserAuthorization": { "DefaultHandlerName": "graph", "AutoSignin": true, "Handlers": { "graph": { "Settings": { "AzureBotOAuthConnectionName": "GraphOAuthConnection", "Title": "Sign In", "Text": "Please sign in to continue" } } } } } } ``` -------------------------------- ### Install Agents SDK Plugins Source: https://github.com/microsoft/agents/blob/main/agent-plugins/README.md Install specific plugins from the Microsoft Agents SDK marketplace. These plugins provide contextual guidance for different agent development scenarios. ```bash /plugin install agents-sdk-common@microsoft-agents-sdk /plugin install agents-for-js@microsoft-agents-sdk /plugin install agents-for-net@microsoft-agents-sdk ``` -------------------------------- ### Run Local Anonymous Host and Playground Together Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/copilot-sdk/README.md This command starts both the local anonymous host and the playground environment simultaneously, facilitating integrated testing. ```bash npm test ``` -------------------------------- ### Start Application with Debug Logging Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-js/skills/agents-sdk-typescript-debugging/SKILL.md Enable verbose logging for the Agents SDK by setting the DEBUG environment variable. This provides detailed output for troubleshooting. ```bash DEBUG=agents:* npm start ``` ```bash DEBUG=agents:* node ./dist/index.js ``` -------------------------------- ### Minimal Program.cs Setup Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-net/skills/agents-sdk-dotnet/SKILL.md This snippet shows the essential configuration for a .NET application using the Agent SDK, including adding the agent, configuring storage, and setting up authentication and endpoints. Ensure you have the necessary using statements for agent hosting and storage. ```csharp using Microsoft.Agents.Hosting.AspNetCore; using Microsoft.Agents.Storage; var builder = WebApplication.CreateBuilder(args); builder.Services.AddHttpClient(); builder.AddAgent(); builder.Services.AddSingleton(); builder.Services.AddAgentAspNetAuthentication(builder.Configuration); var app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); app.MapAgentRootEndpoint(); app.MapAgentApplicationEndpoints(requireAuth: !app.Environment.IsDevelopment()); app.Run(); ``` -------------------------------- ### Import aiohttp Hosting Source: https://github.com/microsoft/agents/blob/main/samples/python/README.md Import the start_agent_process function for aiohttp-based agent hosting. ```python from microsoft_agents.hosting.aiohttp import start_agent_process ``` -------------------------------- ### Azure CLI Prerequisites Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-sdk-common/skills/agents-sdk-provision/SKILL.md Log in to Azure, set the active subscription, and create a resource group if it doesn't exist. Replace placeholders with your specific values. ```bash az login az account set --subscription "" # Create resource group if needed az group create --name "" --location eastus ``` -------------------------------- ### Start Dungeon Scribe Agent Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/copilot-sdk/README.md Run this command in your terminal to start the agent. Ensure you are in the project directory. ```bash npm start ``` -------------------------------- ### Configure Environment Variables (Option 2) Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/copilotstudio-webchat-react/README.md Use this configuration in `settings.js` for direct connection to Copilot Studio using client ID, tenant ID, and a direct connect URL. ```javascript export const process = { env: { appClientId: 'your-app-client-id-here', tenantId: 'your-tenant-id-here', directConnectUrl: 'your-direct-connect-url-here' } } ``` -------------------------------- ### Manual Express Server Setup Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-js/skills/agents-sdk-typescript/SKILL.md Manually configures an Express server with CloudAdapter and JWT authorization. This option provides more control over the server setup. ```typescript import express, { Response } from 'express' import { Request, CloudAdapter, authorizeJWT, loadAuthConfigFromEnv } from '@microsoft/agents-hosting' const authConfig = loadAuthConfigFromEnv() const adapter = new CloudAdapter(authConfig) const app = express() app.use(express.json()) app.use(authorizeJWT(authConfig)) app.post('/api/messages', async (req: Request, res: Response) => { await adapter.process(req, res, async (context) => await agent.run(context)) }) app.listen(process.env.PORT || 3978) ``` -------------------------------- ### Set up Python Virtual Environment Source: https://github.com/microsoft/agents/blob/main/samples/python/agent-framework/README.md Create and activate a Python virtual environment to manage project dependencies. This ensures a clean and isolated environment for the agent. ```bash python -m venv .venv # Windows .venv\Scripts\activate # macOS/Linux source .venv/bin/activate ``` -------------------------------- ### On-Behalf-Of (OBO) Token Audience Example Source: https://github.com/microsoft/agents/blob/main/AgentErrorCodesJS.md Example of setting the correct scopes for an on-behalf-of token exchange. The token audience must be in a format like 'api://your-app-id/scope'. ```typescript // Token audience should be like: api://your-app-id/scope const scopes = ['api://your-backend-api/.default']; ``` -------------------------------- ### Express Server Setup with startServer() Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-js/skills/agents-sdk-typescript/SKILL.md Uses the `startServer` function to create an Express app and adds a custom health check route. The `startServer` function handles middleware and message routing. ```typescript import { startServer } from '@microsoft/agents-hosting-express' const server = startServer(agent) server.get('/health', (_req, res) => res.json({ ok: true })) ``` -------------------------------- ### Initiate Media Streaming Session (Media.Start) Source: https://github.com/microsoft/agents/blob/main/specs/activity/protocol-activity.md Use this event to start a media streaming session. Ensure it includes a streaminfo entity with streamType set to 'streaming'. ```json { "type": "event", "name": "Media.Start", "valueType": "application/vnd.microsoft.activity.mediastart+json", "value": { "mediaType": "audio", "contentType": "audio/webm" }, "entities": [ { "type": "streaminfo", "streamId": "abc123", "streamType": "streaming", "streamSequence": 1 } ] } ``` -------------------------------- ### String Entity Example Source: https://github.com/microsoft/agents/blob/main/specs/activity/protocol-activity.md Demonstrates the structure of a 'string' entity, which contains a simple string value. ```json { "type": "string", "value": "This is the string value" } ``` -------------------------------- ### Create Environment File Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/cards/README.md Copy the template environment file to create a new .env file for configuration. ```bash cp env.TEMPLATE .env ``` -------------------------------- ### Disable NormalizeMentionsMiddleware Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-net/skills/agents-sdk-dotnet-activityhandler-migration/SKILL.md Remove the NormalizeMentionsMiddleware registration from the adapter setup. Equivalent settings are enabled in appsettings.json. ```csharp // Remove from adapter setup: // adapter.Use(new NormalizeMentionsMiddleware()); ``` -------------------------------- ### Configure OpenTelemetry Providers Source: https://github.com/microsoft/agents/blob/main/samples/dotnet/otel/README.md Call the ConfigureOtelProviders extension method to set up OpenTelemetry signals before the application starts. ```csharp builder.ConfigureOtelProviders(); ``` -------------------------------- ### Start Microsoft Agents Playground Source: https://github.com/microsoft/agents/blob/main/samples/dotnet/Agent Framework/README.md Launch the Agents Playground from the command prompt, specifying the agent's message endpoint. Use the --help flag for a list of available options. ```bash agentsplayground -e http://localhost:3978/api/messages ``` -------------------------------- ### Setup FIC Bot OAuth Connection (AadV2WithFic) Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-sdk-common/skills/agents-sdk-provision/references/oauth-setup.md This comprehensive script sets up an OAuth connection for FIC bots using the AadV2WithFic service provider. It involves retrieving the bot's Managed Service Identity (MSI) principal ID, creating a new OAuth app registration, configuring federated credentials, setting the application ID URI and scope, and finally registering the OAuth connection on the bot. Ensure variables like RESOURCE_GROUP, BOT_NAME, and OAUTH_CONNECTION_NAME are defined. ```bash # 1. Get bot's MSI principal ID MSI_PRINCIPAL_ID=$(az identity show \ --resource-group "$RESOURCE_GROUP" \ --name "$BOT_NAME" \ --query "principalId" --output tsv) MSI_CLIENT_ID=$(az identity show \ --resource-group "$RESOURCE_GROUP" \ --name "$BOT_NAME" \ --query "clientId" --output tsv) # 2. Create OAuth app registration (reuse existing or create new) OAUTH_APP=$(az ad app create \ --display-name "${BOT_NAME}-oauth" --sign-in-audience "AzureADMyOrg" --output json) OAUTH_APP_ID=$(echo $OAUTH_APP | jq -r '.appId') TENANT_ID=$(az account list --query "[?isDefault].tenantId | [0]" --output tsv) # 3. Create federated credential on OAuth app az ad app federated-credential create \ --id "$OAUTH_APP_ID" \ --parameters "{ \"name\": \"agent-oauth\", \"description\": \"OAuth Agent-to-Channel\", \"issuer\": \"https://login.microsoftonline.com/${TENANT_ID}/v2.0\", \"subject\": \"${MSI_PRINCIPAL_ID}\", \"audiences\": [\"api://AzureADTokenExchange\"] }" # 4. Set application ID URI and create the access_as_user scope az ad app update \ --id "$OAUTH_APP_ID" \ --identifier-uris "api://botid-$OAUTH_APP_ID" OAUTH_OBJECT_ID=$(az ad app show --id "$OAUTH_APP_ID" --query id --output tsv) # uuidgen on Linux/macOS/WSL; PowerShell fallback for Windows SCOPE_ID=$(uuidgen 2>/dev/null || powershell -NoProfile -Command "[guid]::NewGuid().ToString()") az rest --method PATCH \ --uri "https://graph.microsoft.com/v1.0/applications/$OAUTH_OBJECT_ID" \ --headers "Content-Type=application/json" \ --body "{ \"api\": { \"oauth2PermissionScopes\": [ { \"id\": \"$SCOPE_ID\", \"adminConsentDescription\": \"Allow the app to access the bot on behalf of the signed-in user.\", \"adminConsentDisplayName\": \"Access the bot as a user\", \"isEnabled\": true, \"type\": \"User\", \"userConsentDescription\": \"Allow this app to access the bot on your behalf.\", \"userConsentDisplayName\": \"Access the bot as a user\", \"value\": \"access_as_user\" } ] } }" # 5. Register OAuth connection on bot az bot authsetting create \ --resource-group "$RESOURCE_GROUP" \ --name "$BOT_NAME" \ --setting-name "$OAUTH_CONNECTION_NAME" \ --client-id "$OAUTH_APP_ID" \ --client-secret "" \ --provider-scope-string "api://${OAUTH_APP_ID}/access_as_user" \ --service "Aadv2WithFic" \ --parameters tenantId="$TENANT_ID" tokenExchangeUrl="api://${OAUTH_APP_ID}" federatedClientId="$MSI_CLIENT_ID" # 6. Add redirect URI to OAuth app registration az ad app update \ --id "$OAUTH_APP_ID" \ --web-redirect-uris "https://token.botframework.com/.auth/web/redirect" ``` -------------------------------- ### Meeting Events Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-net/skills/agents-sdk-dotnet-activityhandler-migration/SKILL.md Map TeamsActivityHandler methods for meeting start, end, and participant changes to TeamsAgentExtension registration. ```APIDOC ## Meeting Events ### OnTeamsMeetingStartAsync - **Description**: Handles the start of a Teams meeting. - **TeamsAgentExtension Registration**: `teams.Meetings.OnStart(handler)` ### OnTeamsMeetingEndAsync - **Description**: Handles the end of a Teams meeting. - **TeamsAgentExtension Registration**: `teams.Meetings.OnEnd(handler)` ### OnTeamsMeetingParticipantsJoinAsync - **Description**: Handles participants joining a Teams meeting. - **TeamsAgentExtension Registration**: `teams.Meetings.OnParticipantsJoin(handler)` ### OnTeamsMeetingParticipantsLeaveAsync - **Description**: Handles participants leaving a Teams meeting. - **TeamsAgentExtension Registration**: `teams.Meetings.OnParticipantsLeave(handler)` ``` -------------------------------- ### Install OpenTelemetry Packages Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-net/skills/agents-sdk-dotnet/SKILL.md Include these NuGet packages to enable OpenTelemetry instrumentation and exporting for your .NET agent application. ```xml ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/microsoft/agents/blob/main/samples/nodejs/copilotstudio-client/README.md Set up the necessary environment variables in the .env file for the Copilot Studio client to connect to your agent. Ensure all required IDs and URLs are correctly populated. ```bash environmentId="" # Environment ID of environment with the CopilotStudio App. schemaName="" # Schema Name of the Copilot to use tenantId="" # Tenant ID of the App Registration used to login, this should be in the same tenant as the Copilot. appClientId="" # App ID of the App Registration used to login, this should be in the same tenant as the CopilotStudio environment. directConnectUrl="" # The URL to connect directly to the Copilot Studio service. When provided, `environmentId` + `schemaName` are ignored. ``` -------------------------------- ### Disable ShowTypingMiddleware Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-net/skills/agents-sdk-dotnet-activityhandler-migration/SKILL.md Remove the ShowTypingMiddleware registration from the adapter setup. The equivalent functionality is enabled via AgentApplication configuration. ```csharp // Remove from adapter setup: // adapter.Use(new ShowTypingMiddleware()); ``` -------------------------------- ### Agent Localhost Running Message Source: https://github.com/microsoft/agents/blob/main/samples/python/auto-signin/README.md This message indicates that the agent has started successfully and is listening for incoming messages on the specified port. ```text ======== Running on http://localhost:3978 ======== ``` -------------------------------- ### Configure Program.cs for Agents SDK Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-for-net/skills/bf-to-agents-sdk-dotnet-migration/SKILL.md Replace BotController.cs and AdapterWithErrorHandler.cs with a new Program.cs file. Register the bot using AddAgent, add IStorage, and configure authentication and endpoints. ```csharp using Microsoft.Agents.Hosting.AspNetCore; using Microsoft.Agents.Storage; using Microsoft.AspNetCore.Builder; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; WebApplicationBuilder builder = WebApplication.CreateBuilder(args); builder.Services.AddHttpClient(); builder.Services.AddControllers(); // Register bot — AddAgent works because ActivityHandler implements IAgent // DO NOT call AddAgentApplicationOptions() — that is only for AgentApplication builder.AddAgent(); // Storage — always required by the Agents SDK builder.Services.AddSingleton(); // Preserve all customer-specific DI registrations: // builder.Services.AddSingleton(); // builder.Services.AddSingleton(); // builder.Services.AddSingleton(); // builder.Services.AddSingleton(); // AddAgentAspNetAuthentication is defined in AspNetExtensions.cs — copy from any Agents SDK sample builder.Services.AddAgentAspNetAuthentication(builder.Configuration); WebApplication app = builder.Build(); app.UseAuthentication(); app.UseAuthorization(); app.MapAgentRootEndpoint(); // ActivityHandler bots use MapAgentEndpoints — NOT MapAgentApplicationEndpoints // MapAgentApplicationEndpoints only works for AgentApplication subclasses app.MapAgentEndpoints(requireAuth: !app.Environment.IsDevelopment()); if (app.Environment.IsDevelopment()) { app.Urls.Add("http://localhost:3978"); } app.Run(); ``` -------------------------------- ### Agent Application Authorization Configuration Source: https://github.com/microsoft/agents/blob/main/AgentErrorCodesJS.md Example of configuring authorization options during the initialization of an AgentApplication. This is necessary to access the Application.authorization property. ```typescript const app = new AgentApplication({ authorization: { // ... authorization config } }); ``` -------------------------------- ### Configure OAuth for Node.js (.env) Source: https://github.com/microsoft/agents/blob/main/agent-plugins/agents-sdk-common/skills/agents-sdk-provision/references/oauth-setup.md Example environment variable configuration for Node.js applications to specify the OAuth connection name. ```dotenv graph_connectionName=GraphOAuthConnection ``` -------------------------------- ### Import Core Hosting Functionality Source: https://github.com/microsoft/agents/blob/main/samples/python/README.md Import the TurnContext class for core agent hosting functionality. ```python from microsoft_agents.hosting.core import TurnContext ``` -------------------------------- ### Configure OpenTelemetry Providers Source: https://github.com/microsoft/agents/blob/main/samples/python/otel/README.md Call this function before the agent starts to set up tracing, metrics, and logging. The service name is a required parameter. ```python from .instrumentation import configure_otel_providers configure_otel_providers(service_name="OTelAgent") ``` -------------------------------- ### Session Initialization Source: https://github.com/microsoft/agents/blob/main/specs/activity/protocol-activity.md Demonstrates the initial handshake for a session, including the client initiating the session and the server responding with session details and readiness state. ```text client → command: session.init server → commandResult: { "status": "success", "sessionId": "SESS-123", "state": "listening" } ```