ChatClientPipelineFactory

Helpers & Utilities · AiDotNet.Agentic.Pipeline

Assembles a chat client and its surrounding policy — defaults, retry, telemetry, filters, recording.

For Beginners

You have a model client; this hands you back the same client with the safety features switched on — automatic retries, a time limit, optional monitoring, and optional recording so your run can be replayed later without calling the model again. Configure once with ChatClientOptions and use the returned client exactly as you used the original.

How It Works

One call turns a bare transport into the client a long unattended run needs. The layers are applied in a fixed order, outermost first: telemetry, so one logical call produces one span and one count no matter how many attempts it took; retry, so the caller’s filters see one attempt at a time; then the caller’s own filters; and innermost, the record or replay decorator wrapping the real client. That ordering is deliberate — a replayed answer is served before retry can ever be involved, and a recorded run captures exactly the request the provider saw, after every filter has had its say.

Because retry lives in the pipeline, it applies to every backend: an HTTP connector, an in-process local engine, a bridge to another library. The reference OpenEvolve implementation puts retry inside its OpenAI client alone, and additionally hands the retry count to the provider SDK, so a configured three retries can become sixteen HTTP attempts. Exactly one retry layer is applied here.

Methods

Method Summary
IChatClient<T> Create(IChatClient<T> inner, ChatClientOptions options) Wraps a client in the policy described by the options.