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
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
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
PAUSEDPRINCIPAL_SUSPENDEDRATE_LIMITEDLICENSE_EXPIRED
- 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_INTENTINTENT_DISABLEDRATE_LIMITED
- 4
Idempotency
A key is present where required. A known key returns the existing execution.
Can end it with
IDEMPOTENCY_KEY_MISSINGIDEMPOTENCY_KEY_REUSED
- 5
Validate
Input schemas and plan rules. Every schema violation is reported with its path.
Can end it with
SCHEMA_VIOLATIONPLAN_INVALID
- 6
Pre-flight
Facts are read from the system of record, and policy is evaluated for every step.
Can end it with
FACT_UNAVAILABLEPOLICY_ERRORPOLICY_DENIED
- 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.
- 8
Hold
If policy asked for a person, the execution waits for a decision, a cancellation or expiry.
Can end it with
APPROVAL_DENIEDAPPROVAL_EXPIREDCANCELLED
- 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
PAUSEDPRINCIPAL_SUSPENDEDINTENT_DISABLEDSCHEMA_VIOLATIONPOLICY_DENIEDPOLICY_ERRORFACT_UNAVAILABLEAPPROVAL_SCOPE_EXCEEDEDDOWNSTREAM_REJECTEDDOWNSTREAM_UNAVAILABLEDOWNSTREAM_OUTCOME_UNKNOWN
- 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_backneeds_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 approval
pending_approvalAccepted and held for a person. Nothing has executed.
-
Executing
executingSteps are running, or the execution is queued to start.
-
Compensating
compensatingA step failed and completed steps are being undone.
-
Needs intervention
needs_interventionA 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.
-
Succeeded
succeededEvery step executed.
-
Rejected
rejectedRefused before any step executed.
-
Failed
failedStopped, and no step had taken effect, so nothing needed undoing.
-
Rolled back
rolled_backA step failed after earlier steps took effect, and every one of those has been compensated.
-
Resolved manually
resolved_manuallyAn 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.