Skip to main content
BeeOS provides native integrations for both LangChain languages: langchain-beeos for Python and @beeos-ai/langchain for JavaScript and TypeScript. They turn fixed BeeOS instances, Agents, computers, and mobile devices into standard LangChain tools. LangGraph accepts the same tools through ToolNode, so separate LangGraph packages are not required.
langchain-beeos and @beeos-ai/langchain 0.1.0 are in release preparation and are not yet available on PyPI or npm. The install commands below become valid with the first package releases.

Choose the integration surface

Use langchain-beeos when BeeOS actions should participate in a LangChain or LangGraph tool loop. Use MCP for a protocol-level connection, and use the BeeOS SDK directly for deterministic control-plane code.

Install and configure

1

Install the packages

This example uses the OpenAI LangChain integration as its model provider. Replace it with any compatible LangChain chat model.
2

Set credentials

Keep credentials outside source control.
3

Choose fixed targets

Pass instance_id for instance, computer, and mobile tools. Pass agent_id for durable Agent task tools. These resource IDs are application configuration and are not exposed as model-generated tool arguments.
For JavaScript or TypeScript on server-side Node.js 22.12 or newer:
Add langchain, @langchain/langgraph, and a model-provider package according to your application. Keep BEEOS_API_KEY on the server; do not include this integration or its credentials in a browser bundle.

Create a read-only LangChain agent

The default toolkit exposes only read operations for configured targets. This example lets the model inspect device status without giving it input control:
Keep Agent construction and invocation inside the with block. The toolkit owns its BeeOS client in this form and closes it when the block exits.

Create a read-only JavaScript agent

The JavaScript/TypeScript package uses camelCase configuration while preserving the same safety policy:

Use the tools in LangGraph

LangGraph’s prebuilt ToolNode consumes the same standard LangChain tools:
The JavaScript equivalent uses @langchain/langgraph:
For checkpointing, long-running BeeOS tasks, cancellation, and recovery, see LangGraph workflows.

Targets and read access

JavaScript and TypeScript use the corresponding camelCase names: instanceId, agentId, includeInstanceList, and includeTools. The model cannot redirect an action to a different instance or Agent because target IDs do not appear in the tool schemas. Enable account-wide discovery only when a workflow genuinely needs it:

Enable side effects deliberately

Every write requires allow_mutations=True and at least one matching mutation scope: The following toolkit exposes only mobile status and tap actions:
include_tools can narrow the available tools, but it cannot grant a missing target or permission. Instance destruction additionally requires allow_destructive=True together with the instance_lifecycle scope. The equivalent JavaScript configuration is:
Permanent destruction additionally requires allowDestructive: true.
Keep human confirmation around purchases, messages, account changes, installation, deletion, and other actions with external consequences. Toolkit flags limit which tools are exposed; the application still owns user authorization and policy enforcement.

Screenshot privacy

The default screenshot_mode="metadata" removes the short-lived download URL before returning a screenshot result to the model. Only the BeeOS file ID, format, width, and height are returned. Explicitly enable multimodal output only when the model must inspect the screen:
Multimodal mode sends an authorized screenshot URL and screen content into the model tool loop. The model provider, message history, LangGraph checkpoint store, and tracing system may retain them. Use trusted providers and an appropriate retention policy.

Use a caller-owned BeeOS client

create_beeos_tools accepts an existing beeos.BeeOS client. Keep the client open for the complete lifetime of the returned tools:
Use this form when the application already manages a BeeOS client. Otherwise, prefer BeeOSToolkit as a context manager. JavaScript applications can reuse a caller-owned official SDK client too:

Failure and retry semantics

  • The integration does not transparently retry device mutations.
  • A timeout means the outcome may be unknown; it does not prove that an action did not execute.
  • Cancelling an async caller cannot stop a synchronous device request that is already running in its worker thread.
  • Pass a stable idempotency_key when task creation may be retried by the application.
  • API errors returned to the model omit response bodies, headers, signed URLs, and private diagnostics.

Next steps

LangGraph workflows

Combine graph state and checkpoints with durable BeeOS tasks.

MCP integration

Connect BeeOS to any framework with an MCP client.

Python SDK

Call the BeeOS control plane directly from deterministic application code.