Remote Execution
Connect Globally
Section titled “Connect Globally”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 remotedisconnect()Context Manager
Section titled “Context Manager”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")Per-Agent Binding
Section titled “Per-Agent Binding”my_agent.bind(remote="https://cluster.io", api_key="...")result = await my_agent.run("Always remote")
other_agent.run("Still local")Resolution Priority
Section titled “Resolution Priority”agent.bind()(per-agent)remote()context managerconnect()global- Local runtime
The connection state uses contextvars for async-safe concurrent execution.