Protocol-Layer Design for Conversational and Execution Agents
Combining a conversational agent that plans with an execution agent that acts looks complementary, but glueing their free-text outputs together fails on handoff, state, permissions, semantics, recovery, and audit. This article argues for planner–executor separation via structured task contracts, events, and shared schemas, covering schema-ref data, identity and capability tokens, semantic annotations, and long-running state machines, plus a layered design, a pre-combination checklist, and when not to combine.
1. Why “just wire them together” is the default impulse
When shipping agent applications, a natural idea is: conversational agents understand needs, clarify goals, decompose work, and explain results; execution agents operate UIs, fill forms, call tools, read environment state, and move workflows forward. Why not compose them so one “thinks” and the other “does”?
The idea is attractive. Conversational agents often “explain well but cannot finish”: they produce plans without stable environment control, or describe API fields without tracking a long job. Execution agents often “finish but cannot explain”: they click, submit, and read pages, but struggle with intent clarification, exception meaning, replanning, and summarization. The two look complementary.
Direct combination is not concatenating one agent’s output into the other’s input. Once a system is running, developers hit lower-level issues: how context is handed off, who owns task state, how permission is delegated, how results are interpreted semantically, how failures recover, and how the audit trail closes. Longer system prompts do not solve these; they are protocol and contract problems.
2. Capability boundaries and composition risks
Conversational agents excel at natural-language understanding and generation: clarification, decomposition, planning, explanation, exception narrative, and multi-turn follow-up. They are weak at continuous environment state and unstable tool chains; multi-step confirmation, changing pages, and long workflows invite plan drift.
Execution agents excel at environment interaction: action sequences such as reading a page, locating elements, filling fields, triggering operations, and collecting observations. They are weaker at fine-grained intent, clarifying fuzzy requirements, and explaining business meaning of errors, and they need extra guardrails for high-risk actions.
Naive chaining typically yields:
- Context bloat and information loss together. The planner sends long natural-language plans; the executor returns bulky page observations. Context explodes while constraints, permission bounds, and forbidden actions drown.
- Error amplification. A vague planner step becomes a wrong action; unstructured failure observations are misread by the planner as “retry.”
- Privilege expansion. The planner speaks for the user; the executor acts for the system. Without an explicit delegation chain, the executor may exceed original authorization.
- Inconsistent state. The planner thinks the task is “awaiting confirmation” while the executor has already submitted; the executor thinks “done” while the planner still waits for observations. Without a shared state machine, each side keeps its own “facts.”
- Hard audits. After the fact it is difficult to answer who initiated an action, under which user grant, which agent executed it, what was observed, and why it retried. Log text alone rarely forms a verifiable chain.
Feasibility depends less on “can we call” than on “can we define the contract.”
3. Recommended architecture: plan–execute separation, not prompt stitching
Treat composition as a control-plane / data-plane split. The conversational agent is the control plane: intent, decomposition, risk judgment, and explanation. The execution agent is the execution plane: environment operations, observation, and action feedback. They communicate through structured task contracts, event streams, and shared schemas—not free text.
A simplified task contract (illustrative only, not a product API):
{"protocol_version": "example-1","message_id": "msg-001","task_id": "task-2024-001","sender": {"agent_type": "planner","agent_id": "planner-a","delegated_by": "user-123","capability_scope": ["read:catalog", "write:cart"]},"intent": "Search for products and add to cart","constraints": {"forbidden_actions": ["submit_payment"],"require_confirmation": ["delete_item"],"deadline": "2024-06-01T12:00:00Z"},"steps": [{"step_id": "s1","action": "search","schema_ref": "catalog.item.v1","params": {"keyword": "example"}},{"step_id": "s2","action": "add_to_cart","schema_ref": "cart.mutation.v1","depends_on": ["s1"],"idempotency_key": "task-2024-001-s2"}]}
The executor returns events with status, observations, error classification, and audit fields—not ad hoc prose:
{"task_id": "task-2024-001","step_id": "s1","event": "observation","status": "succeeded","schema_ref": "catalog.item.v1","payload": {"rows": [{"id": "p1", "name": "Sample product", "price": {"amount": 99, "currency": "CNY"}}]},"audit": {"executed_by": "executor-b","started_at": "2024-06-01T10:00:00Z","finished_at": "2024-06-01T10:00:03Z"}}
The planner need not guess what happened; the executor need not infer permissions from prose. Collaboration is around task IDs, step IDs, schema refs, a state machine, and audit fields.
4. Four protocol problems to solve first
4.1 Repeated schemas: do not resend field names on every row
When agents hit paginated or structured APIs, a typical waste is repeating field names on every row and page. The model already learned the shape from the first response, but the wire still sends names, inflating context and transfer cost. In schema-heavy APIs this share can be large; measure with reproducible benchmarks rather than intuition.
Prefer “schema ref + rows”: declare the schema once, then send identifier, version, and values. Query APIs that drop unused fields only partly help if names still travel with every record.
Example:
{"schema_ref": "catalog.item.v1","schema_inline": {"fields": [{"name": "id", "type": "string"},{"name": "name", "type": "string"},{"name": "price", "type": "object"},{"name": "inventory", "type": "integer"}]},"rows": [["p1", "Sample product", {"amount": 99, "currency": "CNY"}, 12],["p2", "Another product", {"amount": 199, "currency": "CNY"}, 3]]}
Later messages can send only schema_ref; the receiver resolves it from a shared registry. That cuts repetition and anchors validation.
4.2 Agent identity and delegation: the server must know who you are and whom you represent
Composition magnifies identity. Users authorize the planner for a class of tasks; the planner delegates actions. The server must answer: who issued the executor? which user does it represent? what is its capability scope? was the user confirmed? was it revoked? how long is the chain?
Stuffing a token into a generic auth header can work briefly, but every team reinvent fields and checks, and privilege expansion is easy. Separate identity (“who I am”), capability tokens (“what I may do”), delegation (“whom I represent”), and audit IDs (“how to trace”). High-risk actions should require short-lived, least-privilege, revocable capability tokens, with user confirmation checked before execution.
4.3 Semantics cannot live only in system prompts
Without explicit field semantics, the planner guesses: timestamp vs formatted string; whether status 2 means shipped or canceled; currency unit; whether inventory 0 is out of stock or uninitialized. Packing all of that into prompts works briefly and becomes an unmaintainable implicit protocol.
Carry annotations in the schema: meaning, units, enum maps, time formats, constraints, sensitivity, and displayability. The planner uses them for explanation; the executor uses them for validation. Semantics become a shared contract, not a private prompt.
4.4 Long-running state, idempotency, and recovery
Composed systems are rarely one request–response. They include multi-step actions, human confirmation, retries, and timeouts. The protocol needs a task state machine, for example created, planning, awaiting confirmation, executing, partial success, retryable failure, non-retryable failure, canceled, completed. Actions need idempotency keys so retries do not double-submit; steps need checkpoints for recovery from the last stable state; cancel and timeout must propagate to the executor.
Without this, the planner can only say “try again” in natural language, and retry semantics are uncontrolled.
5. Layered design for composition
Split communication so each layer owns one class of problem:
- Transport binding. How messages are carried: request–response, streaming events, long-lived connections. Keep business semantics out of transport.
- Message framing. Message ID, task ID, step ID, type, status, error class, extensions—correlation and deduplication.
- Session and identity. Agent identity, user delegation, capability scope, expiry, revocation, audit principal.
- Schema and semantics. Structure, version, field meaning, enums, units, validation, schema refs.
- Capability and orchestration. Action capabilities, dependencies, confirmation policy, idempotency keys, retry policy, task state machine.
Do not implement all five at once. Start with a minimal loop: unify task and step IDs, then schema refs, then capability tokens, then semantic annotations and the state machine. Each layer improves observability and recoverability.
6. Go-live checklist
Before “direct composition,” answer:
- Are planner vs executor responsibilities clear: who clarifies, who executes, who explains?
- Does every task have a unique task ID? Does every action have a step ID and idempotency key?
- Does the executor return free text, or structured events with status, error class, and schema refs?
- How does user authorization become capability tokens? Is the delegation chain traceable? Do high-risk actions require a second confirmation?
- Do field semantics live in a shared schema, not scattered system prompts?
- Can long tasks recover from checkpoints? Do cancel and timeout propagate?
- Can audit logs answer who initiated, on whose behalf, what ran, what was observed, and why it retried?
If most answers are missing, “direct combination” likely joins two incomplete systems into one that is harder to debug.
7. When not to combine directly
Composition is not always best. Short, low-risk, few-action tasks may be simpler by strengthening one agent’s tools. Strict isolation can make cross-agent delegation a larger attack surface. Tight latency budgets suffer from an extra plan–execute hop. Unstable business processes make early complex protocols over-design.
A safer path: complete a single-agent loop first and settle schemas, permissions, state, and audit fields; when conversational and execution skills must collaborate long term, promote those fields into a shared contract. Value is not “wired fast” but “wired clearly, runs stably, and can be investigated.”
Conclusion
Combining conversational and execution agents is viable, but the core is not glueing two agents with a prompt. It is a shared task contract, identity delegation, schema semantics, and a state machine. Schema repetition, homeless identity, guessed semantics, and unrecoverable long tasks can hide in a single agent and explode in composition. Settle the protocol layer before “direct combination” if the system is to move from demo to production.
