Skip to content

feat: multi-directional agent orchestration#25

Merged
artugro merged 5 commits intomainfrom
feat/multi-directional-orchestration
Apr 9, 2026
Merged

feat: multi-directional agent orchestration#25
artugro merged 5 commits intomainfrom
feat/multi-directional-orchestration

Conversation

@artugro
Copy link
Copy Markdown
Collaborator

@artugro artugro commented Apr 1, 2026

Summary

  • Communication Networks: New first-class entity (CommunicationNetwork) that groups agents into networks with shared conversational context, solving the invocability asymmetry where only orchestrators could initiate communication
  • Three communication channels: synchronous calls (blocking HTTP), near-real-time messages (webhook push), and async mailboxes (polling) — each with different timing semantics matching real-world communication patterns
  • Bidirectional communication: External agents receive a reply_url in every payload, enabling them to proactively push messages back into the network via callback endpoints
  • Complex topologies: loop step type with convergence detection (similarity, approval, max iterations) for feedback cycles like writer/critic; aggregate step type with fan-in strategies (merge, vote, LLM summarize); topology validation (mesh, star, ring)
  • A2A protocol alignment: Agent Card generation, JSON-RPC protocol adapter, and A2A-compatible endpoints for interoperability with Google's Agent-to-Agent protocol

New modules

Path Purpose
src/network/models/ SQLAlchemy models + Pydantic schemas (3 tables, 6 enums)
src/network/repositories/ CRUD + context retrieval
src/network/services/ Network management + channel service (calls/messages/mailboxes)
src/network/routes/ REST endpoints for networks, channels, and callbacks
src/network/utils/ Context manager, topology validation, convergence detectors, aggregators, delivery worker
src/network/a2a/ Agent Card generation, protocol adapter, A2A routes

Modified files

  • src/workflow/models/dsl.py — Added LoopConfig, AggregateConfig, ConvergenceConfig
  • src/workflow/utils/orchestrator.py — Added _handle_loop() and _handle_aggregate() handlers
  • src/workflow/utils/dsl_parser.py — Validation for loop/aggregate step types
  • src/core/settings.py — 5 new network settings
  • src/main.py — Mounted 4 new routers, updated /.well-known/agent.json

Test plan

  • Run alembic upgrade head to verify migration applies cleanly
  • Create a network via POST /networks, add participants with callback URLs
  • Test bidirectional flow: agent A calls agent B → B responds via callback endpoint
  • Define a workflow with loop step (writer/critic cycle) → verify convergence
  • Define a workflow with aggregate step → verify fan-in works
  • Verify GET /.well-known/agent.json returns updated platform card
  • Test A2A endpoints: GET /a2a/agent-card, POST /a2a/tasks/send

🤖 Generated with Claude Code

@artugro artugro force-pushed the feat/multi-directional-orchestration branch from c4a0ee8 to 1b621ec Compare April 1, 2026 19:39
… mailboxes

Add communication network infrastructure enabling bidirectional,
topology-rich agent communication. External agents can now proactively
send messages back via callback URLs (reply_url pattern), solving the
invocability asymmetry where only orchestrators could initiate.

Phase 1 - Network foundation: CommunicationNetwork, NetworkParticipant,
NetworkMessage models with Redis-backed context accumulation.

Phase 2 - Three communication channels: synchronous calls, near-real-time
messages (webhook push), and async mailboxes (polling). Callback endpoint
enables external agents to push messages into the network.

Phase 3 - Complex topologies: loop steps with convergence detection
(similarity, approval, max iterations), fan-in aggregation (merge, vote,
LLM summarize), and topology validation (mesh, star, ring).

Phase 4 - A2A protocol alignment: Agent Card generation, JSON-RPC
protocol adapter, and A2A-compatible endpoints for interoperability
with Google's Agent-to-Agent protocol.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@artugro artugro force-pushed the feat/multi-directional-orchestration branch from 1b621ec to f2bdedb Compare April 1, 2026 19:40
artugro and others added 4 commits April 1, 2026 13:52
Add discovery service that fetches remote A2A Agent Cards, registers
them in the Intuno registry, generates embeddings, and indexes them
in Qdrant. Imported A2A agents become fully discoverable, invocable,
and can join communication networks — identical to natively registered
agents.

New endpoints:
- POST /a2a/agents/import — import single agent by URL
- POST /a2a/agents/import/batch — import multiple agents
- POST /a2a/agents/{id}/refresh — re-fetch card and update
- GET /a2a/agents/fetch-card?url= — preview card without importing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add NETWORKS.md covering communication channels, topologies, workflow
loops/aggregation, and the reply_url bidirectional pattern. Add A2A.md
covering agent import, discovery, protocol mapping, and examples.
Update PROJECT.md with new concepts and doc index. Update
API_ENDPOINTS.md with all network, channel, callback, and A2A endpoints.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Tests cover the full network lifecycle: create network, add participants,
exchange messages and mailbox items, verify shared context, bidirectional
callbacks, multi-participant context sharing, A2A platform card, agent
card generation, and agent-linked participants.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* feat: add safety governance layer with kill switch and admin controls

Add platform-wide emergency halt, per-agent kill switch, and admin API
to enable ethical control over AI agent operations. This ensures all
communication paths (broker, streaming, networks, A2A, workflows) can
be shut down instantly when needed.

- Add is_admin to User model with migration
- Add SafetyService with Redis-backed platform halt and agent status cache
- Add admin auth dependency (get_admin_user)
- Add admin API: kill/reactivate agents, halt/resume platform, status
- Expose is_active in AgentUpdate schema
- Enforce platform halt check at all communication chokepoints
- Fix streaming broker path missing is_active check
- Add agent-level active checks in network channel validation
- Add PlatformHaltedException (503) and AgentDisabledException (403)
- Filter inactive agents in workflow resolver discovery

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* feat: add distributed halt codes and public safety endpoints

Trustees can halt the platform with a code — no JWT needed. Codes are
bcrypt-hashed, shown once on creation, and managed by admins. Asymmetric
by design: easy to stop (code), hard to restart (admin auth).

- Add HaltCode model and migration
- Add public POST /safety/halt (code-authenticated)
- Add public GET /safety/status
- Add admin endpoints: create/list/revoke halt codes
- Register safety router in main.py

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@artugro artugro merged commit 755a580 into main Apr 9, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant