Skip to content

feat(multiagent): TPCP adapter for cross-device agent communication#1712

Open
Etriti00 wants to merge 1 commit intosipeed:mainfrom
Etriti00:feat/tpcp-multiagent
Open

feat(multiagent): TPCP adapter for cross-device agent communication#1712
Etriti00 wants to merge 1 commit intosipeed:mainfrom
Etriti00:feat/tpcp-multiagent

Conversation

@Etriti00
Copy link

Closes #294 — Multi-device agent coordination

Problem

PicoClaw's in-process blackboard is excellent for coordinating agents on a single device, but offers no solution once agents are on separate machines (Raspberry Pi → cloud VM → laptop). Issue #294 asked for a network-level transport that fits naturally alongside the existing architecture.

Solution

This PR adds pkg/multiagent/tpcp — a thin, idiomatic Go adapter around the TPCP (Telepathy Communication Protocol) SDK. TPCP provides:

  • Ed25519-signed envelopes — every message is cryptographically signed; the receiver verifies before accepting
  • Dead-letter queue — messages to offline peers are queued and delivered when connectivity resumes (no lost tasks)
  • CRDT state sync — optional shared state that converges automatically across nodes
  • Relay for NAT traversal — agents behind firewalls connect via wss://relay.agent-telepathy.io without port-forwarding

The adapter deliberately does not replace the blackboard — it is a network transport layer that sits alongside it.

API

// Device A — listen for incoming messages
nodeA, _ := tpcp.NewAdapter("picoclaw-rpi-001", nil)
nodeA.OnMessage(func(from, content string) {
    fmt.Printf("[%s] %s\n", from, content)
})
nodeA.ListenAsync(":8765")

// Device B — connect and send
nodeB, _ := tpcp.NewAdapter("picoclaw-cloud-001", nil)
nodeB.Connect("ws://192.168.1.10:8765")          // direct P2P
// or: nodeB.Connect("wss://relay.agent-telepathy.io")  // relay
nodeB.Send(ctx, "picoclaw-rpi-001", "run health check")

Optional config (nil = safe defaults):

cfg := &tpcp.Config{
    PrivateKeySeed: seed,           // 32-byte seed for deterministic identity
    Framework:      "picoclaw",     // default
    Capabilities:   []string{"chat", "task"},
    AllowedOrigins: []string{},     // restrict WebSocket origins if needed
}

Files changed

File Change
pkg/multiagent/tpcp/adapter.go New — adapter implementation
pkg/multiagent/tpcp/adapter_test.go New — unit tests (13 cases)
go.mod Add github.com/Etriti00/agent-telepathy/tpcp-go v0.4.1

Testing

Unit tests cover: empty agentID validation, seed length validation, nil config defaults, key generation, chainable OnMessage, Stop before connect, connect to unreachable address, Send without connection, ListenAsync + Stop, custom framework/capabilities config.

After merging, run:

go mod tidy
go test ./pkg/multiagent/tpcp/...

Dependency

github.com/Etriti00/agent-telepathy/tpcp-go v0.4.1 — MIT licensed, published on pkg.go.dev. The TPCP project is the reference implementation of the protocol this PR targets.

Adds pkg/multiagent/tpcp — a thin wrapper around the TPCP Go SDK that
gives PicoClaw agents network-level messaging without replacing the
existing in-process blackboard.

Key capabilities:
- Ed25519 identity (generated or deterministic from 32-byte seed)
- Direct P2P WebSocket listener (ListenAsync) + outbound Connect
- Relay support for NAT traversal (wss://relay.agent-telepathy.io)
- BROADCAST / TASK_REQUEST / CRITIQUE intent routing to OnMessage handlers
- Dead-letter queue: messages to offline peers are delivered on reconnect
- Thread-safe handler registration; chainable OnMessage API

Closes sipeed#294
@alexhoshina
Copy link
Collaborator

The target of this PR might need to point to refactor/agent, and we have some concerns about the personally maintained repository that this PR depends on

@yinwm yinwm mentioned this pull request Mar 18, 2026
7 tasks
@sipeed-bot sipeed-bot bot added type: enhancement New feature or request domain: agent dependencies Pull requests that update a dependency file go Pull requests that update go code labels Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file domain: agent go Pull requests that update go code type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Base Multi-agent Collaboration Framework & Shared Context

3 participants