Autonomous agents with memory and context — patent filed with the USPTO

Hospitals and hospital groups · Enterprise track

Hal-AI for Hospitals

Every hospital has the same three bottlenecks, and they feed each other: the phone nobody picks up, the schedule that never turns into visits, and the claim that comes back denied. One agent with memory and tools takes all three at once — because it is the same engine reading the same systems.

Patient service on Meta's official WhatsApp · booking written straight into the hospital's own schedule through the API · revenue cycle read every day by a Squad.

A doctor in a white coat and stethoscope working on a laptop at a nursing station, with the Hal-AI brand on a glass partition behind her and the hospital team moving around.
The real problem

Three bottlenecks that look separate and are the same one

Each of them has a different owner on the org chart — the front desk, scheduling, and billing. But they share one origin: information that already exists in a system and does not reach the person who needed it in time.

Bottleneck 1

The phone nobody picks up

The patient calls at the exact hour the front desk has a line at the counter. They wait, give up, try again tomorrow. When they write on WhatsApp, the message sits unanswered until someone catches a gap — and the gap usually opens after the visit was already lost.

The cost never shows up in any system: it is the appointment that was never booked.

Bottleneck 2

The schedule that never turns into visits

The slot was published, someone booked it, nobody confirmed it, the patient did not show. The chair sat empty while a waiting list stood outside. At month-end the manager finds out that the specialty with the longest queue is the same one with the most holes in its schedule.

Idle capacity and a waiting list live in the same week, in the same hospital.

Bottleneck 3

The claim that comes back denied

Care was delivered, the claim went out, and the health plan — the payer — returned its statement with lines denied. The appeal depends on pulling evidence out of three systems, and the contractual clock runs while somebody hunts for the right document.

When the deadline passes, the argument is over — and the loss stopped being recoverable.

Why treat them together

The same engine reads the same systems

The conversation that books the appointment is the conversation that confirms it the day before — and that confirmation is what prevents the no-show. The no-show is what leaves the schedule idle. The idle schedule is what squeezes the month's revenue. Splitting this into three projects with three vendors is exactly what makes each vendor solve its slice while the hospital keeps the whole problem.

At Hal-AI, the agent that answers the patient on WhatsApp, the Squad that sweeps the schedule before dawn and the Squad that reconciles the payer statement are the same piece of software holding different tools. Same memory, same audit trail, same dashboard.

This is not a chatbot at the front desk plus a robot in billing. It is one agent with declared access to the systems the hospital already runs.

Two points of view

A day at the hospital, seen from outside and from inside

From outside, it is the patient who cannot get an appointment. From inside, it is the manager who only finds the hole once the month has closed. Both stories happen on the same day, and nobody ever sees them side by side.

From outside

“I called three times and never reached anyone”

It is eleven at night. The patient just got off a shift and wants to book a cardiology follow-up. They write to the hospital's number, because a phone call at that hour gets nowhere. They want three things: whether their health plan is accepted, whether they need to bring any paperwork, and the earliest slot that exists.

None of those questions is clinical. All three already have an answer inside the hospital's systems at this exact minute. What is missing is not information — it is somebody awake to look it up.

  • Outside front-desk hours is when a large share of contact happens, precisely because patients work during the day too.
  • Audio and images are the natural format for older patients and for anyone in a hurry: a photo of the insurance card, a voice note reading out the doctor's order.
  • The prep question — fasting, routine medication, whether to bring someone along — decides whether tomorrow's exam can happen at all.
Hospital patient service online
Good evening. I need a cardiology follow-up — do you take my health plan?11:04 PM
Good evening! Yes, that plan is accepted in our outpatient clinic. For a follow-up, please bring photo ID, your insurance card and the doctor's order.11:04 PM
I have Thursday at 7:40 AM and Friday at 2:20 PM. Does either work for you?11:04 PM
Voice message sent by the patient, eleven seconds long.
Got your message: Thursday at 7:40 AM. The slot is now booked in the outpatient schedule. I'll send the confirmation the day before, right here.11:05 PM
And can I take my blood pressure medication beforehand?11:06 PM
That is clinical guidance and I don't answer it here. I've already passed your question to the care team, and they'll reply in this same chat during business hours.11:06 PM

Look at the last reply: a clinical question is not answered by the agent — it is handed to a person.

From inside

“By month-end close I find out what can no longer be fixed”

The manager does not have a data problem. The manager has a timing problem. The schedule-occupancy report lands after the month is closed. The denials spreadsheet is assembled by hand from statements that arrive in different formats, from different payers. The no-show report exists, and it explains the past.

What nobody delivers is the short list: these four specialties will end the week with idle slots, these batches hit the appeal deadline in five days, these twenty bookings look like the ones people skip. That is not a report — it is pending work, and it has to arrive earlier.

  • The daily dashboard arrives written, with the arithmetic shown behind every number, before the day starts.
  • The one-off question — “how much of the orthopedics queue is follow-ups?” — is answered in HAL Copilot, in plain language.
  • The decision stays human: the agent separates what it already handled from what needs someone to decide.
What moves

From month-end close to six in the morning

The same query that used to feed the monthly report now runs every day, before dawn, when nobody is using the system. The output is not a file on a server: it is a document with sections, tables and charts, delivered by email to a closed list of recipients.

  • The Squad wakes up on schedule, with nobody asking
  • Reads the schedule, the billing and the payer statements through the API
  • Writes the analysis and names what needs a human decision
  • Every run is recorded, with dry-run mode and a stop button

It is the same piece that already publishes operations reports across the platform — here it reads the hospital's systems.

The scope

Three fronts, one agent

Patient service and booking on official WhatsApp. Schedule, capacity and no-shows. Revenue cycle, from billing to claims transmission. Each front has its own page, and all of them share the same memory and the same integrations.

The hospital in this example

The scenario used across the whole section

Every page in this section describes the same reference hospital: a mid-to-large hospital group, with 28 outpatient specialties, roughly 60,000 outpatients a year, around 2,500 appointment slots published per week, an official WhatsApp number carrying about 23,000 conversations a month, and 14 contracted payers.

If your hospital is bigger or smaller than that, the order of magnitude changes — the shape of the operation does not.

78% of conversations on the official number closed without anyone from the team stepping in
86% occupancy across the outpatient schedule, against 74% at the start of the cycle
−94% in value lost to expired contractual appeal deadlines
The technical argument

Why an agent, and not a chatbot or a flow robot

The difference is not how good the text on screen looks. It is who decides what to do at each turn of the conversation — and what happens when the patient says something nobody drew into the design.

Menu chatbot or flow robot

  • A hand-drawn decision tree: “press 1 to book an appointment”. Anything unplanned breaks, and the patient becomes an escalation.
  • Offers slots from a list somebody exported yesterday — and sometimes the slot is already gone.
  • Every channel means building the robot again: the one on the website has no idea what was agreed on WhatsApp.
  • The conversation restarts from zero every time: the patient repeats their plan, their name and their request over and over.
  • Fire and forget: it sends the confirmation and never checks whether that person already replied.
  • When someone at the front desk steps in, it becomes two parallel conversations on the same number.
  • Billing is a different product, from a different vendor, with a different login and a different report.

Hal-AI agent, with memory and tools

  • Gets an objective, a Knowledge Vault and tools, and decides at each turn what to do — including doing nothing and calling a person.
  • Calls api_get_schedule_availability live and offers the slot that exists this minute in the official schedule.
  • The same agent, the same knowledge and the same tools on WhatsApp, webchat, voice and email.
  • Vectorized history and episodic memory: the agent knows this patient has rescheduled twice and prefers early slots.
  • Agent calls agent and gets the answer back: “this patient confirmed yesterday, I didn't message again”.
  • Taking over pauses the agent in that chat; closing the card hands the conversation back with the full history.
  • The same platform reads the schedule, the billing and the payer statement, on the same audit trail.
The mechanism

A tool is one of your APIs, declared one by one

The agent has implicit access to nothing. Every endpoint it may call is registered in its configuration, with authentication, description and scope. What was not handed over simply does not exist in that agent's world.

  • api_get_schedule_availability — open slots by specialty, provider and site.
  • api_post_booking — books, reschedules and cancels in the hospital's official schedule.
  • api_get_payer_statement — the day's statement, per payer, for reconciliation.
  • api_get_claim_batch_status — batch and protocol status under TISS, the claims exchange standard mandated by ANS, Brazil's regulator for private health plans — without opening a portal.

Reading and writing are separate permissions. A patient-service agent can look up the schedule without being able to touch billing.

What it means in practice

The patient doesn't have to talk like the system

“I need to move next week's appointment to the afternoon, preferably with the same doctor” is not a menu option. For the agent it is a sequence of decisions: identify the patient, find the booking, check that provider's availability, propose, confirm and write it back.

When the request goes past what it knows, it does not improvise: it hands off to the front desk with the history attached, and the card carries an owner and a timestamp.

A flow is a map of the paths someone predicted. An agent is a professional with an objective, a manual and a keyring.

How memory and context work on the platform

One piece, three roles

The engine is the same across the operation

What changes from one role to the next is the personality, the Knowledge Vault and the keyring of tools. The memory and context architecture — the subject of the patent filed with the USPTO — is identical in all three.

Who works by day, who works before dawn, and who answers the manager

Channel agents sit on official WhatsApp, webchat and voice, talking to patients. Squads have no channel of their own: they wake up on schedule, sweep the hospital's systems, decide what needs doing, and talk to the channel agents so those agents make the contact one by one. HAL Copilot never talks to a patient: it is the internal assistant for whoever runs the place.

None of this is file-based integration: all three read the same APIs, write to the same audit trail and show up in the same console. When the pre-dawn Squad finds that twenty of Thursday's bookings look like no-shows, what reaches the patient is not a dialer — it is the channel agent, inside the conversation the patient already had.

  • Scheduling Squad: at 5:40 AM it reads the day's funnel, isolates who has not confirmed, and hands the list to the channel agent.
  • Revenue Squad: at 6:10 AM it audits the open claims against the patient chart, reconciles the statement that arrived yesterday and writes the denials dashboard.
  • Channel agent: from 8:00 AM it talks to each patient on the list — with no template needed while the 24-hour window is still open.
  • HAL Copilot: answers the manager in plain language, read-only, with a table and a chart on screen.
A team gathered in front of screens following the indicators of a customer service operation.
The repetitive task leaves the desk: the structure needed for the same volume gets smaller, and what reaches a person is the case that takes judgment.

The conversation between the orchestrator and the channel agents is recorded too. It is not a dispatch queue: the Squad asks in plain language, the channel agent reports what it did and what it did not do — and the reason goes into the trail.

Hal-AI · Scheduling Squad run Run #312 · live
Run #312 · Daily Funnel Schedule · 5:40 AM · read-only api_get_daily_funnel → week's schedule read · api_get_schedule_availability → open slots by specialty
Front Desk Agent · WhatsApp “confirm attendance with everyone booked for Thursday who hasn't replied” conversations opened inside the 24h window api_get_appointment · api_post_confirmation sent Front Desk Agent · WhatsApp “those outside the window get the confirmation template” outside the window — approved template only template Waiting List Agent · WhatsApp “offer yesterday's canceled slots to the queue for that specialty” slots written back to the official schedule through the API api_post_booking delivered
What the Squad did not do on its own moving capacity between providers takes a scheduling decision waiting on a person
Representation of the run. The orchestrator talks to the channel agents in plain language and gets back what each one managed to do.
Answers

Channel agents

Name, personality, voice and real tools: look up the schedule, book, send media and interactive options, request a location, search the Knowledge Vault and hand off to a human. Several agents can share the same official number.

How an agent is configured

Orchestrates

Squads

An orchestrator agent with no channel of its own. It wakes up on schedule, queries the hospital's APIs, decides, publishes the analytical document in HTML and PDF and emails it to a closed list. It has an auditable history, dry-run mode and a stop button.

See the Squads

Answers the manager

HAL Copilot

The internal assistant for the board and for middle management: ask in plain language about your own operation, get a table and a chart on screen, export to PDF. The manager sets the mission, closes the page and gets notified when it is done.

See the Copilot

The channel is still Meta's official one

The hospital's number is activated through Meta's own authorization flow. Hal-AI is a Meta Business Partner and runs on the official WhatsApp Business Cloud API — there is no handset taped to a desk and no unofficial number. Outside the 24-hour window, the only way to speak is an approved template, and that applies to the agent exactly as it applies to a person.

The deliverable

The hospital's day in a single piece

Below is a representation of the document the Squad publishes before dawn and delivers by email. The stylesheet is light and serifed on purpose: the deliverable is not supposed to look like a dashboard, it is supposed to look like a report.

Hal-AI · Document published by the Squad Current week · PDF

Hospital Daily Dashboard · run #312

Who was seen, who didn't show and what the payer sent back

Document published by the Squad at the end of the 6:10 AM run, covering this week's outpatient activity and the open billing cycle.

period current week source api_get_daily_funnel run #312
01The three fronts at a glance

The official number took roughly 23,000 conversations this month, 78% of which ended without anyone from the team entering the chat. The outpatient schedule published 2,500 slots this week and closed at 86% occupancy. In the open billing cycle, the denial rate sits at 4.1% of billed value, against 9.8% at the start of the cycle.

Closed without the team 78% of ~23,000 conversations this month
Schedule occupancy 86% was 74% at the start of the cycle
Denial rate 4.1% of billed value · cycle target: 3%
02What time the conversation arrives

The front desk works from 7:00 AM to 7:00 PM. Adding up the bands outside that range — overnight, evening and late night — 41% of conversations arrive when there is nobody to answer: 8% + 20% + 13%.

Conversations by time of day — the example week share of the week's total

Figure 1 — conversations on the official number by time of day. Within hours: 14% + 17% + 16% + 12% = 59%. Outside: 8% + 20% + 13% = 41%.

03From published slot to completed visit

Of the 2,500 slots published this week, 2,150 were booked — that is the 86% occupancy. Against those bookings, the 24% no-show rate accounts for 516 absences, leaving 1,634 completed visits.

Slots published2,500 Booked2,150 No-shows516 Completed1,634

Figure 2 — the week's funnel. 2,500 published × 86% = 2,150 booked. 2,150 × 24% = 516 no-shows. 2,150 − 516 = 1,634 completed.

04Indicators tracked through the cycle
Indicators tracked by the Squad across the three fronts, with the value at the start of the cycle and the value in the current cycle
Front Indicator Start of cycle Current cycle State
Patient service Conversations closed without the team 78% on target
Patient service Handoffs to the front desk baseline −76% on target
Schedule Outpatient schedule occupancy 74% 86% on target
Schedule No-show rate against bookings 35% 24% above target
Revenue Denial rate over billed value 9.8% 4.1% above target
Revenue Billing submission window 12 days 2 days on target
Revenue Batches rejected on technical inconsistency 14% 0.8% on target
Indicators on the dashboard — 2 patient service + 2 schedule + 3 revenue 7 2 above target
What the manager has to decideThe no-show rate fell from 35% to 24%, but this week's 516 absences are still concentrated in bookings made more than 30 days ahead. Opening those slots to the waiting list with early confirmation is a scheduling decision — the Squad does not rearrange capacity on its own.

What you are looking at

The header names the routine and the run that produced the piece, and the monospaced line declares which API call each block came from. Every figure carries the arithmetic that supports it: the week's funnel shows the operands, not only the result.

The last table pulls the three fronts into a single read, and the block that closes the document separates what the Squad already handled from what depends on a person deciding.

The advantage

Nobody exported a spreadsheet, cross-checked a list or wrote a summary. The document went out at 6:10 AM, before the day began, and reached a closed list of recipients by email — with the open item already named, instead of an attachment for someone to interpret.

Because the structure is identical on every run, today's dashboard can be compared with last week's without anyone redoing the math to line the two up.

Only at Hal-AI

Notice what the piece does not show: no clinical data and no identified patient. The aggregate dashboard works with counts, proportions and states — symptoms, diagnoses and test results never enter, because the configuration does not reach them.

And the arithmetic does not run through the model: tables and charts are declared by reference to the API call the agent already made in that same turn. The server reads the response and assembles the block. An empty document is refused, rather than shipping with a pretty axis and nothing inside.

The same document comes back into the run's chat as a clickable attachment — that is how the manager opens the piece without leaving the conversation with the orchestrator.

Hospital Daily Dashboard — run #312 PDF · hospital-daily-dashboard-312.pdf Open document

The published document as a bubble, the way it appears in the Squad's run chat.

Section map

Where to start

Eight pages, each one with the mechanism open: which API is called, what happens when it fails, and who gets told. Start with whatever hurts today.

Patient service

WhatsApp patient service

Patient questions, exam prep, health plan coverage, paperwork, directions and handoff — 24 hours a day, on Meta's official number.

Access

Appointment booking

Book, reschedule, cancel and confirm in the official schedule through the HIS — the hospital information system — with a waiting list and canceled-slot recovery.

Capacity

Schedule and capacity

The day's funnel, schedule occupancy, no-shows, lead time as a predictor of absence, and capacity redistribution by specialty.

Revenue

Billing and denials

Statement reconciliation, denied lines classified by root cause, appeals assembled with evidence, and an alert before the contractual deadline expires.

Revenue

TISS claims transmission

Validation before submission, one batch per payer, the protocol imported on its own, and the billing window back under control.

Revenue

Coding compliance

The patient chart audited against the claim: a progress note that never records the billed procedure, a supply with no justification, a bed day with no matching note. With CBHPM, Simpro and Brasíndice — Brazil's reference price tables — kept current and edits simulated before the batch goes out.

Management

Dashboards and indicators

The Squad that wakes up, reads the systems, writes the daily dashboard in PDF and HTML and sends it — with the arithmetic shown behind every number.

Foundation

Integrations and security

HIS, ERP, TISS, HL7/FHIR, REST APIs and MCP; what the agent may do on its own; LGPD — Brazil's data protection law — audit trail and human takeover.

Smaller operations

Running a clinic or a practice?

If this is a clinic, a private practice or a dental office, the path is the virtual receptionist on WhatsApp — quicker to turn on.

Suggested order

In practice, it almost always starts with access

Patient service and booking on WhatsApp show up fastest: the patient feels it in the first week, the front desk feels it in the first month, and the schedule starts filling before any billing project finishes. The revenue cycle comes next, once the read integrations are standing and the audit trail is already being generated.

It is not a rule. A hospital with high denials and a healthy schedule starts from the other end — and the platform is the same in both cases.

Transparency

What the agent won't do

A hospital needs clear limits, and it is better to say this before the contract than after. These limits are not settings: they are how the platform is designed.

It gives no clinical guidance

The agent does not assess symptoms, suggest a diagnosis, recommend treatment, weigh in on medication or interpret test results. It handles access and the claim: it books, confirms, reschedules, repeats what the hospital has published and reads the administrative systems. Anything clinical goes to the care team with the context of the conversation attached.

It creates no parallel schedule

Every booking, reschedule and cancellation lands in the hospital's official schedule, through the management system's API. There is no intermediate spreadsheet, no mirror database and no “the front desk will confirm later”. If the API does not answer, the agent says it could not do it and hands off — it never promises a slot it did not write.

It moves no money without a trail

The Squad audits the claim against the patient chart, points at the line the documentation does not support, classifies each denied line by root cause and assembles the appeal with the evidence attached — the work of finding it arrives done, with the line, the missing evidence, the likely cause and the deadline. What it does not do is accept a denial, write off a loss or change a billed amount on its own: the hospital signs the correction. Every action is recorded with what was queried, what was decided and what was written — and any action that moves money requires human approval declared in the configuration.

It doesn't speak outside the window without a template

Once 24 hours have passed since the patient's last message, official WhatsApp only allows an approved template. The agent respects that: it does not improvise a free-form message, it uses the registered template or leaves the contact pending in the queue for the next day. That is Meta's rule, not a Hal-AI limitation — and it applies to the agent exactly as it applies to a person.

It invents no numbers and hides no failures

When a system does not answer, the run records the failure and the document goes out saying what was left out. An incomplete document is refused before publishing, instead of shipping with the gap disguised. While an integration is not connected, the screen itself stamps the data as a simulation, rather than pretending to be live.

Integrations, LGPD and the audit trail in detail

The platform's security controls

Questions

Questions from people who run hospitals

The six that come up in every first conversation with clinical leadership, IT and billing.

Where does patient data live, and who can see it?

The data stays in the hospital's systems. The agent queries it through the API at the moment of the conversation and uses the answer for that conversation — it does not copy your database out or build a parallel registry. What the platform keeps is the conversation history and the memory of that contact, with long-term memory switchable per agent.

Health data is sensitive personal data under LGPD. Any access to a patient chart or a clinical system depends on a specific project, with purpose, legal basis, scope and responsibilities set in the contract before anything is connected. On the aggregate dashboard, patient data does not appear at all: the manager sees counts, proportions and states.

Do we have to replace our hospital management system?

No. Hal-AI does not replace the HIS, the ERP or your billing system: it talks to them. The REST APIs the hospital already has become tools for the agent — the endpoint is registered once, with authentication and a description, and from then on it exists on that agent's keyring. There is also support for MCP servers and for the industry standards, such as TISS and HL7/FHIR.

When a system exposes no API for some operation, that operation stays out of scope and is said plainly during project design, instead of becoming a promise that only surfaces at go-live.

What happens when our system goes down mid-conversation?

The agent has no invented fallback. If the availability call fails, it does not offer a slot: it tells the patient it could not reach the schedule right now, records the request and hands the card to the front desk with the full history. If writing the booking fails, it confirms nothing — the rule is to never promise a slot that was not written.

On the routine side, the Squad's run records the failure and the published document states what was left out of the period. An incomplete piece is refused before publishing, instead of shipping with the gap disguised.

How long does it take to get the first front live?

It depends on two things, and neither of them is training the agent: activating the official number through Meta's authorization flow, and access to the hospital's APIs. The agent's starting knowledge comes from what the hospital already publishes — specialties, accepted health plans, addresses, hours — and is completed in the Knowledge Vault with PDFs, text and images.

In practice, the design usually starts with a single front, read-only, in dry-run mode, before any write action is released. That is why the first conversation is about integration and governance, not about prompts.

Who answers when the agent gets it wrong?

The hospital, the same way it answers today for what the front desk does — and that is exactly why the platform is designed so errors are visible and reversible. Every run has an audit trail: what was queried, what was decided and what was written, with timestamps. Every conversation stays in the history. Every human takeover is recorded with an owner and a time.

Before any of that, there is the limit itself: the agent may only call the tools declared for it, and an action that changes the schedule or moves money can require human approval. A content error is fixed in the Knowledge Vault and holds for the next patient; a scope error is fixed by taking the tool off the keyring.

What happens to the size of the front desk?

The call center needed to carry that volume gets considerably smaller. Repeating opening hours, listing accepted health plans, booking and calling people one by one to confirm attendance all get settled inside the conversation, with nobody from the team stepping in — and the patient is answered faster, in the middle of the night included. What is left for a person is the case that takes judgment: the angry patient, the contractual exception, the negotiation with the payer, the reschedule that takes a decision.

Human takeover exists for that: anyone at the front desk can take any conversation at any moment, and the agent goes quiet in that chat until the card is handed back. On the billing side the effect is the same: the team needed to check the same volume gets smaller, and doubling the number of claims stops meaning doubling the team that checks them.

Bring us the bottleneck that hurts in your hospital today

Tell us which of the three fronts is stuck — the phone, the schedule or the denied claim. We'll design the agent that works on it with you, with the integrations and the governance your case demands.