learning-it by example

Back to the video

Give Every AI Agent Its Own Identity

Your agents all share one API key. When one overwrites a file, the log cannot say which. Here is the fix.

Video #232 ยท Enterprise architecture and AI agents

Steps in the video

  1. 0:00 Which agent did it?
  2. 0:25 The idea
  3. 0:57 Setup
  4. 1:22 The rules
  5. 1:42 Issuing a token
  6. 1:58 Checking a call
  7. 2:18 The forgeries
  8. 2:31 Seven calls
  9. 3:18 Why not one key?
  10. 3:42 What this does not show
  11. 4:11 Mistakes to avoid
  12. 4:34 My take and next steps
  13. 4:56 Recap

Files

  • cases.py (47 lines)
  • gateway.py (51 lines)
  • shared_key.py (19 lines)

Download the code (zip)

Tested with

Python 3.12.15 | PyJWT==2.15.1

What this does not show

Made-up users, agents and key, and no model. One shared secret signs and checks, so any service that can check a token could also mint one. No key rotation, revocation or token exchange. The shared-key log is printed, not run. A token limits damage; it does not make a tool safe.

Sources

Learning IT by Example.