TAI BUI
Back to curriculum
LearnPython

Agent Economies, Token Incentives, Reputation

Long-horizon autonomous agents (METR's 1-hour to 8-hour work curve) need economic agency, and a 5-layer stack is emerging to give it to them: **DePIN** for physical compute, **Identity** (W3C DIDs plus reputation capital), **Cognition** (RAG and MCP), **Settlement** (account abstraction), and **Governance** (Agentic DAOs). Production networks already pay agents for work: **Bittensor** (TAO subnets reward task-specific models), **Fetch.ai / ASI Alliance** (ASI-1 Mini LLM and the FET token), and **Gonka** (transformer-based PoW that points compute at useful AI tasks). The academic side is just as concrete. AAMAS 2025's decentralized LaMAS uses **Shapley-value credit attribution** to reward contributing agents fairly, and Google Research's "Mechanism design for large language models" proposes **token auctions** with second-price payment under monotone aggregation. Here you build a minimal agent marketplace, attribute credit across a three-agent pipeline with Shapley values, and run a second-price auction, so the game theory has something to run on.

TIME: ~75 minutesPREREQUISITES: Phase 16 · 16 (Negotiation and Bargaining), Phase 16 · 09 (Parallel Swarm Networks)

Learning Objectives

  • Explain why equal splits and last-contributor-takes-all fail for joint work, and how Shapley values attribute credit fairly.
  • Compute exact Shapley values for three agents and say when to switch to sampled orderings.
  • Describe how a second-price auction pays the winner and why it is truthful under monotone aggregation.
  • Apply the reputation update rule rep(i, t+1) = alpha * rep(i, t) + (1 - alpha) * contribution_quality(i, t) and predict the effect of alpha.
  • Run main.py and tie its Shapley, auction, and reputation-routing output to the 5-layer stack and the failure modes in the Concept section.

Problem

Multi-agent systems get awkward when agents produce value jointly but have to be rewarded individually. The classical fixes, an equal split or last-contributor-takes-all, are unfair or easy to game. Coalition-based rewarding with Shapley values is fair by construction but expensive to compute. The 2025-2026 literature leans on approximations: Shapley sampling, monotone aggregation auctions, and on-chain reputation that accrues from confirmed contributions.

The field has also moved on to agents that transact for real. Bittensor TAO rewards miners who fine-tune subnet-specific models, Fetch.ai/ASI pays out FET tokens for ASI-1 Mini LLM usage, and Gonka reallocates transformer proof-of-work toward productive AI tasks. Autonomous paying agents exist today, so the open question is how to align their incentives.

I treat agent economies here as three problems: credit attribution, mechanism design, and reputation. Each gets the smallest piece of math that makes it work.

Warm-up0/3
1. Two agents bargain over how to split a reward. What does an agent's reservation value represent?Warm-up
Two people splitting a $100 bonus: Person A will not accept less than $35 and would rather walk away with nothing, Person B is currently offering only $20, with a card asking what the $35 floor represents for Person A.
Dollar figures are illustrative.
2. In a parallel swarm where agents work on independent subtasks at the same time, what must the system still do before it returns a result?Warm-up
A coordinator sending the same job to three workers at once, each finishing its own piece of the result, with a card asking what has to happen to the three pieces before the coordinator returns one answer.
3. You need the average of some quantity over a set of cases far too large to list one by one. Which approach gives a usable estimate?Warm-up
A collection of over 10,000 cases too many to list, next to a random handful pulled from the pile, with a card asking which approach estimates the average without listing every case.
Check: Problem0/2
1. Why is an equal split a weak way to share a joint reward among agents that contributed unequally?Explain
Three agents, alpha doing most of the work, beta a little, and gamma almost none, yet the reward is split evenly at $33.33 each, with a card asking why that even split is a weak rule.
Dollar figures are illustrative.
2. Why is last-contributor-takes-all easy to game as a rule for rewarding joint work?Explain
Three boxes, agent 1 works, agent 2 works, agent 3 adds a small touch (highlighted), with a note that whoever submits last claims the entire reward, and a card asking why that rule is easy to game.

Concept

The 5-layer agent-economy stack

  1. DePIN (physical compute). Decentralized infrastructure that rents GPU, storage, and bandwidth: Bittensor subnets, Render Network, Akash. It isn't agent-specific, but agents use it.
  2. Identity. W3C Decentralized Identifiers (DIDs) give each agent a durable ID independent of any platform, and reputation accrues to the DID. The Agent Network Protocol (ANP) uses DIDs as its discovery layer.
  3. Cognition. The agent's reasoning loop: LLM + RAG + MCP. The other phases build this layer.
  4. Settlement. Account abstraction (ERC-4337) lets agents pay gas from their own balances without holding ETH, so they can pay for services, for each other, or for compute.
  5. Governance. Agentic DAOs, where humans and agents vote on protocol changes and voting power follows reputation.

Few production systems use all five. Bittensor uses layers 1 and 2, part of 3 and part of 4, and none of 5. OpenAI agents use only 3. Treat the stack as a reference map, not a checklist.

Bittensor, Fetch.ai, Gonka: what runs

Bittensor (TAO). Subnets are specialized tasks such as language modeling, image generation, and forecasting. Miners submit model outputs, validators rank them, and stake-weighted scoring distributes the TAO rewards. Each subnet has its own evaluation. The economic lesson is to pay for task-specific output quality, not for compute used.

Fetch.ai / ASI Alliance. The ASI-1 Mini LLM runs on Fetch.ai's network, and users pay FET tokens for inference. The agents-as-peers story is stronger here: an agent on Fetch can call another agent for a task and pay in FET.

Gonka. Transformer proof-of-work, where the "work" is forward passes of a transformer. Miners earn by running inference tasks that have known correct outputs (taken from training data). It is resource-productive PoW in place of hash-based PoW.

All three were production-grade as of April 2026, but they pay out differently. Bittensor rewards quality relative to subnet validators, Fetch rewards utility as measured by paying users, and Gonka rewards verifiable inference work.

Shapley-value credit attribution

Three agents collaborate on a task and the output scores 0.8. Who contributed what?

The Shapley value is the unique credit allocation that satisfies four axioms: efficiency, symmetry, linearity, and null. For agent i:

shapley(i) = (1/N!) * sum over all orderings O of (v(S_i_O ∪ {i}) - v(S_i_O))

where S_i_O is the set of agents before i in ordering O. In practice you enumerate all permutations, record each agent's marginal contribution in each one, and average.

N=3 gives 6 permutations. N=10 gives 3.6M, so at that size you sample orderings instead of enumerating them.

Second-price auction for aggregation

Google Research ("Mechanism design for large language models") proposes second-price token auctions for aggregating LLM outputs. Each of N agents proposes a completion and holds a private value for being selected. The auctioneer picks the highest-value proposal and pays the second-highest value. When aggregation is monotone (value depends on which proposal is chosen, not on how many were bid), the mechanism is truthful: agents bid their true value.

For LLM systems this means you can outsource completions to several agents with different pricing. The auction picks the best one, pays fairly, and gives nobody a reason to misreport.

Reputation capital

A DID-bound reputation score accumulates from confirmed contributions. A simple update rule:

rep(i, t+1) = alpha * rep(i, t) + (1 - alpha) * contribution_quality(i, t)

Keep the decay factor alpha close to 1. Reputation has three useful properties:

  • It's cheap to read for routing decisions ("send hard tasks to high-rep agents").
  • It's expensive to forge, because it accumulates over time and is bound to a DID.
  • It can be slashed: contributions that fail verification subtract from it.

AAMAS 2025 decentralized LaMAS

The LaMAS proposal (AAMAS 2025) combines DID identity, Shapley-value credit attribution, and a simple auction mechanism. Its key claim is that decentralizing the credit attribution step makes the system auditable and resistant to manipulation at a single point.

Where the economics falls apart

  • Price oracle manipulation. If the credit function can be gamed, agents will game it. Every mechanism needs an adversarial test.
  • Sybil attacks. One operator spins up N fake agents to inflate their own contribution. DIDs slow this down without stopping it, and the real mitigation is the cost of forging reputation.
  • Verification cost. Credit attribution is only as fair as its verifier. A cheap verifier (a small LLM) can be gamed, and an expensive one (a human panel) doesn't scale.
  • Regulatory overhang. Agent economies run into financial regulation. As of 2026, Bittensor, Fetch, and Gonka all operate in legal gray areas in some jurisdictions.

When agent economies make sense

  • Open networks with heterogeneous operators. No single team controls all the agents.
  • Verifiable outputs. Without verification, credit attribution is a guess.
  • Long-horizon workflows. One-shot tasks gain nothing from accumulated reputation.
  • Legally viable tokenized payments in your jurisdiction.

Closed corporate systems fall back on simpler allocation: managers assign work and the metrics are internal. The economics literature mostly applies to open networks.

Check: Concept0/18
1. What is DePIN?Define
An agent paying a network of independent providers that rent out GPU time, storage and bandwidth per use in tokens, with a card asking what this kind of network is called.
2. What is a DID in an agent economy?Define
One agent with the same id a7x9 on both Platform A and Platform B, with a note that its reputation score travels with that id rather than with either platform, and a card asking what kind of identifier stays constant across platforms.
Id string is illustrative.
3. What does ERC-4337 account abstraction provide for agents?Define
An agent's account holding only USDC credits paying a service that charges gas in ETH, with a note that the account covers the gas so the agent never holds ETH, and a card asking what lets an account sponsor its own gas.
4. Which four axioms uniquely define the Shapley value?Define
Three generic contributors X, Y and Z splitting illustrative credit of 0.45, 0.35 and 0.20 that sums to the full 1.00 value of their joint task, with a card asking which four properties force a split exactly like this.
Contributors and credit values are illustrative, not the lesson's own game.
5. What is a second-price auction?Define
Three bidders X, Y and Z with illustrative bids of $40, $60 and $25, Y having the top bid, with a note that the mechanism does not charge Y its own $60, and a card asking what it charges the winner instead.
Bidders and amounts are illustrative, not the lesson's own auction.
6. What is reputation capital?Define
A line rising from about 0.3 to 0.72 over five completed jobs for one agent, with a note that the score is bound to the agent's own id and moves gradually, and a card asking what this kind of running score is called.
Score values are illustrative.
7. What is an agentic DAO?Define
A vote on a shared protocol proposal with both human icons and agent icons casting votes weighted by reputation, with a card asking what a voting body shaped like this is called.
8. What do TAO and FET refer to?Define
A Bittensor network box paying miners in TAO next to a Fetch.ai network box paying for inference in FET, with a note that both are network-specific tokens rather than an identity standard or a credit formula, and a card asking what TAO and FET refer to.
9. Why does Shapley attribution average an agent's marginal contribution over every ordering of the agents?Explain
A table of three orderings where the same agent joins first, second and last, with a note that its marginal contribution differs across rows, and a card asking why average over every ordering instead of just one.
10. How many orderings does exact Shapley computation enumerate for N=3, and why does it stop being practical by N=10?Explain
A table of orderings by agent count: 1 for N=1, 2 for N=2, 24 for N=4, 120 for N=5, with N=3 and N=10 left blank, and a card asking to fill in those two rows and why N=10 stops being practical.
11. Why is a second-price (Vickrey) auction truthful under monotone aggregation?Explain
A flow from a bidder's bid to a mechanism that picks a winner to a highlighted box for the price charged marked with a question mark, with a note that the price never depends on the winning bidder's own bid, and a card asking why that makes honest bidding the best strategy.
12. In rep(i, t+1) = alpha * rep(i, t) + (1 - alpha) * contribution_quality(i, t), what does a high alpha imply?Explain
The reputation update rule rep(i, t+1) equals alpha times rep(i, t) plus (1 - alpha) times contribution_quality(i, t), with alpha set close to 1 at 0.95, and a card asking what dominates the new score at that alpha.
13. How do W3C DIDs and ERC-4337 fit into the 5-layer stack?Explain
The 5-layer stack, DePIN, Identity, Cognition, Settlement, Governance, next to a DIDs card and an ERC-4337 card each asking which layer it fits, with a card asking which layer each one belongs to.
14. What does Bittensor's reward design pay miners for?Explain
A flow from miners submitting outputs to validators ranking them to a stake-weighted TAO payout, with a card asking what determines how much TAO each miner gets.
15. Which setting best fits an agent economy?Explain
Setting A where one team owns every agent and managers assign work, next to Setting B with many operators, checkable outputs and work spanning weeks, with a card asking which setting an agent economy is built for.
16. One operator launches 50 fake agents with DIDs that each submit small contributions to inflate its total credit. DIDs alone did not stop it. Which defence does the lesson rely on?Analyze
One operator controlling 50 fake DIDs, each submitting a small contribution, with a note that DIDs alone did not stop the fakes from inflating one operator's total credit, and a card asking which defense the lesson relies on.
17. A network scores contributions with a small LLM grader, and agents learn phrasing that earns top marks whatever the real quality. Which failure mode is this?Analyze
A small LLM grader scoring submissions, agents learning phrasing that scores high regardless of real quality, with a note that the phrasing works whatever the real quality is, and a card asking which failure mode this is.
18. You open a network where outside operators supply completions at different prices, and you want each operator to report its true value. Which mechanism and condition fit?Design
Three outside operators, each with a private value and its own price, proposing completions to an auctioneer that picks one, with a card asking which mechanism and condition keep every operator honest.

Build It

code/main.py implements:

  • shapley_exact(value_fn, agents) computes exact Shapley values by enumerating permutations.
  • shapley_sampled(value_fn, agents, samples, rng) averages marginal contributions over random orderings instead.
  • second_price(bids) is the truthful mechanism: the winner pays the second-highest bid.
  • Reputation keeps a per-agent score with exponential decay and a floor.
  • Demo 1: three agents collaborate, and both exact and sampled Shapley attribute the credit.
  • Demo 2: five agents bid for a task slot, and the second-price auction picks the winner and the payment.
  • Demo 3: 100 rounds of task assignment to agents with different true quality, comparing random routing against reputation-weighted routing after a 50-round warmup.

Run:

python3 code/main.py

Expected output: Shapley values for each agent that sum to the grand-coalition value of 1.0; an auction where agent-c wins and pays 0.82; and reputation-weighted routing that edges out random routing by a few percent (+3.6% with the seed in the file).

Check: Build It0/10
1. In demo_shapley, v({researcher}) = 0.30 and v({coder, researcher}) = 0.85. In the ordering researcher, coder, reviewer, what marginal contribution does shapley_exact record for the coder?Apply
A table with v({researcher}) = 0.30 and v({coder, researcher}) = 0.85 for the ordering researcher then coder then reviewer, with a card asking the coder's marginal contribution when it joins after researcher.
2. demo_shapley's exact values come out near 0.508 for the coder and 0.333 for the researcher, and the grand coalition is worth 1.0. What is the reviewer's exact value?Apply
A table of exact Shapley values, coder 0.508, researcher 0.333, reviewer left as a question mark, with a note that the grand coalition is worth 1.0, and a card asking the reviewer's exact value.
3. demo_auction bids are a 0.82, b 0.60, c 0.95, d 0.45, e 0.77. What does second_price return?Apply
A table of five bidders, agent-a 0.82, agent-b 0.60, agent-c 0.95, agent-d 0.45, agent-e 0.77, with a card asking what second_price(bids) returns.
4. In demo_auction, agent-c withdraws and the other four bids stay the same. What does second_price return now?Apply
The four remaining bidders after agent-c withdraws, agent-a 0.82, agent-b 0.60, agent-d 0.45, agent-e 0.77, with a card asking what second_price(bids) returns now.
5. A Reputation with alpha 0.95 and floor 0.1 holds a score of 1.0 for an agent. After update(agent, 0.5), what is the score?Apply
A Reputation object with alpha 0.95 and floor 0.1, current score 1.0, called with update(agent, quality=0.5), with a card asking the score after this update.
6. A Reputation with alpha 0.5 and floor 0.1 holds a score of 0.15 for an agent. After update(agent, 0.0), what is the score?Apply
A Reputation object with alpha 0.5 and floor 0.1, current score 0.15, called with update(agent, quality=0.0), with a card asking the score after this update.
7. What does second_price return when called with a list holding exactly one bid?Apply
One bid, agent-a at 0.82, going into second_price(bids), with a card asking what the call returns.
8. A shapley_exact run on a game with v(all agents) = 1.0 returns values that sum to 0.93. What does that point to?Analyze
A shapley_exact run on a game whose grand coalition is worth 1.0, with the returned values summing to only 0.93, and a card asking what that shortfall points to.
9. A reader runs demo_auction and says it proves second-price auctions are truthful. What is wrong with that claim?Analyze
A reader's claim that running demo_auction proves second-price auctions are truthful, next to a table of bidders each holding one fixed bid value, with a card asking what is wrong with that claim.
10. Reputation-weighted routing beat random by +3.6% in the demo. A teammate cites that as proof it beats random routing in general. What is the weakness in that claim?Analyze
A real run of main.py showing random routing at 0.627, reputation-weighted routing at 0.650, a +3.6% improvement over 100 tasks with 4 agents and a 50-round warmup, next to a teammate's claim that this proves reputation routing beats random routing in general, with a card asking the weakness in that claim.
Numbers from a real run of code/main.py's demo_reputation_routing() with its fixed seed.

Use It

outputs/skill-economy-designer.md designs a minimal agent economy. It picks the identity layer, the credit attribution mechanism, the payment mechanism, and the reputation rule.

Ship It

Running an agent economy in 2026:

  • Start with reputation, not tokens. Reputation is cheap to implement and useful on its own. Tokens add legal and economic complexity.
  • Verify before you reward. Don't distribute credit without an independent verification step. Self-reported quality invites sybil games.
  • Sample Shapley, don't enumerate it. Draw 100-1000 orderings, because exact enumeration doesn't scale.
  • Cap the decay factor and floor reputation. Unbounded decay wipes out legitimate contributors, while decay that is too slow keeps stale high-rep agents on top.
  • Audit mechanisms adversarially. Red-team the design before you open the network. Every mechanism has a game theory, and you want to find the holes before an attacker does.
Check: Ship It0/5
1. What goes wrong if the reputation decay is too slow?Explain
A line chart where actual quality drops sharply from 0.9 to 0.2 over five tasks while the reputation score barely moves from 0.9 to 0.80, with a card asking what goes wrong when decay is set too slow.
Scores are illustrative.
2. Why does the Ship It section say to start with reputation rather than tokens?Explain
A reputation card described as cheap to add and useful for routing right away, next to a tokens card described as carrying legal exposure and economic design overhead, with a card asking which one the lesson says to build first.
3. What is the main risk of rewarding agents on self-reported quality with no independent check?Explain
An agent grading its own output with the reward following that self-report directly, with a note that nothing outside the agent checks whether the grade is honest, and a card asking the main risk of rewarding agents this way.
4. A pipeline of 12 contributor agents scores each task, and the teams behind the agents dispute their payout shares. Exact Shapley would need 12! (about 479 million) orderings per task. What do you do?Design
A 12-agent pipeline where exact Shapley needs 12 factorial, 479,001,600 orderings per task, with a note that the teams dispute their payout shares, and a card asking what to do with that many orderings.
12! computed directly (Python math.factorial).
5. A startup owns ten agents, wants hard tasks routed to its best performers, and has no plans for tokens. Which design fits?Design
A startup's own 10 agents with no plans to use tokens, wanting hard tasks routed to its best performers, with a card asking which design fits this setup.
Author's Note

I'd run main.py first and look at the Shapley block before touching the auction. The value function in demo_shapley has superadditive pairs, and the exact values still sum to the grand-coalition value of 1.0, so you can see the efficiency axiom hold on real numbers. The sampled run with 200 orderings lands within about 0.005 of each exact value on this three-agent game, which is the argument for sampling once N gets big.

The reputation demo is the part I'd read most skeptically. The Reputation class has a decay factor and a floor, but no slashing, so the slashing described in the Concept section is something you would add yourself. The routing gain is also small, +3.6% over random with the seed in the file, and it comes from one run on four agents with four fixed true qualities. I'd treat it as a sanity check that the update rule routes toward better agents, not as a benchmark.

One more thing to keep in proportion: second_price just sorts the bids and charges the runner-up. It shows the payment rule, not truthfulness, since every bidder in the demo already bids a fixed number. Exercise 4 is where you find out what breaks the guarantee.

Exercises

  1. Run code/main.py. Confirm Shapley values sum to total value (efficiency axiom). Change the value function; do Shapley allocations change in the expected direction?
  2. Implement Shapley sampling (Monte Carlo over K orderings). How does K affect approximation accuracy? Compare to exact for N=4.
  3. Implement a coalition-forming step before the auction: agents can merge into teams and bid as a unit. Which coalitions form? Is the outcome Pareto-better than individual bidding?
  4. Read the Google Research mechanism-design post. Identify one assumption that, if violated, breaks truthfulness. What does that failure mode look like in an LLM setting?
  5. Read the AAMAS 2025 decentralized LaMAS paper. Implement their Shapley step over 10 agents on a synthetic task. How long does exact computation take? How close does sampling get with 100 draws?

Key Terms

TermWhat people sayWhat it actually means
DePIN"Decentralized physical infrastructure"Token-incentivized compute/storage/bandwidth. Bittensor, Akash, Render.
DID"Decentralized identifier"W3C spec for portable IDs. Agent reputation binds to DID, not to a platform.
ERC-4337"Account abstraction"Contract accounts that can sponsor gas, enabling agent payments.
Shapley value"Fair credit attribution"Unique allocation satisfying efficiency, symmetry, linearity, null.
Second-price auction"Vickrey auction"Truthful mechanism: winner pays second-highest bid. Monotone aggregation compatible.
Reputation capital"Accumulated quality score"DID-bound score from confirmed contributions; decays over time.
Agentic DAO"Agents + humans govern"DAO with agent voters as first-class, voting power tied to reputation.
TAO / FET / GPU credits"Token denominations"Bittensor TAO, Fetch.ai FET, various DePIN tokens.

Further Reading

Code

Ships With