Execution lifecycle
Every request processed by Seepient moves through an eight-step pipeline. This lifecycle guarantees that language models never execute unchecked operations on the host system.
Surface ingestion
Context assembly & skill resolution
Model routing & streaming inference
Tool call interception & PreparedActionDraft creation
Policy evaluation & consent check
Approval broker
Sandboxed execution & exact file commit
Output delivery & tamper-evident audit commit
Step 1: Surface ingestion
A prompt enters through one of the supported interfaces:
- An interactive prompt in the full-screen terminal UI.
- A command argument or stdin pipe in the CLI.
- An HTTP
POST /v1/sessions/:id/messagescall or incoming WebSocket payload. - A programmatic call to
agent.chat(prompt)in the TypeScript SDK.
The surface validates the payload, checks authentication if running over HTTP/WS, and attaches or creates a session context.
Step 2: Context assembly and skill resolution
Before querying an upstream model, Seepient prepares the turn context:
- Rule discovery: Loads active project instructions from
AGENTS.mdand user settings. - Skill injection: Identifies matching skills from
.agents/skills/or user-specified flags, injecting the relevantSKILL.mdinstructions into the system prompt. - Session history: Pulls prior turn messages, pruning or summarizing older messages if context limits approach the model window.
- Environment context: Detects container status, working directory path, and current system timestamp.
Step 3: Model routing and streaming inference
The router evaluates the task purpose (text, commit, plan, vision, media) and requested tier (standard, complex, efficient):
- Selects the primary model endpoint and checks circuit breaker status.
- Initiates a streaming connection to the upstream provider.
- Parses streaming tokens in real time, routing text fragments to the active surface for live display.
- If a transient network failure occurs before tokens stream to the user, the router switches to the configured fallback target.
Step 4: Tool call interception and action preparation
When the model emits a structured tool call (such as editing a file or running a bash command):
- Seepient pauses model generation.
- The capability tool parses the arguments and generates a
PreparedActionDraft. - For file mutations, the tool computes pre-image hashes of the existing file on disk and formats the proposed diff.
- For shell commands, the tool parses the command line, extracts target binaries, and flags required system capabilities (such as network access or write permissions).
Step 5: Policy evaluation and consent check
The permission engine evaluates the PreparedActionDraft against three boundaries:
- Active consent mode:
always-ask,ask-untrusted, orautonomous-trusted. - Path restrictions: Ensures file modifications target paths inside the allowed workspace root, rejecting attempts to access sensitive directories like
/etcor~/.ssh. - Self-evolution rules: Rejects attempts by the model to modify Seepient's own security boundaries, permission stores, or audit configurations without explicit out-of-band authority.
If the action is read-only or fully permitted by the active policy, it proceeds directly to Step 7.
Step 6: Approval broker
If the action requires confirmation:
- In the TUI, a modal prompt appears displaying the proposed command or a color-coded split diff of the file change. The user can approve once, approve for the remainder of the session, or reject with feedback.
- In the CLI, if
-ywas supplied, the action proceeds automatically. Otherwise, an interactive confirmation prompt appears on stderr. - Over WebSocket / HTTP, a
permission_requestevent streams to the client, which returns an approval or rejection message.
If rejected, the rejection and any user-provided explanation are returned to the model as tool output, allowing the model to propose an alternative solution.
Step 7: Sandboxed execution and exact file commit
Once approved, execution begins:
Shell execution
The command runs inside an operating system sandbox:
- macOS:
sandbox-execwith a restrictive Seatbelt profile. - Linux:
bwrap(Bubblewrap) mounting the host root read-only, with write access limited to the workspace directory.
File mutations
The change passes to the native seepient-fs-commit Rust helper. The helper performs three checks:
- Compares the current file hash against the pre-image hash recorded during preparation.
- Locates the exact search block targeted for replacement.
- Writes the updated content using atomic temporary files and filesystem renames.
If the file on disk was modified by an external process between preparation and execution, the commit aborts immediately without altering the file.
Step 8: Output delivery and audit recording
After the action completes:
- Execution stdout, stderr, and exit status return to the model as the result of the tool call.
- The model continues its reasoning loop, either generating final text or planning the next tool step.
- The audit recorder writes the full event record (timestamp, surface, model, prepared action, approval state, and execution outcome) to
~/.seepient/audit.logusing atomic fsync commits.