When This Pattern Applies
Reach for it when the output is contested by nature — someone downstream will check it, dispute it, or pay money based on it:- Rate and invoice audits: is the billed amount what the contract says?
- Reconciliation: do these two systems agree, and by exactly how much do they differ?
- Compliance checks with hard thresholds: pass/fail per rule, with the margin.
- Fees, surcharges, and discounts derived from published tables.
The Pattern
A custom Skill is a package of files: instructions, plus anything they reference — including a script and the reference data it needs. The division of labor:- The Agent (via the AOP): claims the Case, assembles the inputs, runs the engine, records the results, and handles what happens next — escalate, complete, or hand over. All the judgment stays here.
- The Skill script: takes the inputs, looks up the contracted rates or rules from its reference files, computes the expected values, and returns a structured result — expected amount per line, the difference, and a verdict.
Why Not the Alternatives
How to Build It
Write the script first
Develop and test the calculation like any code: feed it known inputs, assert the outputs. If a domain expert can hand you five worked examples, those are your test cases.
Package it as a custom Skill
Follow Creating Custom Skills: instructions that explain when and how to run the script, and its reference data (rate tables, rule lists) as files in the package.
Write the description as a trigger
The Agent decides to load a Skill from its description, so write it like a “use when” sentence: “Use this skill whenever auditing a freight invoice — to compute the exact expected charges for a shipment against the contracted rate cards.” A vague description means the Skill sits unused.
Attach it and slim the AOP
Attach the Skill to each Agent that needs it. The AOP keeps the orchestration steps and the “never compute yourself” rule — and loses every formula.
What You Get
- Determinism. Same Case in, same verdict out — today, next month, and on the Run where someone disputes the result.
- Testability. The engine is a script; you can prove it correct against known examples before any Agent touches it, and re-run those examples after every change.
- A reviewable audit trail. The structured output (expected value per line, difference, verdict) is written to the Case, so a human can check the reasoning without re-deriving it.
When Not To
Keep the model in charge where judgment is the work: categorizing a complaint, drafting a reply in the customer’s language, deciding whether a mismatch is worth escalating, summarizing findings. A script that tries to encode taste or tone fails in stranger ways than a model ever will. The dividing line: if two careful humans would get the same answer with a calculator, script it. If they might reasonably disagree, it’s the Agent’s call — guided by the AOP.Related
Creating Custom Skills
How to package instructions, scripts, and reference files into a Skill.
Skills
How Skills attach to Agents and load during Runs.
Where Knowledge Belongs
AOP, Skills, Files, or Memory — route each piece of knowledge to the right layer.
Queue
The per-Case processing model these engines plug into.