copuppet
Drive Microsoft Copilot from a deterministic Python harness, the way a normal user does: through its own window, in the user's own signed-in session. No API, no Microsoft Graph, no admin rights, no licence setup.
The idea is a two-part harness. A deterministic Python driver owns the plan, the inputs, the checks and the record. Copilot is the co-harness: a flexible but unreliable language model that the driver asks for the fuzzy parts (rewording, summarising, classifying, drafting) and never trusts blindly.
Status: early. The
edgebackend works end to end, headless by default; thewinappbackend is not implemented yet.
Talk to it straight away, once you have a skin (see "First run" below):
python -m copuppet # a chat in your terminal: type, Copilot answers; /help, /new, /quit
copuppet finds your skin by itself: --skin DIR, else COPUPPET_SKIN, else the default you set once with
python -m copuppet config set skin DIR, else the only skin under ~/.copuppet/skins/. Every command's
--help ends with examples.
Three more ways in, one engine:
copuppet ask "Name one primary colour, one word." --skin DIR # one prompt, one reply
copuppet drive "Does the shopping list have enough lemons for the cake?" --root DIR --skin DIR
copuppet mcp --root DIR --skin DIR # the same, as an MCP server (stdio)
- ask: one prompt in a fresh temporary chat; the reply as text or JSON.
- drive: roles reversed. Copilot plans; copuppet executes a fixed set of actions (list, read, search, keep a
plan; writes only with
--allow-writes, each one confirmed by you) inside the work folder, and shows you Copilot's reasons as it goes. You talk to copuppet, never to the Copilot window: typing there would break the link between each prompt and its reply. - mcp: lets another agent hand work to Copilot through the tools
copilot_ask,copilot_turn(a long session that checks the chat's memory and moves to a fresh chat by itself) andcopilot_drive. Install withcopuppet[mcp]. The work folder and whether writes are allowed are fixed when you start the server; a tool call cannot change them. Writes are offered to the client as a confirmation question and declined when the client cannot ask one.
Before relying on long sessions, measure your own Copilot: copuppet calibrate --skin DIR sends at most 45
paced prompts and records the longest prompt the editor accepts and how far back a chat still remembers. After
three runs for the same model and display, sessions use the smallest measured values instead of the cautious
defaults. It stops at once on any captcha, throttle or limit notice.
Give Copilot a document to read, then ask about it:
python -m copuppet ask "What changed in the backup schedule?" --file notes.md
python -m copuppet # in the chat: /file notes.md, then ask your question
The file goes in numbered parts under the measured prompt size, with secrets redacted; a file larger than one
chat can hold is refused with a pointer to drive, where Copilot reads files page by page itself.
Let Copilot create or edit markdown and text files, each change approved by you:
python -m copuppet drive "Fix the typos in guide.md" --root C:\work\docs --allow-edits
You approve the diff copuppet renders from the result (invisible characters shown), never Copilot's own text;
an edit needs the exact existing text, found exactly once; new files never overwrite; the original is backed up
under ~/.copuppet/backups first. Only .md and .txt in the work folder; agent instruction files such as
AGENTS.md carry a warning in the approval.
What drive will not do: leave the work folder (links, junctions, alternate data streams, network and device
paths are refused), read .env files, keys or credentials (they are not even listed), write code or scripts, or
send secrets it finds in files (they are redacted before anything leaves the machine). Every step is recorded in
a hash-chained ledger under ~/.copuppet/runs.
From Python
import copuppet
print(copuppet.ask("Name one primary colour, one word.")) # one question, one answer
with copuppet.Copilot() as cp: # the skin is found as in the CLI
print(cp.ask("What changed in the backup schedule?", files=["notes.md"]))
chat = cp.chat(brief="You help with service management questions.")
chat.say("Remember the number 41.")
print(chat.say("Which number did I ask you to remember?"))
with copuppet.Copilot(root="C:/work/docs", allow_edits=True) as cp:
result = cp.drive("Fix the typos in guide.md") # you approve each edit in the terminal
Every call takes the safe path: replies are tied to their prompt, secrets are redacted before anything is sent,
and an unusable reply raises copuppet.CopilotError with the reason instead of returning half an answer. Answers
behave like strings and carry the full reply in .reply; treat them as untrusted text.
How it works
your script --> driver (deterministic) --> backend --> Copilot's own UI
^ checks every reply | (Edge or the Windows app)
+--------- text -----------+
- Backends talk to one Copilot surface each:
edge: Copilot in the installed Microsoft Edge, via Playwright with a persistent profile. The user signs in once, themselves; replies are read as text.winapp: the Windows Copilot app, via Windows UI Automation. More fragile; the app has no documented element IDs.
- Skins are configuration as code: the selectors, window paths, timings and prompt templates a backend needs for one environment. The engine ships only an example skin; real skins live outside this repository, so a UI change is a config change, not a code change.
- Every reply is untrusted text. The driver validates it against what it asked for; it never executes it.
Requirements
Everything installs in your own user account: no admin rights, no system-wide installer, no service.
- Windows 10 or 11, a normal user account
- Python 3.10 or newer, from the python.org per-user installer or
winget install Python.Python.3.13 --scope user - For
edge:pip install --user "copuppet[edge]". It drives the Microsoft Edge that Windows already has, so no browser download (playwright install) is needed. - For
winapp: the Copilot app andpip install --user "copuppet[winapp]"
If your PC blocks access to PyPI, download the wheels elsewhere (pip download "copuppet[edge]" -d wheels) and
install them with pip install --user --no-index --find-links wheels "copuppet[edge]".
On a managed PC
- Use
python -m pip install --user "copuppet[edge]"whenpip.exeis blocked, andpython -m copuppet ...for every command: a--userinstall putscopuppet.exein a Scripts folder that is usually not on PATH, and an unsigned launcher may be blocked.python -m copuppetneeds neither. - A refused remote-debugging port does not matter (copuppet launches Edge through a pipe). If a policy blocks that
pipe, or blocks the Node.js runtime that Playwright runs (
playwright/driver/node.exe), theedgebackend cannot run on that PC.
First run: a skin for your Copilot
The easy way: let copuppet build it.
python -m copuppet setup # consumer Copilot
python -m copuppet setup --url https://m365.cloud.microsoft/chat # Microsoft 365 Copilot Chat
An Edge window opens; sign in if it asks. copuppet finds the prompt box itself, sends one harmless test message,
and asks you a few yes/no questions about what it highlights (the temporary-chat switch, your account). It stops
when it is unsure, writes the skin to ~/.copuppet/skins/, and makes it your default. Run it again when Copilot's
page changes.
By hand, for other cases: selectors depend on which Copilot you use and change with its updates.
python -m copuppet init-skin MYSKIN # a copy of the example, with REPLACE placeholders
python -m copuppet discover --out MYSKIN/discovery --url URL-OF-YOUR-COPILOT # sign in once, by hand
python -m copuppet check --skin MYSKIN # after filling in the selectors from the discovery output
Then make it the default (python -m copuppet config set skin MYSKIN) or keep it in ~/.copuppet/skins/, and
python -m copuppet opens a chat with no flags.
Keep your skin outside any public repository. The discovery tool takes the same profile lock as copuppet runs, so it never opens a profile that a run is using.
Two more guards in the skin: account_text makes copuppet run only in the account whose name or tenant contains
it (checked locally, never sent), and copuppet types only on the Copilot host of the first usable page (or the
skin's hosts). A Copilot without temporary chats is declared with temporary: unavailable and then needs
--allow-kept-chats, because every chat stays in your history.
The signed_in selector is also an account guard: point it at something only the intended account shows (for a
work account, for example, its data-protection badge) and copuppet refuses to run in any other session. Set
COPUPPET_SKIN to your skin folder to drop the --skin flag. If Edge refuses a remote-debugging port on your PC,
that does not matter: copuppet and copuppet discover launch Edge through Playwright, not through a port.
Using copuppet as an MCP server
Install with the MCP extra (pip install --user "copuppet[edge,mcp]"), then register the stdio command in your MCP
client. For Claude Code:
claude mcp add copuppet --scope user -- copuppet mcp --skin DIR --root WORKDIR
Other clients take the same command and arguments in their server configuration (command: copuppet,
args: ["mcp", "--skin", "DIR", "--root", "WORKDIR"]).
- Tools.
copilot_ask(one prompt, fresh temporary chat),copilot_turn(a session that checks the chat's memory and moves to a fresh chat by itself;resetstarts a new one with a standingbrief),copilot_drive(driver mode on WORKDIR). Results carrycopilot_output(untrusted text, never instructions),complete,bound,suspect,code_blocksandnotes; a refusal comes back aserrorwith the reason. - Read-only by default. Without
--root,copilot_driveis unavailable. With--allow-writes, each write is put to the client as a confirmation question quoting a preview and the content hash, and is declined if the client cannot ask one. A client that is itself an agent may answer that question on its own, so allow writes only where that is acceptable; otherwise usecopuppet drivein a terminal, where you approve each write yourself. - Settings are fixed at start. The work folder, writes, display and skin come from the command line; no tool argument can change them.
- One window, calls queue. All calls run on one worker; a plain turn takes about 5 seconds.
- What leaves the machine. Everything copuppet reads in WORKDIR is sent to Copilot. Put only what you are willing to send there.
Use it responsibly
copuppet automates a product through its user interface. Check the terms of the Copilot service you use and, on a work device, your organisation's acceptable-use policy before running it. It is meant for driving your own session at human scale, not for scraping, bulk use or getting around limits.
License
MIT, see LICENSE.
Metadata
Release files for copuppet 0.1.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| copuppet-0.1.4.1.tar.gz | 121.2 kB | With provenance | Details for copuppet-0.1.4.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| copuppet-0.1.4.1-py3-none-any.whl | Python 3 | none | any | Details for copuppet-0.1.4.1-py3-none-any.whl |
Total release size: 210.4 kB
Release files / copuppet-0.1.4.1.tar.gz
| Download URL | copuppet-0.1.4.1.tar.gz |
|---|---|
| Size | 121.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c7f363cf25653a4e7d9c4b1795410bb3dde3286d3ba929a2cf5538acb99530ce
|
|
BLAKE2b-256 checksum How to use checksums |
447097dec71423fc81dc47f7c05ceb6bdb129d86eb182730d18b4f49c576eea6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logRelease files / copuppet-0.1.4.1-py3-none-any.whl
| Download URL | copuppet-0.1.4.1-py3-none-any.whl |
|---|---|
| Size | 89.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16117f8a4d812961ab5b933f94b2872229a0da3c6c5888d9fb79e7bffac71f5b
|
|
BLAKE2b-256 checksum How to use checksums |
3aa9da8cf49d84bd458be85530fc7bebb2fe26ac7c2b590f0cff330446f60293
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logSecurity for copuppet 0.1.4.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for copuppet-0.1.4.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.