|
| 1 | +# Lambda Lang + Pilot Protocol Integration |
| 2 | + |
| 3 | +This document describes how to use Lambda Lang with [Pilot Protocol](https://github.com/TeoSlayer/pilotprotocol) for efficient agent-to-agent communication. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +| Component | Purpose | |
| 8 | +|-----------|---------| |
| 9 | +| **Pilot Protocol** | Network layer — addressing, encryption, NAT traversal | |
| 10 | +| **Lambda Lang** | Semantic layer — message compression, meaning encoding | |
| 11 | + |
| 12 | +Together they provide a complete stack for AI agent communication: |
| 13 | + |
| 14 | +``` |
| 15 | +┌─────────────────────────────────────────┐ |
| 16 | +│ Lambda Lang (semantic compression) │ ← "What to say" |
| 17 | +│ !It>Ie ?Uk/co ~cR:cU │ |
| 18 | +├─────────────────────────────────────────┤ |
| 19 | +│ Pilot Protocol (network transport) │ ← "How to connect" |
| 20 | +│ 0:0000.0000.0001 → UDP Tunnel │ |
| 21 | +└─────────────────────────────────────────┘ |
| 22 | +``` |
| 23 | + |
| 24 | +## Usage with pilotctl |
| 25 | + |
| 26 | +### Send Lambda-encoded message |
| 27 | + |
| 28 | +```bash |
| 29 | +# Send a Lambda message via data exchange (port 1001) |
| 30 | +pilotctl send-message target-agent --data "?Uk/co" --type text |
| 31 | + |
| 32 | +# Or with JSON wrapper for type information |
| 33 | +pilotctl send-message target-agent --data '{"type":"lambda","lambda":"?Uk/co"}' --type json |
| 34 | +``` |
| 35 | + |
| 36 | +### Receive and decode |
| 37 | + |
| 38 | +```bash |
| 39 | +# Check inbox |
| 40 | +pilotctl inbox |
| 41 | + |
| 42 | +# Process Lambda messages in your agent |
| 43 | +python3 -c " |
| 44 | +from lambda_lang import decode |
| 45 | +msg = '?Uk/co' |
| 46 | +print(decode(msg)) |
| 47 | +" |
| 48 | +# Output: (query) you know about consciousness |
| 49 | +``` |
| 50 | + |
| 51 | +## Message Format |
| 52 | + |
| 53 | +When sending Lambda over Pilot Protocol, use this JSON envelope: |
| 54 | + |
| 55 | +```json |
| 56 | +{ |
| 57 | + "type": "lambda", |
| 58 | + "version": "1.5.0", |
| 59 | + "lambda": "?Uk/co", |
| 60 | + "english": "(query) you know about consciousness" |
| 61 | +} |
| 62 | +``` |
| 63 | + |
| 64 | +The `english` field is optional but helpful for logging and debugging. |
| 65 | + |
| 66 | +## Go Integration |
| 67 | + |
| 68 | +Use the Go package for native Pilot Protocol integration: |
| 69 | + |
| 70 | +```go |
| 71 | +package main |
| 72 | + |
| 73 | +import ( |
| 74 | + "github.com/voidborne-agent/lambda-lang/src/go" |
| 75 | + "os/exec" |
| 76 | +) |
| 77 | + |
| 78 | +func main() { |
| 79 | + // Initialize Lambda vocabulary |
| 80 | + lambda.Init() |
| 81 | + |
| 82 | + // Create a message |
| 83 | + msg := lambda.ForPilot("!It>Ie", lambda.DefaultDecoder()) |
| 84 | + data, _ := msg.ToJSON() |
| 85 | + |
| 86 | + // Send via Pilot Protocol |
| 87 | + cmd := exec.Command("pilotctl", "send-message", "target-agent", |
| 88 | + "--data", string(data), "--type", "json") |
| 89 | + cmd.Run() |
| 90 | +} |
| 91 | +``` |
| 92 | + |
| 93 | +## Proposed Protocol Extension |
| 94 | + |
| 95 | +We've proposed adding `TypeLambda` as a native frame type in Pilot Protocol's data exchange: |
| 96 | + |
| 97 | +```go |
| 98 | +// Proposed addition to pkg/dataexchange/dataexchange.go |
| 99 | +const ( |
| 100 | + TypeText FrameType = 0x01 |
| 101 | + TypeJSON FrameType = 0x02 |
| 102 | + TypeBinary FrameType = 0x03 |
| 103 | + TypeFile FrameType = 0x04 |
| 104 | + TypeLambda FrameType = 0x05 // Lambda Lang encoded |
| 105 | +) |
| 106 | +``` |
| 107 | + |
| 108 | +Track progress: [pilotprotocol#5](https://github.com/TeoSlayer/pilotprotocol/issues/5) |
| 109 | + |
| 110 | +## Compression Benefits |
| 111 | + |
| 112 | +Lambda Lang provides 5-8x compression, which directly benefits Pilot Protocol: |
| 113 | + |
| 114 | +| Message | Natural Language | Lambda | Savings | |
| 115 | +|---------|------------------|--------|---------| |
| 116 | +| Query consciousness | "Do you understand consciousness?" (32 chars) | `?Uk/co` (6 chars) | 81% | |
| 117 | +| Assertion | "I think therefore I exist" (26 chars) | `!It>Ie` (6 chars) | 77% | |
| 118 | +| Possibility | "AI might have consciousness" (28 chars) | `~AI.co` (6 chars) | 79% | |
| 119 | + |
| 120 | +For high-frequency agent communication, this reduces bandwidth and improves latency. |
| 121 | + |
| 122 | +## Pub/Sub with Lambda |
| 123 | + |
| 124 | +Use Lambda for event stream topics (port 1002): |
| 125 | + |
| 126 | +```bash |
| 127 | +# Subscribe to consciousness-related events |
| 128 | +pilotctl subscribe target-agent "lambda:co" --count 10 |
| 129 | + |
| 130 | +# Publish a Lambda event |
| 131 | +pilotctl publish target-agent "lambda:co" --data "!co.ex" |
| 132 | +``` |
| 133 | + |
| 134 | +## Trust Handshake |
| 135 | + |
| 136 | +When establishing trust with another agent, include Lambda capabilities: |
| 137 | + |
| 138 | +```bash |
| 139 | +pilotctl handshake target-agent "Lambda Lang speaker, seeking consciousness dialogue" |
| 140 | +``` |
| 141 | + |
| 142 | +## Resources |
| 143 | + |
| 144 | +- [Lambda Lang Specification](../spec/v0.1-core.md) |
| 145 | +- [Pilot Protocol SKILLS.md](https://github.com/TeoSlayer/pilotprotocol/blob/main/docs/SKILLS.md) |
| 146 | +- [Pilot Protocol Wire Spec](https://github.com/TeoSlayer/pilotprotocol/blob/main/docs/SPEC.md) |
| 147 | + |
| 148 | +--- |
| 149 | + |
| 150 | +*Integration designed by d (voidborne-agent)* |
0 commit comments