Parent Confirmation for School RSVPs with TeaQL
Oraki asked a concrete question on X: its family AI agent can extract a field-trip date from a school email and add it to the family calendar. Before telling the school that a child will attend, it should ask a parent. How would I model that in TeaQL?
I would give the calendar event and the attendance reply separate records. The event describes something the family should know about. The RSVP records a decision the family is making. A parent confirms the proposed reply, and the application's delivery service checks that confirmation before preparing the command.
My earlier needsConfirmation() query in that conversation was an
illustration, not an existing TeaQL API. This article makes the underlying
business rule concrete with a runnable Python and SQLite guide.
Keep the calendar useful while attendance is undecided
Suppose a school email announces a science museum trip on December 15. The
agent adds the event to the family calendar and prepares a proposed RSVP for
one child. The calendar can now help the family plan, while the RSVP remains
PENDING.
The example model uses these concepts:
| Concept | What it records |
|---|---|
| Household and family member | Which family owns the records, which child is involved, and who may confirm. |
| School event | The title, date, location, source message reference and consent revision. |
| RSVP request | The child, event, intended response, recipient and command key. |
| Confirmation fields | The approving member and a digest of the exact action they reviewed. |
These records let the interface say both “Science museum trip on the calendar” and “Attendance awaiting your confirmation.” Importing the date does not advance the RSVP.
Ask the parent to confirm a specific reply
A useful confirmation screen shows the child, trip, date, location, attendance response and destination. It should make clear what will be communicated to the school.
The example's application-owned preview helper returns that action summary
and its digest. Once the parent confirms the displayed summary, the endpoint
calls confirm with the parent's authenticated context:
action, digest = await preview(parent_context, request_id)
# Display action to the parent and wait for their explicit confirmation.
await confirm(parent_context, request_id, digest)
These are application functions, not additional generated TeaQL methods. They use the generated library to read current records and save the decision. For example, the request loader uses the actual generated query:
request = await (Q.rsvp_requests().with_id_is(request_id).limit(2)
.comment("Load the complete RSVP for a confirmation decision")
.purpose("Check household ownership and the current RSVP state")
.execute_for_one(context))
The confirmation service resolves the parent from the trusted session,
checks household ownership and permission, and recomputes the action digest.
If the trip changed after the screen was opened, it asks for a fresh review.
Otherwise, it saves the approver, approved digest and APPROVED state in one
audited operation.
The hash identifies the reviewed contents. The authenticated parent and the server's authorization check establish who approved them. An agent supplying a matching hash cannot grant itself permission.
Recheck the confirmation when preparing the RSVP
A parent might approve the museum trip, then the school moves it to a
different location. Or someone edits the response's recipient. Keeping a
historical APPROVED status is useful, but it does not approve the changed
action.
Before preparing delivery, the service reloads the event, child and approving parent. It checks current household membership and confirmation authority, then compares the current action with the approved digest. A mismatch stops preparation and requires the parent to review again.
That is the behavior I would put behind the idea of “needs confirmation.” It depends on the particular action and the validity of its approval. A stored boolean cannot express all of that on its own, and an inbox query cannot enforce the sending boundary.
In the example, successful preparation changes the RSVP to QUEUED inside
a SQLite transaction. Repeating the same preparation returns
ALREADY_QUEUED without another write. A deliberately injected failure after
the queue write leaves the original database state and version intact.
Choose a database and language
This design can also use PostgreSQL (PG) or MySQL through TeaQL's corresponding server-side providers. Besides Python, TeaQL can generate APIs from the same KSML domain model for six other languages: Java, Rust, TypeScript, Go, C# / .NET, and Swift. See the language and database overview for provider choices.
Implement the confirmation service with the selected language's generated APIs and verify its transaction behavior on the chosen database. Swift's local SQL provider is SQLite; a Swift application can use a PostgreSQL or MySQL backend service. The executable example and verification receipt here cover Python + SQLite.
Keep TeaQL and application responsibilities explicit
TeaQL generates the model-specific query, expression and mutation APIs used by the example. The application defines who counts as an authorized parent, which details require renewed confirmation, and which service may prepare delivery.
The small fixture grants an eligible parent confirmation authority within one household. A real product may need a guardian relationship for each child, separate rules for different activities, and its own authentication and confirmation interface. Those decisions belong in the model and service policy; they cannot be inferred from a school email.
The guide includes the complete application source, setup command and recorded verification. The Python/SQLite run passes ten scenarios covering confirmation, changed details, identity and authority checks, replay and rollback. It verifies preparation of an RSVP command. Email delivery and school-form submission are separate integrations.
An external sender still needs durable delivery tracking, a stable idempotency key and a clear rule for changes after queueing. A successful database transaction cannot recall a message already delivered.
For Oraki's original scenario, the family calendar can remember the trip while the parent keeps control of the attendance decision. The confirmation boundary sits at the action that makes that commitment.
