← Table of Contents · Page 452 of 868

ORCHESTRATION PATTERNS

Part 4 of 11

THE BLACKBOARD PATTERN The Blackboard pattern is a design in which several agents share one common workspace, like a big whiteboard, and each agent reads from it and writes to it whenever it notices something it can contribute. The name comes from an old picture of a group of experts standing around a blackboard in a classroom, each stepping forward to add a piece to the solution when they see something in their area of expertise. No one is explicitly told when to speak. Instead, the workspace is reactive, meaning changes to it can trigger agents to act. Imagine a team of medical specialists looking at a patient's case file. The radiologist adds notes about the scan. Seeing a suspicious detail, the cardiologist adds her thoughts. Reading both, the pharmacist notices a drug interaction and adds a warning. The case file grows richer as each expert contributes when the content becomes relevant to them. In a harness, the blackboard might be a shared document, a database, or a structured data store. A data-analysis agent writes statistics to it. A visualization agent notices new statistics and creates charts. A narrative agent notices both and drafts an explanation. The strengths are flexibility and the ability to handle problems where nobody can know in advance which expert will be needed next. The weaknesses are the difficulty of predicting what will happen, the risk of agents stepping on each other's work, and the challenge of deciding when the job is actually finished. Because there is no fixed order, debugging can be harder, and you need good logs and clear rules about who may change what, a topic we expand in Chapter 44 on shared state.
Advertisement
Read Aloud:
0:00 / 0:00