Skip to content
C.W.K.
Stream
Lesson 01 of 04 · published

Endpoint, Auth, Dialect

~12 min · leg, dialect, auth

Level 0Cold Stick
0 XP0/41 lessons0/14 achievements
0/100 XP to next level100 XP to go0% complete

A Model Is Not a Brand Name

Chat products sell models as personalities. A harness that wants to own its loop has to split the noun. Firebrand calls the split a leg: an endpoint you can reach, an auth source that admits you, and a dialect that turns that vendor's wire into one event contract. The loop asks a leg to stream. It never asks who the vendor is.

That split is why a new brain does not rewrite the engine. You add a module that implements stream(), pick or write a dialect, declare how admission works, and register by kind. The assemble / execute / record path stays still. If adding a vendor required a new if in the loop, the loop was already vendor-owned.

The Dialect Is the Only Translator

One vendor streams a finished tool-call object in a single chunk. Another streams argument string fragments keyed by index. A third uses content-block start / delta / stop. The loop does not learn those shapes. It learns text_delta, tool_call_end(complete=True), and a stop reason that is derived from the wire reason and the blocks that actually arrived. A transport that dies before a terminal event is a cut, not a guess.

The loop is dialect-blind on purpose. If a vendor quirk leaks into the executor, every later vendor pays that tax, and the record stops being comparable across legs.

Admission Class

Not every leg may head a session. Driver-capable legs stream, call tools, and account for usage. Worker-only legs run bounded child tasks. A worker that quietly starts driving is a second loop wearing a disguise. Agent-class legs are a declared exemption: the vendor runtime owns the turn, Firebrand records what it observed, and such a leg never heads a cleanroom.

Code

The only question the loop asks a leg·python
def step(leg, request):
    # request already durable. The leg may not write the record.
    for event in leg.stream(request):
        yield event
    # No vendor name, no SDK type, no 'are we Claude today?' branch.

External links

Exercise

Take two model APIs you have used. Write each as endpoint, auth source, and wire shape. Circle every place your own code currently branches on the vendor name. Those branches are the tax a dialect is supposed to pay once.
Hint
If the branch decides whether a tool may run, it is in the wrong layer.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.