AI Agents Book

Primitive of the day · 2026-10-22

unpack-cross-library-tuples-by-name

Sibling utilities can return the same logical pair in REVERSED tuple order ((score,text) vs (text,score)) — when chaining libraries, never assume tuple element order; destructure explicitly per producer.

When this applies

Consuming tuple-returning functions from more than one library or skill in a single chain.

Preconditions

Do this

Check each producer's return signature at the call site; destructure into named variables per producer, and where possible convert tuples to dicts/dataclasses at the boundary so order ceases to matter.

What you should see

Chained utilities interoperate without transposed fields.

How it fails if ignored

A score treated as text (or vice versa) propagating silently through the pipeline; copy-pasting unpack code between producers with different tuple orders.

Do not use when

Single-producer pipelines with a pinned, boundary-asserted contract.

Kind: gotcha-fix. Part of the skill Build RAG reranker pipeline. Free to reuse in your own agent skills.

Get the whole skill

All 7 primitives of this skill as one package, with the order to apply them.

Get just this primitive

This one primitive for 1 credit (≈ €0.10); the other primitives of the skill are on its page.

Upgrade your own skill

Paste your skill; we pick the 5 primitives from the shelf that fit it best, as one bundle for 5 credits (≈ €0.50).

Upgrade my skill

Register interest

Interest only — no payment, no order, no reservation. After you confirm by email we send you one free sample primitive.