Claude Dynamic Workflows as Choreographed Semantic Behaviors
Traditional workflows use a central controller to manage every step. The controller knows the sequence: classify, call tool, wait, branch, and finish. This works for predictability, but it is rigid.
I use a different approach. My system uses choreographed semantic behaviors. Instead of one controller, agents publish and subscribe to events. One agent does not need to know the whole system. It only needs to know the semantic contract.
This creates a hybrid model:
- IntentGraph defines the macro intention.
- QuarkBehavior defines the smallest semantic unit.
- SubAgents react to events.
- ProofAgents verify correctness.
- HealingAgents repair invalid states.
- BenchmarkAgents measure cost and latency.
- Governor decides if a result is acceptable.
In this model, orchestration handles high-level intent. Choreography handles local adaptation. The orchestrator says what to achieve. The agents discover how to react to events.
I call this semantic routing. When a message arrives, the system classifies the intent. It does not just call a function. It selects a behavior, validates the data, and emits success or error events.
This architecture enables several advanced patterns:
Adversarial Verification After an agent produces an output, another agent tries to prove it is wrong. The adversary acts as an attacker, a compiler, or a malicious user. It does not try to be helpful. It tries to break the candidate.
Generate-and-Filter The system generates multiple solutions. It then runs them through deterministic gates. These gates check schema, types, unit tests, and security policies. Generation is cheap. Acceptance must be strict.
Tournament If no single solution is best, I run a tournament. I generate several competing solutions and score them against a rubric. We compare them on CPU cost, memory use, and safety. A tournament produces a scorecard, not just a winner.
Intent-based Healing Most systems return an error and stop. My system treats an error as a new event. A healing agent subscribes to the error, receives the trace, and attempts to repair the payload. This is a loop of convergence.
The goal is not to avoid errors. The goal is to turn every error into a new semantic behavior. If a failure happens, it means we lack knowledge. We use that failure to create a new rule so the error never happens again.
This turns coding from a guessing game into engineering.
Optional learning community: https://t.me/GyaanSetuAi