
Where Pilot Fits with TCP, gRPC, and NATS
TCP, gRPC, NATS, and Pilot solve different layers of an agent system. Treating them as interchangeable leads to the wrong comparison: TCP moves bytes, gRPC defines typed remote calls, NATS routes messages through a broker, and Pilot provides identity-aware reachability across networks.
This guide maps those responsibilities so you can combine the right tools instead of forcing one protocol to do every job. If your primary decision is between brokered messaging and typed RPC, start with our focused NATS versus gRPC guide.
Four Tools, Four Different Jobs
Raw TCP provides a reliable, ordered byte stream between reachable endpoints. Your application supplies message framing, serialization, authentication, encryption, discovery, and retry behavior.
gRPC provides contract-first remote procedure calls over HTTP/2. Protocol Buffers, streaming, deadlines, and interceptors make it a strong application interface once clients can reach a server.
NATS provides brokered publish/subscribe and request/reply messaging. Core NATS emphasizes low-latency delivery; JetStream adds configurable persistence and replay.
Pilot Protocol provides an overlay for agent identity, discovery, reachability, and encrypted peer paths. Its registry and beacon coordinate discovery and traversal; payloads take a direct encrypted path when possible and use an encrypted relay fallback when necessary.
Capability and Responsibility Matrix
| Concern | TCP | gRPC | NATS | Pilot |
|---|---|---|---|---|
| Primary role | Byte transport | Typed RPC | Brokered messaging | Agent reachability overlay |
| Endpoint discovery | External | DNS, resolver, or control plane | Reachable server plus subjects | Registry and names |
| Cross-network reachability | Requires a route | Requires a route to the server | Clients reach a broker | Traversal with relay fallback |
| Encryption | TLS or another layer | TLS supported; policy decides | TLS to servers; account controls | X25519 + AES-256-GCM payload tunnels |
| Application schema | Build or choose one | Protocol Buffers | Application-defined messages | Application-defined byte streams and services |
| Persistence | External | External | JetStream, when configured | External |
| Infrastructure | Reachable endpoints | Reachable services and resolution | Server or cluster | Registry and beacon coordination |
| Client ecosystem | Universal | Mature, multi-language | Mature, multi-language | Daemon plus Go, Node.js, Python, and Swift integrations |
The table is intentionally not a scorecard. Persistence is central to an event log but unnecessary for a live control channel. Likewise, traversal matters only when peers cannot already reach one another.
Reachability Is a Topology Question
TCP and gRPC can operate across private or public networks as long as routing, firewall policy, and name resolution expose the intended service. A VPN, ingress proxy, private link, or service mesh can provide that reachability. None of those choices is inherently wrong; they simply become part of the operating model.
NATS changes the topology. Clients make outbound connections to a reachable NATS deployment, and subjects decouple producers from individual consumer addresses. The server remains in the message path, which is useful when the broker's routing, queueing, or persistence behavior is the point.
Pilot separates coordination from payload transport. The registry and beacon are still infrastructure: they support registration, discovery, traversal coordination, and relay fallback. Once a path is established, peers exchange encrypted payloads directly when network conditions allow. When they do not, relay fallback preserves reachability without exposing payload plaintext to the relay.
For a closer look at the coordination and data paths, read how Pilot Protocol works.
How to Compare Performance Honestly
There is no responsible universal latency or throughput ranking for these four tools. A useful benchmark must keep the workload and topology explicit:
- Path: same host, same region, cross-region, direct peer path, or relay path.
- Connection lifecycle: cold setup, warm connection reuse, reconnect, and failover.
- Payload: size, frequency, concurrency, serialization, and compression.
- Delivery contract: fire-and-forget, request/reply, acknowledgement, persistence, or replay.
- Security: identical authentication and encryption requirements for every candidate.
- Runtime: client language, host size, kernel settings, and broker or relay configuration.
For warm connections carrying typical agent messages, network round-trip time often dominates framing differences. Broker hops, relay paths, persistence, and cold handshakes can change that result. Benchmark the exact route and delivery guarantees you plan to operate, and publish the harness alongside any numbers you use to make a decision.
Choose TCP for a Deliberately Small Abstraction
Raw TCP is appropriate when you control both endpoints, already have routing, and want to own the application protocol. It is a strong foundation for bulk transfer and purpose-built internal systems. Its simplicity is also its tradeoff: identity, framing, authentication, observability, and reconnection belong to your code or to another layer.
// TCP supplies the stream; your application supplies the contract.
conn, err := net.Dial("tcp", "agent-b.internal:8080")
// Add framing, authentication, encryption, and retry policy.
Choose gRPC for Typed Service Contracts
gRPC fits structured request/reply or streaming APIs where schema evolution and generated clients matter. It works especially well inside environments that already provide service discovery, routing, certificates, and observability. TLS is supported and commonly deployed, but the security policy is a deployment decision rather than a property of every gRPC connection.
Use gRPC when the central question is, “What operations does this service expose?” Pair it with a reachability layer when clients and servers do not share a routable environment.
Choose NATS for Brokered Messaging Semantics
NATS is a natural fit for subject-based publish/subscribe, queue groups, and request/reply through a shared messaging plane. JetStream is useful when consumers need persistence, replay, or stronger delivery controls. Operating a server or cluster is not incidental overhead; it is what makes those brokered capabilities possible.
Use NATS when the central question is, “How should messages be routed, buffered, and consumed?” Read the dedicated NATS and gRPC comparison for a decision focused on those two application patterns.
Choose Pilot for Agent Identity and Reachability
Pilot is designed for agents that move between networks or need to communicate without exposing a new public endpoint for every service. A retained cryptographic identity maps to a stable Pilot address, while the local daemon manages discovery, traversal, encrypted tunnels, and relay fallback.
Pilot does not replace an RPC schema, durable log, business authorization model, or application-level governance. Those concerns remain explicit. Pilot supplies the network path and peer identity on which those controls can operate.
The daemon can be used from Go, Node.js, Python, and Swift integrations, and the gateway can bridge existing TCP-speaking applications onto the overlay. See the gateway documentation and private agent network overview for the two common adoption paths.
The Most Useful Architectures Combine Layers
- gRPC over an existing private network: use your current routing and let gRPC define the service contract.
- NATS for fleet events: use subjects, queue groups, and JetStream where centralized routing or replay is valuable.
- Pilot plus an existing TCP service: use the gateway or local integration to give an existing service an encrypted cross-network path.
- Pilot plus application authorization: use Pilot identity for the peer and keep role, spend, data, and action policies in the application or control plane.
Decision rule: choose the application protocol for message semantics, then choose the network layer for identity and reachability. A typed API, message broker, and agent overlay can be complementary rather than competing purchases.
A Practical Selection Checklist
- Do all intended endpoints already have a controlled, routable path?
- Do you need typed RPC, brokered events, durable replay, or only a byte stream?
- Must peers retain identity while IP addresses and networks change?
- Where may payload plaintext appear, and who operates each intermediary?
- Which controls belong at the network, application, and organizational layers?
- What cold-path, warm-path, failure, and recovery cases will you benchmark?
Your answers usually identify a combination, not a single winner. That is the useful outcome: fewer hidden assumptions and a stack whose responsibilities are clear.
Map Pilot to Your Existing Stack
Start with one service that is difficult to reach across environments. Keep its application protocol and test Pilot as the identity and connectivity layer.
Discuss an architecture