Skip to content
Sefra

Product

How Sefra works

One execution from submission to record: the stages it passes, what can end it at each, and the stable code the agent gets back.

The ten stages

Every submission, a single intent or a plan, goes through the same pipeline. Each refusal after authentication is a stable code, except a direct call to an unknown tool, which gets the protocol's error.

Inside the request

Stages 1 to 7 run synchronously. A refusal here happens before any write to a system of record.

  1. 1

    Authenticate

    The caller's token maps to a principal. A failure is HTTP 401, and no execution is created.

    Can end it with

    • HTTP 401
  2. 2

    Admission

    Global pause, a suspended principal, the principal's rate limit. A trial or pilot whose licence has ended is refused here too.

    Can end it with

    • PAUSED
    • PRINCIPAL_SUSPENDED
    • RATE_LIMITED
    • LICENSE_EXPIRED
  3. 3

    Resolve and grants

    The intent exists in the active bundle, the caller has a grant, it is not disabled, and its rate limit has room.

    Can end it with

    • UNKNOWN_INTENT
    • INTENT_DISABLED
    • RATE_LIMITED
  4. 4

    Idempotency

    A key is present where required. A known key returns the existing execution.

    Can end it with

    • IDEMPOTENCY_KEY_MISSING
    • IDEMPOTENCY_KEY_REUSED
  5. 5

    Validate

    Input schemas and plan rules. Every schema violation is reported with its path.

    Can end it with

    • SCHEMA_VIOLATION
    • PLAN_INVALID
  6. 6

    Pre-flight

    Facts are read from the system of record, and policy is evaluated for every step.

    Can end it with

    • FACT_UNAVAILABLE
    • POLICY_ERROR
    • POLICY_DENIED
  7. 7

    Accept

    One database transaction stores the execution, binds the key, creates any approval and appends the audit events. The workflow starts.

    Can end it with

    No refusal at this stage.

In a durable workflow

Stages 8 to 10 survive a process crash. The request waits up to 10 seconds for a final status, then the agent polls with its handle.

  1. 8

    Hold

    If policy asked for a person, the execution waits for a decision, a cancellation or expiry.

    Can end it with

    • APPROVAL_DENIED
    • APPROVAL_EXPIRED
    • CANCELLED
  2. 9

    Execute

    For each step in order: runtime controls, references resolved and validated, facts read again, policy evaluated again, then the call with Sefra's credentials.

    Can end it with

    • PAUSED
    • PRINCIPAL_SUSPENDED
    • INTENT_DISABLED
    • SCHEMA_VIOLATION
    • POLICY_DENIED
    • POLICY_ERROR
    • FACT_UNAVAILABLE
    • APPROVAL_SCOPE_EXCEEDED
    • DOWNSTREAM_REJECTED
    • DOWNSTREAM_UNAVAILABLE
    • DOWNSTREAM_OUTCOME_UNKNOWN
  3. 10

    Compensate

    If a step fails after earlier steps took effect, those are undone in reverse order. The execution ends rolled_back, or needs_intervention if an undo cannot complete.

    Ends as

    • rolled_back
    • needs_intervention

The nine statuses an agent can see

Every tool returns the same envelope, reduced when there is no execution to describe. Its status says where the execution stands and whether the agent should keep asking.

Not final

The agent polls again.

  • Pending approvalpending_approval

    Accepted and held for a person. Nothing has executed.

  • Executingexecuting

    Steps are running, or the execution is queued to start.

  • Compensatingcompensating

    A step failed and completed steps are being undone.

  • Needs interventionneeds_intervention

    A compensation could not complete, or an outcome is unknown. Frozen until an operator acts. The agent must not submit it again.

Final

The execution is over.

  • Succeededsucceeded

    Every step executed.

  • Rejectedrejected

    Refused before any step executed.

  • Failedfailed

    Stopped, and no step had taken effect, so nothing needed undoing.

  • Rolled backrolled_back

    A step failed after earlier steps took effect, and every one of those has been compensated.

  • Resolved manuallyresolved_manually

    An operator closed it after fixing the systems by hand, with a note.

What Sefra is not

These are outside its job.

Not an ERP
It replaces none. It stores no orders, customers or ledgers.
Not a data layer
It never reads or writes a customer database directly. It calls the systems' APIs, so each system's own validation still applies.
Not an agent framework
It does not run models, hold conversation state, plan tasks or count tokens.
Not a guarantee that agents are right
It bounds the damage of a wrong request to what policy allows. A wrong request that policy allows will execute.
Not a transaction manager
Compensation is a business-level reversal, not a database rollback. Others may see the intermediate state, and some actions cannot be reversed at all.
Not a universal connector
Each intent has to be defined by someone who knows the target system, including how to undo it.
Not a prompt-injection filter
It is not a content scanner either. It judges the typed request, not the text that led to it.

Start with a pilot

Stopping an agent is the easy half. Sefra also finishes the job.