agent-pipeline

An explanation of how an AI agent processes a request through layers for middleware, extra context, conversation history, and the chat service that communicates with the language model.

In plain words
What is it for?
Use it when adding logging, validation, request transformations, chat history, search context, or other changes to an agent’s processing pipeline.
Why use it?
It makes the agent’s request flow easier to understand, so changes can be placed in the correct layer instead of being added in the wrong part of the system.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/managedcode/dotnet-skills/agent-pipeline
Clone the repo
git clone --depth 1 https://github.com/managedcode/dotnet-skills
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,335 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00017 $0.03335
Opus 5 $0.00009 $0.01667
Sonnet 5 $0.00003 $0.00667
Haiku 4.5 $0.00002 $0.00333

Measured 2d ago against content hash 8dab3050269a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

agent-pipeline scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

catalog/Frameworks/Microsoft-Agent-Framework/skills/microsoft-agent-framework/references/official-docs/concepts/agents/agent-pipeline.md · 399 lines

How it starts

The opening of the file, as written. The whole thing — 399 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent pipeline architecture

Agents in Microsoft Agent Framework use a layered pipeline architecture to process requests. Understanding this architecture helps you customize agent behavior by adding middleware, context providers, or client-level modifications at the appropriate layer.

::: zone pivot="programming-language-csharp"

ChatClientAgent Pipeline

C# Agent Pipeline Architecture

The ChatClientAgent builds a pipeline with three main layers:

  1. Agent middleware - Optional decorators that wrap the agent via .Use() for logging, validation, or transformation
  2. Context layer - Manages chat history (ChatHistoryProvider) and injects additional context (AIContextProviders)
  3. Chat client layer - The IChatClient with optional middleware decorators that handle LLM communication

When you call RunAsync(), your request flows through each layer in sequence.

::: zone-end

::: zone pivot="programming-language-python"

Agent Pipeline

Python Agent Pipeline Architecture

The Agent class builds a pipeline through class composition with two main components:

Agent (outer component):

  1. Agent Middleware + Telemetry - the AgentMiddlewareLayer and AgentTelemetryLayer classes handle middleware invocation and OpenTelemetry instrumentation
  2. RawAgent - Core agent logic that invokes context providers and collects provider-added middleware
  3. Context Providers - Unified context_providers list manages history, additional context, and per-run chat/function middleware

ChatClient (separate and interchangeable component):

  1. FunctionInvocation - Handles tool calling loop, invoking Function Middleware + Telemetry per tool call
  2. Chat Middleware + Telemetry - Optional middleware chain and instrumentation layers, including any chat middleware added by context providers, running per model call
  3. RawChatClient - Provider-specific implementation (Azure OpenAI, OpenAI, Anthropic, etc.) that communicates with the LLM

Read the full file on GitHub · 399 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 399 lines · 17 tokens per session scan A 8dab3050269a

Subscribe to this mod's changes

agent-pipeline is an agent published in the GitHub repository managedcode/dotnet-skills (477 stars, last pushed 2d ago), licensed MIT. It adds 17 tokens to every session and 3,335 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.