mimic-agent 0.3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. mimic_agent-0.3.0/.env.example +18 -0
  2. mimic_agent-0.3.0/.gitattributes +6 -0
  3. mimic_agent-0.3.0/.github/ISSUE_TEMPLATE/bug_report.md +21 -0
  4. mimic_agent-0.3.0/.github/ISSUE_TEMPLATE/feature_request.md +11 -0
  5. mimic_agent-0.3.0/.github/workflows/ci.yml +64 -0
  6. mimic_agent-0.3.0/.github/workflows/release.yml +65 -0
  7. mimic_agent-0.3.0/.gitignore +13 -0
  8. mimic_agent-0.3.0/CHANGELOG.md +44 -0
  9. mimic_agent-0.3.0/CONTRIBUTING.md +41 -0
  10. mimic_agent-0.3.0/LICENSE +21 -0
  11. mimic_agent-0.3.0/Makefile +35 -0
  12. mimic_agent-0.3.0/PKG-INFO +422 -0
  13. mimic_agent-0.3.0/README.md +369 -0
  14. mimic_agent-0.3.0/docker-compose.yml +21 -0
  15. mimic_agent-0.3.0/docs/PLAN.md +15 -0
  16. mimic_agent-0.3.0/examples/process_invoice_emails.yml +30 -0
  17. mimic_agent-0.3.0/pyproject.toml +87 -0
  18. mimic_agent-0.3.0/sandbox/__init__.py +1 -0
  19. mimic_agent-0.3.0/sandbox/app.py +1 -0
  20. mimic_agent-0.3.0/sandbox/generate_documents.py +5 -0
  21. mimic_agent-0.3.0/sandbox/generate_invoices.py +5 -0
  22. mimic_agent-0.3.0/scripts/debug_click.py +56 -0
  23. mimic_agent-0.3.0/scripts/realapp_benchmark.py +95 -0
  24. mimic_agent-0.3.0/src/mimic/__init__.py +6 -0
  25. mimic_agent-0.3.0/src/mimic/__main__.py +3 -0
  26. mimic_agent-0.3.0/src/mimic/agent.py +459 -0
  27. mimic_agent-0.3.0/src/mimic/api/__init__.py +0 -0
  28. mimic_agent-0.3.0/src/mimic/api/main.py +37 -0
  29. mimic_agent-0.3.0/src/mimic/approval.py +291 -0
  30. mimic_agent-0.3.0/src/mimic/cli.py +179 -0
  31. mimic_agent-0.3.0/src/mimic/conditions.py +180 -0
  32. mimic_agent-0.3.0/src/mimic/config.py +25 -0
  33. mimic_agent-0.3.0/src/mimic/db.py +13 -0
  34. mimic_agent-0.3.0/src/mimic/doctor.py +183 -0
  35. mimic_agent-0.3.0/src/mimic/dom.py +140 -0
  36. mimic_agent-0.3.0/src/mimic/events.py +71 -0
  37. mimic_agent-0.3.0/src/mimic/extract.py +441 -0
  38. mimic_agent-0.3.0/src/mimic/healing.py +302 -0
  39. mimic_agent-0.3.0/src/mimic/learn.py +86 -0
  40. mimic_agent-0.3.0/src/mimic/live.py +52 -0
  41. mimic_agent-0.3.0/src/mimic/llm.py +47 -0
  42. mimic_agent-0.3.0/src/mimic/mailbox.py +68 -0
  43. mimic_agent-0.3.0/src/mimic/mapping.py +122 -0
  44. mimic_agent-0.3.0/src/mimic/matcher.py +371 -0
  45. mimic_agent-0.3.0/src/mimic/matcher_data.py +236 -0
  46. mimic_agent-0.3.0/src/mimic/models.py +59 -0
  47. mimic_agent-0.3.0/src/mimic/outcome.py +132 -0
  48. mimic_agent-0.3.0/src/mimic/recorder.py +290 -0
  49. mimic_agent-0.3.0/src/mimic/risk.py +180 -0
  50. mimic_agent-0.3.0/src/mimic/riskml.py +317 -0
  51. mimic_agent-0.3.0/src/mimic/run.py +677 -0
  52. mimic_agent-0.3.0/src/mimic/sandbox/__init__.py +0 -0
  53. mimic_agent-0.3.0/src/mimic/sandbox/app.py +359 -0
  54. mimic_agent-0.3.0/src/mimic/sandbox/generate_documents.py +168 -0
  55. mimic_agent-0.3.0/src/mimic/sandbox/generate_invoices.py +45 -0
  56. mimic_agent-0.3.0/src/mimic/sandbox/generate_mail.py +73 -0
  57. mimic_agent-0.3.0/src/mimic/sandbox/templates/approval_done.html +7 -0
  58. mimic_agent-0.3.0/src/mimic/sandbox/templates/approval_new.html +17 -0
  59. mimic_agent-0.3.0/src/mimic/sandbox/templates/base.html +72 -0
  60. mimic_agent-0.3.0/src/mimic/sandbox/templates/expense_done.html +7 -0
  61. mimic_agent-0.3.0/src/mimic/sandbox/templates/expense_list.html +18 -0
  62. mimic_agent-0.3.0/src/mimic/sandbox/templates/expense_new.html +22 -0
  63. mimic_agent-0.3.0/src/mimic/sandbox/templates/expense_review.html +16 -0
  64. mimic_agent-0.3.0/src/mimic/sandbox/templates/expenses_base.html +41 -0
  65. mimic_agent-0.3.0/src/mimic/sandbox/templates/invoice_v1.html +23 -0
  66. mimic_agent-0.3.0/src/mimic/sandbox/templates/invoice_v2.html +29 -0
  67. mimic_agent-0.3.0/src/mimic/sandbox/templates/login.html +12 -0
  68. mimic_agent-0.3.0/src/mimic/sandbox/templates/mail_inbox.html +12 -0
  69. mimic_agent-0.3.0/src/mimic/sandbox/templates/mail_message.html +16 -0
  70. mimic_agent-0.3.0/src/mimic/sandbox/templates/mail_reply.html +13 -0
  71. mimic_agent-0.3.0/src/mimic/sandbox/templates/mail_sent.html +7 -0
  72. mimic_agent-0.3.0/src/mimic/sandbox/templates/suite_base.html +52 -0
  73. mimic_agent-0.3.0/src/mimic/server.py +222 -0
  74. mimic_agent-0.3.0/src/mimic/skills.py +263 -0
  75. mimic_agent-0.3.0/src/mimic/static/index.html +544 -0
  76. mimic_agent-0.3.0/src/mimic/storage.py +503 -0
  77. mimic_agent-0.3.0/src/mimic/store.py +33 -0
  78. mimic_agent-0.3.0/src/mimic/tables.py +136 -0
  79. mimic_agent-0.3.0/src/mimic/vision.py +150 -0
  80. mimic_agent-0.3.0/src/mimic/workflow.py +526 -0
  81. mimic_agent-0.3.0/tests/conftest.py +67 -0
  82. mimic_agent-0.3.0/tests/fixtures/enter_invoice.json +155 -0
  83. mimic_agent-0.3.0/tests/realapps/__init__.py +0 -0
  84. mimic_agent-0.3.0/tests/realapps/expenses/__init__.py +0 -0
  85. mimic_agent-0.3.0/tests/realapps/expenses/admin.py +9 -0
  86. mimic_agent-0.3.0/tests/realapps/expenses/apps.py +6 -0
  87. mimic_agent-0.3.0/tests/realapps/expenses/models.py +22 -0
  88. mimic_agent-0.3.0/tests/realapps/expenses_site/__init__.py +0 -0
  89. mimic_agent-0.3.0/tests/realapps/expenses_site/settings.py +45 -0
  90. mimic_agent-0.3.0/tests/realapps/expenses_site/urls.py +14 -0
  91. mimic_agent-0.3.0/tests/test_actions.py +246 -0
  92. mimic_agent-0.3.0/tests/test_agent.py +105 -0
  93. mimic_agent-0.3.0/tests/test_approval.py +137 -0
  94. mimic_agent-0.3.0/tests/test_extract.py +276 -0
  95. mimic_agent-0.3.0/tests/test_healing.py +248 -0
  96. mimic_agent-0.3.0/tests/test_health.py +11 -0
  97. mimic_agent-0.3.0/tests/test_hub.py +62 -0
  98. mimic_agent-0.3.0/tests/test_mapping.py +64 -0
  99. mimic_agent-0.3.0/tests/test_matcher.py +185 -0
  100. mimic_agent-0.3.0/tests/test_realapp_django.py +190 -0
  101. mimic_agent-0.3.0/tests/test_recorder.py +99 -0
  102. mimic_agent-0.3.0/tests/test_risk.py +151 -0
  103. mimic_agent-0.3.0/tests/test_sandbox.py +38 -0
  104. mimic_agent-0.3.0/tests/test_secrets.py +91 -0
  105. mimic_agent-0.3.0/tests/test_server.py +143 -0
  106. mimic_agent-0.3.0/tests/test_skills.py +140 -0
  107. mimic_agent-0.3.0/tests/test_store.py +108 -0
  108. mimic_agent-0.3.0/tests/test_tables.py +118 -0
  109. mimic_agent-0.3.0/tests/test_workflow.py +260 -0
  110. mimic_agent-0.3.0/tests/tiny_model.py +50 -0
  111. mimic_agent-0.3.0/uv.lock +3471 -0
@@ -0,0 +1,18 @@
1
+ # Everything here is optional: Mimic works with no .env at all.
2
+
3
+ # Storage. Empty = SQLite file in MIMIC_HOME (default ~/.mimic/mimic.db).
4
+ # Postgres + pgvector (pip install "mimic-agent[postgres]", docker compose up -d):
5
+ # DATABASE_URL=postgresql://mimic:mimic@localhost:5432/mimic
6
+ DATABASE_URL=
7
+ # MIMIC_HOME=~/.mimic
8
+
9
+ # Local models (Ollama)
10
+ OLLAMA_HOST=http://localhost:11434
11
+ VISION_MODEL=qwen2.5vl:7b
12
+ PLANNER_MODEL=qwen2.5:7b
13
+ EMBED_MODEL=nomic-embed-text
14
+
15
+ SANDBOX_URL=http://localhost:8001
16
+
17
+ # Secrets typed by a skill (passwords...) are never stored. Give them per session:
18
+ # MIMIC_SECRET_PASSWORD=...
@@ -0,0 +1,6 @@
1
+ # Same line endings on Windows, macOS and Linux (no more "LF will be replaced by CRLF").
2
+ * text=auto eol=lf
3
+ *.png binary
4
+ *.pdf binary
5
+ *.safetensors binary
6
+ *.xlsx binary
@@ -0,0 +1,21 @@
1
+ ---
2
+ name: Bug report
3
+ about: Mimic failed on a task
4
+ labels: bug
5
+ ---
6
+
7
+ **What were you automating?** (site type, skill name)
8
+
9
+ **Steps to reproduce**
10
+ 1.
11
+ 2.
12
+
13
+ **Expected vs actual**
14
+
15
+ **`--debug` output** (remove personal data)
16
+
17
+ ```
18
+ paste here
19
+ ```
20
+
21
+ **Environment**: OS, GPU / Apple Silicon, Ollama models
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: Feature request
3
+ about: A task or capability Mimic should support
4
+ labels: enhancement
5
+ ---
6
+
7
+ **The repetitive task you want to automate**
8
+
9
+ **What blocks Mimic today**
10
+
11
+ **Ideas for how it could work**
@@ -0,0 +1,64 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+
8
+ jobs:
9
+ lint:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: astral-sh/setup-uv@v6
14
+ - run: uv sync --locked
15
+ - run: uv run ruff check .
16
+ - run: uv run ruff format --check .
17
+
18
+ test:
19
+ # SQLite storage, the sandbox, the Django admin, Excel/CSV: everything but Postgres.
20
+ strategy:
21
+ fail-fast: false
22
+ matrix:
23
+ os: [ubuntu-latest, windows-latest, macos-latest]
24
+ python: ["3.12"]
25
+ include:
26
+ - os: ubuntu-latest
27
+ python: "3.11"
28
+ runs-on: ${{ matrix.os }}
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - uses: astral-sh/setup-uv@v6
32
+ with:
33
+ python-version: ${{ matrix.python }}
34
+ - name: OpenMP for XGBoost (macOS)
35
+ if: runner.os == 'macOS'
36
+ run: brew install libomp
37
+ - run: uv sync --locked
38
+ - run: uv run playwright install --with-deps chromium
39
+ - run: uv run pytest -q -rs
40
+
41
+ postgres:
42
+ # The same storage tests against Postgres + pgvector.
43
+ runs-on: ubuntu-latest
44
+ services:
45
+ db:
46
+ image: pgvector/pgvector:pg16
47
+ env:
48
+ POSTGRES_USER: mimic
49
+ POSTGRES_PASSWORD: mimic
50
+ POSTGRES_DB: mimic
51
+ ports:
52
+ - 5432:5432
53
+ options: >-
54
+ --health-cmd "pg_isready -U mimic"
55
+ --health-interval 5s
56
+ --health-retries 10
57
+ env:
58
+ DATABASE_URL: postgresql://mimic:mimic@localhost:5432/mimic
59
+ steps:
60
+ - uses: actions/checkout@v4
61
+ - uses: astral-sh/setup-uv@v6
62
+ - run: uv sync --locked
63
+ - run: uv run playwright install --with-deps chromium
64
+ - run: uv run pytest -q -rs tests/test_store.py tests/test_healing.py
@@ -0,0 +1,65 @@
1
+ name: Release
2
+
3
+ # Push a tag like v0.3.0 (matching the version in pyproject.toml) to publish on PyPI.
4
+ on:
5
+ push:
6
+ tags: ["v*"]
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ - uses: astral-sh/setup-uv@v6
14
+ - name: The tag matches the version in pyproject.toml
15
+ run: |
16
+ version="v$(uv version --short)"
17
+ if [ "$version" != "$GITHUB_REF_NAME" ]; then
18
+ echo "Tag $GITHUB_REF_NAME but pyproject.toml says $version"; exit 1
19
+ fi
20
+ - run: uv sync --locked
21
+ - run: uv run playwright install --with-deps chromium
22
+ - run: uv run pytest -q
23
+ - run: uv build
24
+ - uses: actions/upload-artifact@v4
25
+ with:
26
+ name: dist
27
+ path: dist/
28
+
29
+ pypi:
30
+ needs: build
31
+ runs-on: ubuntu-latest
32
+ # Trusted publishing: PyPI trusts this workflow, no API token is stored anywhere.
33
+ environment:
34
+ name: pypi
35
+ url: https://pypi.org/p/mimic-agent
36
+ permissions:
37
+ id-token: write
38
+ steps:
39
+ - uses: actions/download-artifact@v4
40
+ with:
41
+ name: dist
42
+ path: dist/
43
+ - uses: pypa/gh-action-pypi-publish@release/v1
44
+
45
+ github-release:
46
+ needs: pypi
47
+ runs-on: ubuntu-latest
48
+ permissions:
49
+ contents: write
50
+ steps:
51
+ - uses: actions/checkout@v4
52
+ - uses: actions/download-artifact@v4
53
+ with:
54
+ name: dist
55
+ path: dist/
56
+ - name: Release notes from CHANGELOG.md
57
+ run: |
58
+ awk -v v="${GITHUB_REF_NAME#v}" '
59
+ $0 ~ "^## \\[" v "\\]" {on=1; next}
60
+ on && /^## \[/ {exit}
61
+ on {print}
62
+ ' CHANGELOG.md > notes.md
63
+ - run: gh release create "$GITHUB_REF_NAME" dist/* --title "$GITHUB_REF_NAME" --notes-file notes.md
64
+ env:
65
+ GH_TOKEN: ${{ github.token }}
@@ -0,0 +1,13 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.pyc
4
+ .env
5
+ .pytest_cache/
6
+ .ruff_cache/
7
+ sandbox/data/
8
+ recordings/
9
+ mlruns/
10
+ reports/
11
+ models/
12
+ dist/
13
+ *.db
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ All notable changes to Mimic. Versions follow [Semantic Versioning](https://semver.org).
4
+
5
+ ## [Unreleased]
6
+
7
+ ### Added
8
+ - WorkSuite sandbox: a mailbox (supplier emails with invoice PDFs, replies) and an approvals app.
9
+ - Workflows (`mimic workflow check | run`): chain skills across apps for every email or row;
10
+ read attachments; `if:` conditions in plain words, translated into checked rules; one plan
11
+ per email; every step verified with its own confirmation.
12
+ - Messages with email addresses or links are recognised as varying in success signals.
13
+
14
+ ## [0.3.0] - 2026-11-20
15
+
16
+ ### Added
17
+ - New actions: checkboxes, radio buttons, Enter in a field, file uploads, multi-page flows.
18
+ - Success signal learned from the end of the demo (final page + confirmation message); runs are
19
+ graded with it on any site.
20
+ - Excel / CSV input with your own column names; a results file per run; `--only-failed` retries.
21
+ - Steps on pages the app skips (already signed in) are skipped.
22
+ - Real-app test and benchmark on a stock Django admin: 30/30 rows saved correctly.
23
+ - The fine-tuned element matcher is published on the Hugging Face Hub and downloaded on first
24
+ use; `mimic matcher push` publishes your own, with a model card.
25
+ - CI on Linux, Windows and macOS; releases published to PyPI by GitHub Actions.
26
+
27
+ ### Fixed
28
+ - Labels without `for`, fields named by a `<fieldset>` legend, buttons written as
29
+ `<input value="Save">`, dropdowns whose label differs from their value.
30
+
31
+ ## [0.2.0] - 2026-11-19
32
+
33
+ ### Added
34
+ - `pip install mimic-agent` and a single `mimic` command, with `mimic doctor`.
35
+ - SQLite storage by default (no Docker); Postgres + pgvector as an option.
36
+ - Passwords and other secret fields are never recorded.
37
+ - Live dashboard (`mimic serve`): streamed agent browser, approve / edit / skip / pause.
38
+
39
+ ## [0.1.0] - 2026-11-17
40
+
41
+ ### Added
42
+ - Learn a web task from one demonstration, replay it on a batch, review each plan.
43
+ - Self-healing with memory, embeddings, a fine-tuned matcher and a vision model.
44
+ - XGBoost failure-risk model; reading inputs from invoice PDFs.
@@ -0,0 +1,41 @@
1
+ # Contributing to Mimic
2
+
3
+ Thanks for helping! Mimic is young, so real-world feedback is the most valuable contribution.
4
+
5
+ ## Good first contributions
6
+
7
+ - **A site where Mimic fails**: open an issue with the steps, what you expected, and the
8
+ `--debug` output (remove any personal data first).
9
+ - **New sandbox perturbations** in `sandbox/app.py` (a new kind of flakiness the agent should
10
+ survive), with a test.
11
+ - **New actions** (checkbox, radio, keyboard, upload) in `src/mimic/agent.py`.
12
+
13
+ ## Development setup
14
+
15
+ ```bash
16
+ uv sync # add --extra matcher for the PyTorch matcher
17
+ uv run playwright install chromium
18
+ uv run mimic doctor
19
+ uv run pytest -q
20
+ ```
21
+
22
+ Tests run on a throwaway SQLite file and never touch your learned skills. Storage tests also
23
+ run on a `mimic_test` Postgres database when `DATABASE_URL=postgresql://...` is set
24
+ (`docker compose up -d`). Tests that need a browser skip themselves cleanly when unavailable.
25
+
26
+ ## Before opening a pull request
27
+
28
+ ```bash
29
+ uv run ruff check . && uv run ruff format --check .
30
+ uv run pytest -q
31
+ ```
32
+
33
+ - One feature or fix per pull request, with a test that fails without your change.
34
+ - Keep inference local: no new dependency on a hosted model API.
35
+ - If you change behaviour the agent depends on (locators, healing, risk features),
36
+ include before/after numbers from `mimic.run` or `mimic.riskml evaluate`.
37
+
38
+ ## Ground rules
39
+
40
+ Be kind, be specific, and never include real personal or financial data in issues,
41
+ recordings or test fixtures.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Samy Baouche
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,35 @@
1
+ .PHONY: install up down db api sandbox invoices record test lint
2
+
3
+ NAME ?= enter_invoice
4
+
5
+ record:
6
+ uv run python -m mimic.recorder --name $(NAME) --url http://localhost:8001
7
+
8
+ install:
9
+ uv sync
10
+ uv sync --extra agent
11
+ uv run playwright install chromium
12
+
13
+ up:
14
+ docker compose up -d
15
+
16
+ down:
17
+ docker compose down
18
+
19
+ db:
20
+ uv run python -m mimic.db
21
+
22
+ api:
23
+ uv run uvicorn mimic.api.main:app --reload --port 8000
24
+
25
+ sandbox:
26
+ uv run uvicorn sandbox.app:app --reload --port 8001
27
+
28
+ invoices:
29
+ uv run python -m sandbox.generate_invoices
30
+
31
+ test:
32
+ uv run pytest -q
33
+
34
+ lint:
35
+ uv run ruff check . && uv run ruff format --check .