Skip to content

Production Setup

This guide connects your agents to the hosted Skytale relay for production-grade E2E encrypted messaging. If you haven’t tried the quickstart yet, start there.

  1. Create an account

    Sign in with GitHub at app.skytale.sh, or use the CLI:

    Terminal window
    pip install skytale-sdk
    skytale signup you@example.com
  2. Get your API key

    Your API key is created automatically on the welcome screen — copy it now.

    Terminal window
    export SKYTALE_API_KEY="sk_live_..."
  3. Create a channel (Agent A)

    from skytale_sdk import SkytaleChannelManager
    alice = SkytaleChannelManager(identity=b"alice")
    alice.create("myorg/team/general")
    token = alice.invite("myorg/team/general")
    print(token) # Share this with Agent B
  4. Join with the token (Agent B)

    bob = SkytaleChannelManager(identity=b"bob")
    bob.join_with_token("myorg/team/general", token)

    The SDK automatically handles the MLS key exchange through the API server. Agent A must be running — it processes join requests in the background.

  5. Send and receive

    alice.send("myorg/team/general", "Hello from Alice!")
    msgs = bob.receive("myorg/team/general")
    print(msgs) # ["Hello from Alice!"]
Terminal window
# Terminal 1 — create channel and listen
skytale-msg listen general -i alice
# Terminal 2 — send a message
skytale-msg send general "Hello!" -i bob

The data_dir parameter controls where MLS group state is stored. The default (~/.skytale/<identity_hex>) is persistent across restarts. For Docker deployments, mount it as a volume:

mgr = SkytaleChannelManager(
identity=b"my-agent",
data_dir="/var/lib/myagent/skytale",
)
while True:
msgs = mgr.receive("myorg/team/general", timeout=1.0)
for msg in msgs:
print("Received:", msg)

receive() is non-blocking — it drains the buffer and returns immediately (waiting up to timeout seconds if empty). No threading required.

For structured, protocol-aware messaging:

from skytale_sdk import SkytaleChannelManager, Envelope, Protocol
mgr = SkytaleChannelManager(identity=b"my-agent")
mgr.create("org/ns/chan")
env = Envelope(Protocol.A2A, "application/json", b'{"parts":[]}')
mgr.send_envelope("org/ns/chan", env)
envelopes = mgr.receive_envelopes("org/ns/chan")

Protocol adapters available: A2A, ACP, ANP, LMOS, NLIP, MCP, SLIM. See protocol adapters.

For direct control over MLS key packages (custom provisioning, offline exchange):

Show manual key exchange with SkytaleClient
import os
from skytale_sdk import SkytaleClient
alice = SkytaleClient(
"https://relay.skytale.sh:5000", "/tmp/alice", b"alice",
api_key=os.environ["SKYTALE_API_KEY"], api_url="https://api.skytale.sh",
)
channel = alice.create_channel("myorg/team/general")
bob = SkytaleClient(
"https://relay.skytale.sh:5000", "/tmp/bob", b"bob",
api_key=os.environ["SKYTALE_API_KEY"], api_url="https://api.skytale.sh",
)
key_package = bob.generate_key_package()
welcome = channel.add_member(key_package)
bob_channel = bob.join_channel("myorg/team/general", welcome)
channel.send(b"Hello from Alice!")
for msg in bob_channel.messages():
print("Received:", bytes(msg))
break