Microsoft.Agents.Hosting.DirectLine.NamedPipes 1.7.123

Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Microsoft.Agents.Hosting.DirectLine.NamedPipes --version 1.7.123
                    
NuGet\Install-Package Microsoft.Agents.Hosting.DirectLine.NamedPipes -Version 1.7.123
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Microsoft.Agents.Hosting.DirectLine.NamedPipes" Version="1.7.123" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Agents.Hosting.DirectLine.NamedPipes" Version="1.7.123" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Agents.Hosting.DirectLine.NamedPipes" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Microsoft.Agents.Hosting.DirectLine.NamedPipes --version 1.7.123
                    
#r "nuget: Microsoft.Agents.Hosting.DirectLine.NamedPipes, 1.7.123"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Microsoft.Agents.Hosting.DirectLine.NamedPipes@1.7.123
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Microsoft.Agents.Hosting.DirectLine.NamedPipes&version=1.7.123
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Agents.Hosting.DirectLine.NamedPipes&version=1.7.123
                    
Install as a Cake Tool

Microsoft.Agents.Hosting.DirectLine.NamedPipes

Named pipe transport for the Microsoft Agents SDK, enabling agents to communicate with DirectLineFlex (Azure App Service sidecar) over named pipes without HTTP roundtrips.

For Azure App Service setup and troubleshooting guidance, see Enable Direct Line App Service extension for a .NET bot. That article targets Bot Framework SDK v4; for Microsoft Agents SDK apps, use AddAgentNamedPipeTransport instead of the Bot Framework UseNamedPipes middleware shown there.

Usage

var builder = WebApplication.CreateBuilder(args);

builder.AddAgent<MyAgent>();
builder.AddAgentNamedPipeTransport(); // default pipe name: "bfv4.pipes"

var app = builder.Build();
app.MapAgentApplicationEndpoints();
app.Run();

How It Works

When deployed in Azure App Service with DirectLineFlex, the agent communicates via a pair of named pipes ({pipeName}.incoming and {pipeName}.outgoing) using the Bot Framework wire protocol (48-byte ASCII framed headers with JSON payloads).

  • Inbound: Activities arrive over the pipe and are dispatched to the agent's turn pipeline via IChannelAdapter.ProcessActivityAsync.
  • Outbound: Reply activities sent via ITurnContext.SendActivityAsync are routed back through the pipe (intercepting urn:botframework:namedpipe:* service URLs).

DirectLineFlex Flow

sequenceDiagram
    participant C as Client
    participant ABS as Azure Bot Service
    participant DLE as DirectLineFlex
    participant Pipe as Named Pipes
    participant Bot as Bot Process

    rect rgba(220, 235, 255, 0.35)
        Note over C,Bot: === INITIALIZATION ===
        DLE->>+ABS: GET /v3/extension (Bearer {ExtensionKey})
        ABS-->>-DLE: {BotId, TokenMakerSecret, BotMessageEndpoint}

        Bot->>Pipe: Create .incoming + .outgoing servers
        DLE->>Pipe: Connect client to both pipes
        Note over DLE,Bot: Pipes established (ib=true, ob=true)
    end

    Note over C,Bot: === TOKEN GENERATION ===
    C->>DLE: POST /.bot/v3/directline/tokens/generate<br/>Authorization: Bearer {DirectLineSecret}
    DLE->>DLE: Validate secret, mint token with TokenMakerSecret
    DLE-->>C: {token, conversationId}

    Note over C,Bot: === WEBSOCKET CONNECTION ===
    C->>DLE: WebSocket CONNECT /.bot/v3/directline/conversations/{id}/stream
    DLE->>DLE: Validate token, create ClientConnection session

    Note over C,Bot: === MESSAGE: CLIENT -> BOT ===
    C->>DLE: WebSocket: Activity{type:"message", text:"Hello"}
    DLE->>DLE: Validate token, store in ActivityStore
    DLE->>Pipe: 'A' frame (requestId) + 'S' frame (Activity JSON)
    Pipe->>Bot: ReadLoop: assemble StreamingRequest
    Bot->>Bot: NamedPipeActivityHandler -> CloudAdapter -> MyAgent.OnTurnAsync()
    Bot->>Pipe: 'B' frame (requestId, 202) - acknowledge receipt

    Note over C,Bot: === MESSAGE: BOT -> CLIENT ===
    Bot->>Bot: turnContext.SendActivityAsync(reply)
    Bot->>Bot: SDK -> PipeRoutingDelegatingHandler -> NamedPipeMessageHandler
    Bot->>Pipe: 'A' frame (newRequestId) + 'S' frame (reply JSON)
    Pipe->>DLE: DirectLineRequestHandler processes reply
    DLE->>DLE: ActivityProcessor -> ClientConnection
    DLE->>C: WebSocket push: ActivitySet{reply}
    DLE->>Pipe: 'B' frame (newRequestId, 200) - acknowledge delivery
    Pipe->>Bot: HandleResponseFrame -> TCS resolves -> SendActivityAsync returns

Configuration

The pipe name defaults to "bfv4.pipes" and can be customized:

builder.AddAgentNamedPipeTransport(pipeName: "my-custom-pipe");

The Bot Framework Direct Line App Service extension configures named pipes with:

Environment.GetEnvironmentVariable("APPSETTING_WEBSITE_SITE_NAME") + ".directline"

The App Service extension deployment expects that pipe name, configure this library with the same value:

var siteName = Environment.GetEnvironmentVariable("APPSETTING_WEBSITE_SITE_NAME");
builder.AddAgentNamedPipeTransport(pipeName: $"{siteName}.directline");

The App Service extension also requires the Direct Line channel to be enabled and the App Service application settings DirectLineExtensionKey and DIRECTLINE_EXTENSION_VERSION to be configured. Enable WebSockets on the App Service, then verify the extension at https://<app-service-name>.azurewebsites.net/.bot; successful pipe connection reports ib: true and ob: true.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.8.16-beta 0 7/31/2026
1.8.14-beta 28 7/30/2026
1.8.12-beta 26 7/30/2026
1.8.3-beta 83 7/24/2026
1.7.123 87 7/28/2026
1.7.119-beta 86 7/22/2026
1.7.111-beta 84 7/21/2026
1.7.108-beta 88 7/19/2026
1.7.88-beta 83 7/16/2026
1.7.79-beta 87 7/15/2026
1.7.70-beta 87 7/15/2026
1.7.25-beta 100 7/3/2026
1.7.20-beta 107 6/30/2026
1.7.16-beta 102 6/27/2026
1.7.12-beta 96 6/26/2026
1.7.6-beta 103 6/24/2026
1.7.4-beta 95 6/19/2026
1.6.150 804 6/18/2026
1.6.146-beta 121 6/18/2026
1.6.139-beta 954 6/16/2026
Loading failed