Index Ai Academy
Glossary · Phase 10 · Agent harnesses

Reducer

Also written: reducers

In an agent graph, the rule for combining a node's update with the value already in the state, such as appending messages or adding up cost.

{state, update} replaces each key a node returns. That's right for a draft, where the new one should win, but wrong for a list of notes or a running cost: the second node's notes would wipe out the first's. A reducer says how to combine the old value with the new one for a particular key: for a list, add them end to end; for a cost, sum them. Keys without a reducer are replaced as before.

Try it now

The router reads the evaluator's verdict from the state; the round counter guarantees the loop ends.

Learn it properly

Agents as graphs · State, reducers and routing, a checkpoint after every step, and pausing for a person's approval. About 40 minutes.

Create a free account See what's in the lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write