Osy#betaRun it on Osyrin: osyrin.com

Reference / Agent

A parcel that never came — a case owned until it is right, closed, and opened again

A tea shop's customer reports that her order has not arrived. The shop opens an assignment: a piece of work it owns until she has her tea or her money back, with two things that must be true for it to be done. An agent finds out what happened and keeps the evidence; the customer is asked what she wants; the agent refunds her; support records the decision and closes the case. A week later the refund has not reached her bank, and she opens it again. Nothing is lost, and nothing is refunded twice.

previewagentsguidestory

You are here: Agents in an Osy# app › Stories › A parcel that never came

Summary#

The other two stories are processes: the steps are known before anything starts. This one is not. A parcel is missing, and nobody knows yet whether it is late, lost, or sitting with a neighbour. What the shop does know is the outcome it owes: the customer has the order, or her money back.

Work like that is an [[agent-guide-glossary#assignment|assignment]]. It says who asked, what outcome is wanted, and what must be true for it to be done. Everything else is attached to it as it happens.

Description#

Who is involved?#

PersonTheir partWhat they may do
Nora Lindthe customerreport a problem with her own order; read her own case; reopen it
Sana Iqbalsupportowns this case; gives the agent work on it
Tim Vargasupportnot on this case, so he can give the agent no work on it
Lars Wiksupport leadreads every case; answers for the agent; sees what it cost
AgentIts jobsWhat it may do alone
Resolverfind out where an order is; settle a lost orderin this shop, everything its jobs include: look the order up, track the parcel, record what it finds, refund the order, write to the customer

The last cell is a choice this shop made: a refund up to the order's total is within what its support may do, and it lets the [[agent-guide-glossary#agent|agent]] do the same. A shop that wants a person to approve every refund changes one line, and the refund becomes a [[agent-guide-glossary#proposal|proposal]] in somebody's [[agent-guide-glossary#inbox|inbox]], as in the bakery's story.

Tuesday morning: the report#

Nora writes that order T-1042 has not arrived, and that she needs it before Friday. The order was 42.00 euros of tea, sent with a carrier.

The shop opens an [[agent-guide-glossary#assignment|assignment]], with Sana as its owner:

  • Outcome wanted: the customer has the order, or their money back. "I need it before Friday."
  • Limits: this order only. A replacement or a refund up to the order's total.
  • Done means both of these are true:
    1. The parcel is delivered or the order is refunded.
    2. The customer has been told the outcome.
  • Wanted by: Friday. May spend on agents: five cents.

Tuesday: finding out#

Sana asks the Resolver to find out where the order is. It looks the order up, tracks the parcel, and writes down what the carrier's scans show before it concludes anything. That is what its instructions tell it to do:

Carrier scans for PL7731. Last scan 6 March, Malmö depot: damaged, held. Nothing since.

That note is not a line in a log. It is an item in the case's repository: a piece of evidence, with who added it (the Resolver's own account), where it came from (the carrier's tracking), and which piece of work it was written in. The Resolver's conclusion is kept as a second item, a finding: the parcel is lost; suggest a refund. A finding from an agent is marked unverified until a person accepts it.

The agent's work is finished. The case is not. Its page says exactly why: two of two things are not yet true. Finished work completes nothing; only the outcome does.

Tuesday to Wednesday: asking the customer#

Sana asks Nora: "The parcel was damaged on the way. A replacement next week, or a refund?" The case now says it is waiting, and on whom: Nora Lind.

Twenty hours later Nora answers: "A refund, please. Next week is too late." Her answer is kept as an item too.

Wednesday: settling it#

Sana asks the Resolver to settle the order. It refunds 42.00 euros, with the reason "lost in transit", and writes the confirmation to the customer.

Then a person puts her name to what was decided. Sana records the decision — "Refund in full: lost in transit; the customer chose a refund over a replacement" — and accepts it as within what support may refund. That decision is what the first condition is met with: anybody who later asks why this case counted as resolved is one click from the decision, and from the evidence under it.

Sana tells Nora. The second condition is met. Both are true now, so the case can be closed, and it is, with a summary and one thing still to watch: "Watch that the refund reaches the customer's bank."

What did it leave behind?#

Lars, the support lead, reads the closed case:

  • Eight items: the carrier's scans, two findings, the decision, and four letters — what the customer was asked, what she answered, the refund confirmation, and what she was told.
  • Four pieces of work, in order: find out where the order is; ask the customer; settle the order; refund the order.
  • What it cost: two pieces of agent work and a closing summary, against the five cents the case may spend. The agent's work is charged to the case as it is spent, and a case whose money is spent starts no more agent work.

The amounts in the test are fractions of a cent, because its [[agent-guide-glossary#model|AI model]] is a scripted stand-in with made-up prices. What the test checks is that the three add up.

A week later: it comes back#

The refund has not reached Nora's bank. She reopens the case, and says which condition is no longer true: the first.

  • The case is open again, and says it was reopened once.
  • "The order is refunded" is back to not met. "The customer has been told" is still met.
  • All eight items and all four pieces of work are still there.
  • When the refund is asked for again, it is not made twice. The answer is: "Already refunded: 42.00 EUR refunded: Lost in transit."
  • And the case cannot be closed again by saying "done": it refuses while a condition is unmet.

That is where the test ends, and where a person takes over: somebody has to find out what happened to the money. The case will not let itself be closed until they have.

What else is tested on this case?#

The awkward things that happen to long-running work, each a test of its own:

  • The agent's work dies half-way. The case still says what it was waiting for. Asked again, the work is run again; the dead attempt is called off and closed.
  • It dies after the refund. Asked again, the agent is told the refund was already made. One refund.
  • The work had already finished. Asked again, it is answered from its [[agent-guide-glossary#receipt|receipt]]. No AI model is called.
  • The money runs out. The work is stopped, what it found is kept, and the case can be ended as failed with a note of what was and was not done.
  • Somebody who is not on the case cannot give the agent work on it.
  • The case is called off — the customer found the parcel at a neighbour's — and the agent's running work is called off with it.

What does an assignment look like on screen?#

The tea shop's test app has no screens of its own: its tests are about the case, not about pages. The two kits it uses draw these, shown here from their own test apps, a workshop that repairs machines and a company hiring a consultant.

An assignment's page: a press that faults; open, blocked, overdue and stalled; one of three conditions met; where it stands; the work attached; what it has cost

An assignment that is stuck says so, and says why, without anybody typing a status.

An item with its versions: the version that stands, one waiting to be reconciled, and the first

An item is never overwritten. Each version says who wrote it.

Where is this written down?#

In the test app of the kit that joins assignments and agents: a_delivery_case_is_carried_from_the_customers_report_to_a_verified_outcome_and_opened_again. No AI model is called in it.

Go deeper#

Related

Agents in an Osy# app — what they are, in plain words

An app written in Osy# can have AI agents that people can trust with real work. An agent is a part of the app with a…

A supplier is qualified — five days, four agents, one that failed, and a three-day wait

A tool maker qualifies a new supplier of castings. Four agents do the reading steps of a fixed process. One of them…

Two suppliers for a bakery group — a week's wait, an outsider's answer, and one agent directing three

A bakery group's purchasing office takes on a flour mill and qualifies a dairy. The mill's own contact fills in a form…

Assignments — a piece of work owned until its outcome is reached (Assignments kit)

An assignment of the `Osysharp.Assignments` kit says who asked, the outcome wanted and what must be true for it to be…

Work repositories — what an assignment knows, kept as items (WorkRepositories kit)

The `Osysharp.WorkRepositories` kit keeps an assignment's evidence, correspondence, findings, documents, proposals and…

Choosing — I want X, so use Y, not Z, because

Seven tables for the choices that come up in every app with agents in it: an agent or a plain model call or a workflow…