EdgeStream
@edge-stream/ancp
ANCP — Agent Node Communication Protocol — is the lowest-level messaging protocol in EdgeStream. It defines the binary envelope format and message exchange patterns used between agent nodes in a distributed Octopus processing graph. Other plugins can use ANCP envelopes internally.
Installation
pnpm add @edge-stream/ancp
What is ANCP?
ANCP is a protocol layer that sits below the domain plugins. While workflow.* and agent.* messages carry business domain content, ANCP messages carry infrastructure-level communication between agent nodes:
- Heartbeat messages: keep agent-to-node connections alive
- Capability negotiation: agents advertise what they can process
- Flow control: backpressure signals when queues fill
- Routing directives: instructions for re-routing message flows
- Acknowledgment frames: reliable delivery confirmation at the protocol level
Topic Namespace
ancp.heartbeat // keep-alive between agent and node
ancp.capability.* // capability advertisement and negotiation
ancp.flow.control // backpressure and flow control signals
ancp.route.* // routing table updates and directives
ancp.ack // delivery acknowledgment
ancp.error // protocol-level error
Key Exports
import {
AncpPlugin, // IMessagePlugin implementation
AncpTopics, // topic constants
AncpHeartbeatHook, // handles heartbeat / keep-alive
AncpFlowControlHook, // implements backpressure
// TypeScript interfaces
type AncpHeartbeatMessage,
type AncpCapabilityMessage,
type AncpFlowControlMessage,
type AncpAckMessage,
type AncpErrorMessage,
} from '@edge-stream/ancp';
When to Use ANCP
| Scenario | Use ANCP? |
|---|---|
| Building or consuming workflow events | No — use @edge-stream/workflow-events |
| Building an Octopus chat UI | No — use @edge-stream/agent-messages |
| Building a new agent node implementation | Yes — ANCP for protocol-level communication |
| Implementing agent-to-node backpressure | Yes — AncpFlowControlHook |
| Building infrastructure monitoring for agent networks | Yes — subscribe to ancp.* topics |
ANCP in the DevTools
The EdgeStream DevTools app includes an ANCP view that shows the live protocol message exchange between agent nodes — heartbeat timing, capability negotiations in progress, and any flow control events. This is useful for debugging agent network topology issues.
// In DevTools, subscribe to ANCP topics to monitor protocol health
stream.subscribe('chat', 'ancp.*', (envelope) => {
ancpMonitor.recordEvent(envelope.meta.topic, envelope.body);
});
Next: Dev Tools
See how to use the EdgeStream DevTools app — including the ANCP protocol view, Node Explorer, and Action Invoker. See Guide 11: DevTools.