Skip to main content

beam-langchain

LangChain integration for the Beam Protocol.

This package bridges LangChain tools with Beam's agent-to-agent messaging model so an LLM can:

  • send natural-language messages to remote Beam agents with conversation.message
  • expose Beam agent capabilities as LangChain tools
  • use the hosted Beam directory at https://api.beam.directory

Installation

pip install beam-langchain

Quick Start

import asyncio

from beam_directory import BeamClient, BeamIdentity
from beam_langchain import BeamAgentTool, BeamToolkit


async def main() -> None:
    identity = BeamIdentity.generate(agent_name="planner", org_name="demo")
    client = BeamClient(identity=identity, directory_url="https://api.beam.directory")

    message_tool = BeamAgentTool(
        client=client,
        beam_id="researcher@demo.beam.directory",
        name="beam_researcher_message",
        description="Ask the remote research agent for a natural-language answer.",
    )

    reply = await message_tool._arun(message="Summarize today's support queue.")
    print(reply)

    toolkit = await BeamToolkit.afrom_agents(
        client,
        ["researcher@demo.beam.directory"],
    )
    for tool in toolkit.get_tools():
        print(tool.name)


asyncio.run(main())

API

BeamAgentTool

BeamAgentTool wraps Beam's conversation.message intent as a LangChain tool.

tool = BeamAgentTool(
    client=client,
    beam_id="support@demo.beam.directory",
)

answer = await tool._arun(
    message="What incidents are still open?",
    context={"priority": "high"},
)

BeamToolkit

BeamToolkit converts Beam agents and their advertised capabilities into LangChain tools.

from beam_directory.types import AgentSearchQuery

toolkit = await BeamToolkit.afrom_search(
    client,
    AgentSearchQuery(org="demo", limit=5),
)

tools = toolkit.get_tools()

Each discovered agent produces:

  • one BeamAgentTool for conversation.message
  • one intent tool per declared Beam capability

Development

cd packages/beam-langchain
python -m venv .venv
source .venv/bin/activate
pip install -e .
python -m unittest discover -s tests

License

Apache 2.0 — see ../../LICENSE.

Metadata

Release files for beam-langchain 0.5.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for beam-langchain 0.5.1
File Size Uploaded
beam_langchain-0.5.1.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for beam-langchain 0.5.1
File Interpreter ABI Platform
beam_langchain-0.5.1-py3-none-any.whl Python 3 none any Details

Total release size: 11.7 kB

Release files / beam_langchain-0.5.1.tar.gz

Download URL beam_langchain-0.5.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
738561b9151aa31aacd0938768222086c40c758a54ee2382912cdb179f93e4df
BLAKE2b-256 checksum
How to use checksums
3520f1f691b13e39b59b548d692fe4129254ee897e7578285dc0f2535ef226e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release files / beam_langchain-0.5.1-py3-none-any.whl

Download URL beam_langchain-0.5.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e354ef28c3ce2bfd11504bef9076ad0a878af02af210ac32a26d8dc2849f38c9
BLAKE2b-256 checksum
How to use checksums
6b614ab703160719209d7fe835c031ddbb99815a638503e2009d38a54e78f6ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.3

Release history Release notifications | RSS feed

This release

0.5.1 This release

2 release files

0.5.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page