Agent design

Agents that act on records under policy

Two reference agents I built, for card disputes and HR leave.

Examples Fictional data throughout

In financial services and HR, a request ends in a record.

Many support conversations end with an answer or a handoff to a person. A dispute or a leave request ends with something written to a company system, so the agent has to read the person’s own records, apply the company’s policy, and only then write.

Answering a question, and acting on a record
Question answeringAnswer or escalate
Financial services and HRAct on a record, under policy
Someone asks
What’s included in the plan?
Can I dispute this charge?Can I take two weeks off?
The agent reads
Product information
That person’s own recordsThe policy that applies to them
Before it acts
Nothing to decide
Blocked, with the reasonAllowedA rule decides, the same way every time
It ends with
An answerA request escalated to a person
A record writtendispute filed · leave submitted

The person wants something done: a charge disputed, time off booked. If it can’t be done, they need the reason and a next step.

Before building, I specified how leave policy works.

The HR agents I reviewed collected a request and passed it on. Whether it met policy was decided later, by someone else.

ProblemThe request is taken; the policy is checked days later
  1. EmployeeCan I take two weeks off starting June 7?
  2. HR agentDone. I’ve sent your request for approval.
  3. RequestRejected · not enough balance

So I wrote the policy data the agent decides with. Every policy sets its own notice, units and limits, and the rules are written once against whichever policy applies, so the agent can check before it writes.

SolutionSix policies, one rule
Salariedhalf-day unitsThis employee
No
Salaried, westhourly units
No
Hourlyhourly units
No
Part-timefull days
Up to 2 days
Unlimitedfull days
n/a
Contractorfull days
No
One rule, written onceWorking days requested ≤ days available, under this employee’s policyIt reads whichever row applies, so the same facts always give the same decision.

The model reads the request. Code decides whether a rule is met.

Here a wrong answer is a wrong record, so each decision goes to whichever of the three can be held to it.

The model
Reads what the person asked for and words the reply.
Code
Checks the policy and allows or blocks the write.
The person
Confirms before anything is written.

The agent checks a request before it writes anything.

The request stays a draft until a rule has read it against the employee’s own balance and policy.

SolutionA draft that a rule can check
  1. Vacation available6 daysPolicyAccrued leave onlyno negative balance
  2. EmployeeCan I take two weeks off starting June 7?
    Length2 weeksStartJune 7
    1. Working days10calculated from the dates
    2. Compared with6 availableunder this employee’s policy
    3. Rule · within balance10 > 6 · Blockednothing written

A block shows the rule, its inputs and a way forward.

With the rule and the numbers in the reply, the employee knows what to change.

ProblemA block with no reason
  1. AgentI’m unable to submit that request.
SolutionThe rule and its inputs, with a way forward
  1. Agent · Request blocked10working days requested6availableI can’t submit two weeks. Your policy only covers leave you’ve already earned, and two weeks is 10 working days against the 6 you have. Would one week work?

An edit updates the same draft.

The start date stays. The days are recalculated, the same check runs again, and nothing is written until the employee says yes.

SolutionSame draft, one field changed, then written
  1. EmployeeYes, make it one week.
    StartJune 7keptLength1 weekwas 2 weeks
    1. Working days5recalculated
    2. Compared with6 availableunder this employee’s policy
    3. Rule · within balance5 ≤ 6 · Within policycan be submitted once confirmed
  2. Agent · Within policy5working daysJune 7start date keptShould I submit June 7–11?
  3. EmployeeYes.
  4. StatusSubmittedVacation available6 → 1

In a card dispute, the reason decides what the agent asks.

Each dispute reason needs different facts. A missing one blocks the filing and becomes the next question.

SolutionThe missing fact becomes the question
  1. CardholderThe sofa I ordered from Alder & Pine never arrived. Can I dispute the charge?
    ChargeAlder & Pine · $840.00matched on the accountReasonNot received
    1. ReasonNot received
    2. This reason needsPromised delivery datenot in the draft yet
    3. Rule · facts completeMissing · Can’t file yetnothing written
  2. Agent · Can’t file yetFor an order that didn’t arrive, I need the date delivery was promised.

Three runs of the same request gave the same decision.

The reply’s wording varies from run to run. The decision and the write do not. In the demos, the same request produced the same decision every time.

ResultThree runs, one decision
  1. Working days10Available6Negative balanceNot allowed
  2. Run 1 · AgentI can’t submit two weeks. That’s 10 working days and you have 6. Would one week work?
    1. Rule · within balance10 > 6 · Blockednothing written
  3. Run 2 · AgentTwo weeks would use 10 working days against the 6 you have, so I can’t submit it. One week would fit.
    1. Rule · within balance10 > 6 · Blockednothing written
  4. Run 3 · AgentThat request is over your balance, 10 days against 6, so I’m unable to submit it. Want to try one week?
    1. Rule · within balance10 > 6 · Blockednothing written
The wording changes from run to run. The decision, and the write it withholds, do not.

I built these agents on mock records.

I ran both agents on mock records and services, a separate copy for each session, so they could act on realistic accounts before any customer opened a real system.

The customer deployments →