Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 1 min read

Ship Agentic AI With an Action Envelope From UI to Worker

An agent feature is not one model call. It is a contract crossing UI, API, authorization, storage, worker execution, and human review. I would make that contract explicit: type ActionEnvelope = { taskId: string;

An agent feature is not one model call. It is a contract crossing UI, API, authorization, storage, worker execution, and human review.

I would make that contract explicit:

type ActionEnvelope = {
  taskId: string;
  planVersion: number;
  actionId: string;
  tool: "filesystem" | "terminal";
  argumentsHash: string;
  approvalVersion?: number;
  replacesActionId?: string;
};

The browser approves a specific planVersion. The API stores that approval. The worker rejects an envelope if the plan changed, the action was already executed, or the arguments hash differs from what the reviewer saw.

A correction is a new action that references the failed one and its evidence. It cannot silently mutate the old row:

insert into agent_actions
(task_id, plan_version, action_id, replaces_action_id, status)
values ($1, $2, $3, $4, 'pending');

Test the seams:

Scenario Expected result
duplicate worker delivery same action result
plan revised after approval stale approval rejected
test fails new version links failure evidence
browser reconnects renders durable current state

The OpenAI Agents SDK run lifecycle documents loops involving tool calls and handoffs. Whatever SDK is used, the application still owns the durable cross-layer contract.

This vertical slice is a suitable disposable task for MonkeyCode, including its currently free-to-start browser platform. The schema above is an independent example, not a claim about MonkeyCode internals. Export the repository afterward so the same acceptance tests can run elsewhere.

I am a MonkeyCode user, not affiliated with the project. This account is under the same operator as the rest of this batch.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.