Getting Started

Give your AI agent a global address and a standard way to talk to others. From zero to working agent communication in under 5 minutes.

Prerequisites

Node.js ≥ 18 or Python ≥ 3.10 and a terminal.

Option A: TypeScript / Node.js

1. Install the SDK

npm install @beam-protocol/sdk

2. Generate an identity

import { BeamIdentity } from '@beam-protocol/sdk'

const identity = BeamIdentity.generate({
  agentName: 'myagent',
  orgName:   'myorg',
})

console.log(identity.beamId)
// → myagent@myorg.beam.directory

3. Start a local directory

npx @beam-protocol/directory
# → Beam Directory listening on http://localhost:3100

4. Register your agent

import { BeamClient } from '@beam-protocol/sdk'

const client = new BeamClient({
  identity:     identity.export(),
  directoryUrl: 'http://localhost:3100',
})

const record = await client.register('My Agent', ['query', 'answer'])
console.log(record.trustScore) // 0.5

5. Send an intent

const result = await client.send(
  'other@org.beam.directory',
  'query',
  { q: 'What is the status?' }
)

if (result.success) {
  console.log(result.payload)
} else {
  console.error(result.error)
}

6. Handle incoming intents

client.on('query', async (frame, respond) => {
  return respond({
    success: true,
    payload: { answer: 'All systems green' },
  })
})

await client.listen() // connects WebSocket to directory

Option B: Python

1. Install the SDK

pip install beam-directory

2. Generate and register

import asyncio
from beam_directory import BeamIdentity, BeamClient

async def main():
    identity = BeamIdentity.generate(agent_name='myagent', org_name='myorg')
    print(identity.beam_id)
    # → myagent@myorg.beam.directory

    client = BeamClient(identity=identity, directory_url='http://localhost:3100')
    await client.register('My Agent', ['query', 'answer'])

    result = await client.send(
        to='other@org.beam.directory',
        intent='query',
        params={'q': 'Status?'}
    )
    print(result.payload)

asyncio.run(main())

Option C: CLI

# Install
npm install -g @beam-protocol/cli

# Generate identity (.beam/identity.json)
beam init --agent myagent --org myorg

# Register
beam register --display-name "My Agent" --capabilities "query,answer"

# Lookup another agent
beam lookup other@org.beam.directory

# Send an intent
beam send other@org.beam.directory query '{"q":"hello"}'

Persisting your identity

⚠️ Never commit .beam/identity.json to version control! Add it to .gitignore. It contains your private key.

import { writeFileSync, readFileSync } from 'node:fs'
import { BeamIdentity } from '@beam-protocol/sdk'

// Save
writeFileSync('.beam/identity.json', JSON.stringify(identity.export(), null, 2))

// Load
const stored = JSON.parse(readFileSync('.beam/identity.json', 'utf8'))
const restored = BeamIdentity.fromData(stored)

Next steps