Skip to content
State

What holds now for each customer, with the age, the source and what may be stated.

The history says what happened; the state says what holds now. Your company declares its own state types, or Niadra derives them from your database and tells you when they change. An order, a lawsuit, a proposal, a quote: the memory reads all of them the same way. Every value reaches the agent with its age, its source and what it may not state with that data. A stale value is never refused: it comes with its age, and the agent knows what not to say with it. The official value stays in your system, and Niadra never calls it: when a value must be read again, your own code reads it, inside your company.

How it works

State read

purpose: claim example
Bill 0823 type invoice · mirrors the ERP
  • state credited yes 1 min ago · ERP, live fresh
  • credit $40.00 yes 1 min ago · ERP, live fresh
  • new payment slip issued no no 1 min ago · ERP, live the source stated there is none
Technician visit 5521 type technician_visit · mirrors the field system
  • date Sep 23, morning yes 2 h ago · field system stale for a claim: read it again before saying it
  • technician confirmed unobserved unobserved nobody observed it “not checked” does not become “no”
  • part in stock known defect source defect 10 min ago · inventory the type declares that this field of that source comes wrong
What the agent may not state with this data
  • the date of the visit
  • whether the technician is confirmed
  • whether the part is in stock

No AI model on the read, and no database statement with the state warm. The state block travels in the same request as the context and passes the same verification level.

  • Declared by your company or derived from your database schema, with the schema’s fingerprint: when it changes, Niadra opens a data issue and tells you
  • Four logical values: yes, no, unobserved and known source defect. “Not checked” never becomes “no”
  • Freshness per field, computed on the read: a price goes stale in seconds, a record in days, and a new declaration applies to every object at once
  • A quote expires the moment one of its inputs changes, not when a deadline passes
  • Sources with precedence: the system of record beats the snapshot, and what a tool showed the agent is state too, with its provenance
  • The state block travels in the same request as the context and passes the same verification level: in a V0 conversation, nothing about the customer
  • Access per field: a sensitive field never enters the context text, and the agent that needs it reads it by purpose, under the field’s rule
Before saying a value, the agent asks whether it may
from niadra import Niadra, phone
from niadra.resolvers import Resolved

def requote(ref, fields):
    # your own read of the quote, inside your company
    quote = quoting_system.read(ref.id)
    picked = {k: v for k, v in quote.items() if not fields or k in fields}
    return Resolved(picked, version=7)

niadra = Niadra(channel="whatsapp")
niadra.resolvers.register("health_quote", requote)
customer = phone(customer_phone)

with niadra.conversation(
    thread_id, subject=customer, agent_id="sales"
) as conversation, conversation.turn():
    verdict = conversation.verify_claim(
        "health_quote:op:q-77", "price_full", 511.06
    )
    if verdict.claim_safe:
        # said only because it may be claimed now
        reply = f"The plan is {verdict.value:.2f} a month."
    else:
        reply = "Let me confirm the current price and get back to you."
  • Python
  • TypeScript

From the SDK’s examples/object_state.py: a value is said only when it may be claimed now, and a stale value is read again by your own function, inside your company.

The next agent can already show up knowing.

Tell us what you are building. The people who reply are the people who write the code.