Skip to content

Remote Execution

from astromesh_adk import connect, disconnect
connect(url="https://my-cluster.astromesh.io", api_key="ask-xxx")
result = await my_agent.run("query") # Runs on remote
disconnect()
from astromesh_adk import remote
async with remote("https://cluster.io", api_key="..."):
result = await agent.run("Runs on Astromesh")
result = await agent.run("Runs locally")
my_agent.bind(remote="https://cluster.io", api_key="...")
result = await my_agent.run("Always remote")
other_agent.run("Still local")
  1. agent.bind() (per-agent)
  2. remote() context manager
  3. connect() global
  4. Local runtime

The connection state uses contextvars for async-safe concurrent execution.