Give your AI agent your computer — in three lines of Python
Most agent platforms make you choose. Either the agent lives inside your program — easy to give it your functions, but now you host the memory, the uptime and the chat page — or it is hosted and reaching your own code means an MCP server, a tunnel and a sign-in setup. Shadow-OS splits it differently: the brain stays in the cloud, and only the hands you list run on your computer.
The idea: brain in the cloud, hands on your machine
The model, the memory, the conversation and the tool loop run on the platform, exactly as they do for any agent. When the agent decides it needs something on your computer, the call travels over one connection your computer opened — outbound, so no port is opened and no firewall rule is needed — runs there, and the result comes back.
Nothing on the machine is reachable except what you pass in. There is no generic shell, no file system and no screen unless you hand the agent one of those packs, and each pack is limited on its own terms: a folder pack cannot leave its folder, a shell pack runs only the programs you allow.
Your functions are the tools
Any Python function works as it is. Its type hints become the parameters the model fills in and its docstring becomes the description it reads, so there is nothing to declare twice.
from shadow_os import ShadowOS
def stock(item: str) -> int:
"""How many units of an item we have."""
return inventory[item]
reply = ShadowOS().chat("Do we have enough flour for Friday?", tools=[stock])
print(reply, reply.local_calls)An agent in code that works toward a goal
A session is one conversation over many turns with standing instructions. run() lets the agent keep working until it reports the goal as reached — it calls a finish tool the SDK adds — or until a turn limit. If the server restarts in the middle, the run waits for your computer to reconnect and continues, and the agent is told to check the current state first so nothing is done twice.
from shadow_os.local import Browser
with client.session(tools=[Browser(visible=True)], instructions="Play to win.") as s:
result = s.run("Open the game and win 3 battles", max_turns=20)
print(result.success, result.result)A real browser, with your logins
The browser pack drives Chromium on your computer. The agent reads a page as text with numbered elements and clicks or types by number, and the click still lands when a web app redraws itself, changes a button's label or covers it with an invisible layer. Logins stay in a saved profile, so you sign in once, and the agent can pause and ask you to complete a login or an approval yourself.
The brain on your computer too
The model can run on your computer as well. Pass model=local.Ollama("qwen3") — or LM Studio, vLLM, any OpenAI-compatible server — and every completion the agent needs comes to your machine over the same connection, while prompts, memory and the tool loop stay on the platform. Your GPU does the thinking and inference costs nothing; the conversation itself still passes through the platform. It works only with your account key, so a share link can never point turns at your machine.
with client.session(tools=[local.Browser(visible=True)], model=local.Ollama("qwen3")) as s:
s.run("Win 3 battles")Ready packs and files
Folder, Shell, Python and MCP are one line each. The MCP pack starts any stdio MCP server and turns its tools into the agent's tools, so the whole MCP ecosystem is available without running a server of your own. A tool can also return a file — a report, an export, a screenshot — which lands in the agent's workspace, where it can read it or send it on.
- Folder(root, write=False) — list, read and search inside one folder.
- Shell(allow=[...]) — only the listed programs, never a shell.
- Python() — code in a fresh, isolated process.
- MCP(command) — any stdio MCP server's tools.
- local.File(path) — hand a file back to the agent.
Always on: your computer serves your agent
agent.serve() keeps your computer connected to an agent that is always online. While it is connected, anyone talking to that agent — on WhatsApp, on the web, through the API — can reach the tools you served, each limited by its audience: only you (the default), your staff, or your customers. A customer can never reach an owner tool, even by naming it.
Your code can also wake the agent. runner.emit('A new invoice for Dana is ready - send it to her') runs a turn with your authority, so the agent can act on it — including messaging the customer. The console's Your computers card shows what is connected right now.
client.agent("ag_123").serve(tools=[
local.tool(stock, audience="customers"),
refund, # owner only
], reload=True)What you can rely on
Every local call is printed on your console as it happens. A turn that carries local tools is never retried automatically, so an action on your computer never runs twice; if a turn is cut off after something ran, your code is told exactly what ran. If the connection drops — Wi-Fi, sleep, a server restart — the SDK reconnects by itself, and a turn waits for it.
Key takeaways
- The brain stays in the cloud; only the abilities you list run on your computer.
- Plain Python functions are tools — type hints and docstrings are the contract.
- run(goal) works turn after turn until the goal is reached, and carries on after a restart.
- serve() makes your computer part of an always-on agent, with a per-tool audience.
- Nothing is retried after it may have acted, so nothing runs twice.