Skip to content

feat: A2A-based internal agent coordination (replace hardcoded Lex function calls) #34

Description

@alfonsosastre

Manifesto alignment

Section VIII names "agent-native orchestration protocols" as a required primitive. lex-code builds the A2A protocol (via lex-agent) and then doesn't use it for its own multi-agent coordination. multi_agent.lex uses hardcoded Lex function calls between agents — the exact opposite of protocol-based coordination with declared capabilities and spec-gated preconditions.

Problem

multi_agent.lex currently:

fn run_parallel(task, provider) -> ... {
  let impl_steps := ag.run_loop_traced(build_agent.agent(), ...)
  let test_steps := ag.run_loop_traced(test_agent.agent(), ...)
  ...
}

This is direct function call orchestration. There are no capability declarations, no precondition gates, no audit trail of agent-to-agent communication. The trust model does not apply.

Design

Refactor multi-agent coordination so each agent exposes an A2A skill, and the orchestrator sends tasks via lex-agent/client rather than calling run_loop directly.

Each agent gets an A2A server endpoint (even if in-process via a channel/actor):

  • build_agent skill: implement
  • spec_agent skill: specify
  • test_agent skill: test
  • review_agent skill: review

The orchestrator composes pipelines by sending A2A tasks/send messages and receiving SSE progress frames. All coordination is logged in lex-trail as a2a.task.* events.

Benefits

  • Every agent-to-agent call has an attestation record
  • Spec preconditions can gate agent invocations (e.g. "only run test_agent if build_agent completed successfully")
  • Orchestration topology becomes inspectable from the trail log, not just from reading source code

Dependency

Acceptance

  • multi_agent.lex orchestrates via A2A protocol calls, not direct run_loop invocations
  • Trail log shows a2a.task.received, a2a.task.state_change, a2a.message.sent for each agent invocation
  • lex check --strict src/ passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions