Agent Architecture and Orchestration

Agent Architecture and Orchestration

Agent Graph Engineering — Patterns

Agent graph engineering › Patterns

71 of 77 in this book · 2 min read

Put a bounded agent inside a constrained path

Problem. A document assistant needs freedom to search for evidence, but publication must follow a fixed validation and authorization process.

Approach. Make evidence gathering a node with its own tool and cost envelope. Its output is an artifact with provenance, not authority to publish. Follow it with validation and the required review/dispatch boundaries. A failing validator can return issues to the gathering node while decrementing a rework allowance. A denial ends or pauses the path explicitly.

Trade-off. A coarse agent node simplifies the parent graph while concealing internal steps. Preserve the nested run identifier so an unexpected result can still be investigated.

Fan out with an explicit join policy

Problem. Parallel searches return conflicting claims, and whichever branch finishes last becomes the shared answer.

Approach. Each branch writes its own result with source references and completion status. The join reads a known set of branches and declares whether it needs all of them, a quorum, or an explicitly labeled partial set. Merge evidence as assertions with provenance, then resolve disagreements in a separate step. Define cancellation and late-result handling.

Trade-off. Waiting for every branch increases tail latency. Accepting partial results requires making missing coverage visible to the consumer rather than pretending all sources were consulted.

Bind review to a state revision

Problem. A graph resumes after a human approved a draft, but another node changed that draft while it was waiting.

Approach. Record the review decision with the candidate revision or payload digest and reviewer identity. The write edge requires a matching current revision and fresh permission evaluation. A changed payload returns to validation and any required review. Recovering from a lost response uses the operation record; it does not reuse approval to invent another write.

Trade-off. Small edits can require re-review. That inconvenience is preferable to making approval of one artifact authorize an unbounded family of later artifacts.

Check invariants over traces

Problem. Each node passes its unit checks, yet a conditional edge bypasses validation.

Approach. Exercise valid, invalid, missing-input, denied, budget-exhausted, and resumed paths. Assert properties over the sequence and its state: a committed write has a matching validated revision, a terminal run has a classified outcome, and rework consumes allowance. Keep external services controlled when evaluating path logic.

Trade-off. Path enumeration grows with branching. Prioritize invariants and boundary cases over asserting that every successful run follows one exact sequence of model choices.