FlitDocs

When Flit cannot answer

One day a call to Flit will time out. What your code does then is a decision about your business, and it is better made now than found out during an incident.

Choose per path

PathWith no answerBecause
Signup, loginLet it through.Refusing every customer for the length of an outage costs more than the fraud that gets in during it. Whatever got in is still judged when it tries to move money.
Password reset, credential changeLet it through, or ask for a second factor.If you have a second factor to fall back on, use it.
Money leavingRefuse or hold.No decision, no payout. A payout made late is an inconvenience. A payout made wrongly is gone.

Set a timeout

A decision is normally quick. Do not wait indefinitely for the one that is not.

  • Two seconds on signup and login. Past that, the customer is already waiting on you.
  • Five seconds on payouts. Flit gives its own rules three seconds before it answers with what it has, so a five-second wait hears that answer and a two-second wait may not.
try:
    decision = ask Flit, giving up after 2 seconds
except no answer:
    if money is leaving:  hold the payout, tell operations
    else:                 carry on, and count it

switch decision.verdict: …

Count the times you carried on without an answer, and alert on the count. A slow rise is the earliest sign something is wrong between you and Flit.

What no answer looks like

What you seeTreat it as
Your timeout, or a connection errorNo answer.
Status 500, code server_errorNo answer. The body says so: "Treat this as no decision."
Status 503No answer.
Status 429No answer for this event. Slow down; Retry-After says for how long. See Errors.
Status 400, 401 or 403A bug on your side, not an outage. The event was malformed or the key is wrong. Apply the same fallback, and page someone: this does not fix itself.

An answer that is missing something

Flit answers even when part of it could not run. The answer says what was left out, in degraded:

"degraded": [
  { "rule": "IPReputationRule", "reason": "timeout" }
]

Each entry is a rule that ran out of time or failed, and each also appears in factors as rule_unavailable. What Flit does about it depends on the rule:

  • A rule that only adds evidence is left out. The decision is made on the rest.
  • A rule that enforces a limit of yours cannot be skipped safely. The decision is sent to review.
  • Outflow caps and beneficiary control follow their own fail setting, which is block unless you changed it: a payout Flit could not measure is refused.

For a login, a verdict with something in degraded is still a verdict. For a payout, read degraded: if it is not empty and the verdict is allow, the cautious choice is to hold.

The time Flit allows its rules is latency_budget_ms on your policy, 3,000 by default. Lowering it gets answers sooner with more left out.

Retrying

Flit does not recognise an event it has seen before. Every call is a new decision, counted again by every rule that counts.

  • A login or signup: one retry is harmless. More than one from many servers at once makes an outage worse.
  • A payout: do not retry automatically. If the first call reached Flit and was allowed, its amount already counts against your caps, and the retry counts it a second time. Hold the payout and ask once more when a person or a queue picks it up.

Use the same event id when you do ask again. Outcomes reported by event_id are attached to the latest decision for it.

Send events when they happen

An event has no time of its own. Flit judges it as happening when it arrives, so a queue that delivers logins five minutes late turns "a login seconds after a reset" into two unrelated events. If you must queue, queue the payouts' fallbacks, not the events.

Is it Flit?

GET https://api.agentflit.com/health/ready/ needs no key. It answers 200 when Flit can reach its database and its cache, and 503 with which one it cannot.