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.
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.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: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 prebuiltToolNode consumes the same standard LangChain tools:
@langchain/langgraph:
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 requiresallow_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:
allowDestructive: true.
Screenshot privacy
The defaultscreenshot_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:
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:
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_keywhen 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.