feat: add training agent - #185
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #185 +/- ##
==========================================
+ Coverage 65.16% 65.37% +0.21%
==========================================
Files 34 36 +2
Lines 2394 2406 +12
==========================================
+ Hits 1560 1573 +13
+ Misses 834 833 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds a minimal “training” workflow that runs a ReadingBot against a target repository (local path or Git URL) and persists durable repository notes via the MemoryTool, plus a CLI entrypoint and tests.
Changes:
- Added
run_training()runner that prepares a source directory (optionally cloning a remote) and executesReadingBotwithMemoryTool. - Added a CLI (
microbots.auto_memory.training.cli) to run training from command-line args. - Added unit tests for runner + CLI, plus an end-to-end integration smoke test.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/auto_memory/training/test_runner.py | Adds runner unit tests and an end-to-end integration smoke test. |
| test/auto_memory/training/test_cli.py | Adds CLI argument parsing and main() behavior tests. |
| src/microbots/auto_memory/training/training_instructions.md | Adds training-phase agent instructions emphasizing durable memory capture. |
| src/microbots/auto_memory/training/runner.py | Implements repo prep (local/clone) and runs ReadingBot with MemoryTool. |
| src/microbots/auto_memory/training/cli.py | Implements CLI argument parsing and invokes run_training(). |
| src/microbots/auto_memory/training/init.py | Exposes run_training for package-level import. |
Suppressed comments (2)
src/microbots/auto_memory/training/runner.py:92
- run_training creates a temporary workdir via tempfile.mkdtemp but never cleans it up, which can leave behind many /tmp directories on repeated runs. Use tempfile.TemporaryDirectory so the workdir is removed after the bot run completes.
workdir = Path(tempfile.mkdtemp(prefix="training_workdir_"))
source_dir = _prepare_source_dir(repo_path, workdir)
src/microbots/auto_memory/training/runner.py:45
- _prepare_source_dir returns Path(repo) for non-git inputs without validating it exists/is a directory. This can lead to a later, harder-to-debug failure when the bot tries to mount a non-existent path. Consider failing fast with a clear error.
if not _is_git_url(repo):
return Path(repo)
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
…ng in training instructions
c3c9fda to
a919d27
Compare
There was a problem hiding this comment.
We don't need this cli. the run_training will be called by the orchestrator itself
|
|
||
| dest = workdir / "source" | ||
| if dest.exists(): | ||
| return dest # reuse existing clone across iterations |
There was a problem hiding this comment.
This will return wrong git repo is there is a stale workdir/source directory exisit in the machine. Please check the git config matches with the repo url before returning dest
| or bool(_SCP_STYLE_RE.match(repo)) | ||
| ) | ||
|
|
||
| def _prepare_source_dir(repo: str, workdir: Path) -> Path: |
There was a problem hiding this comment.
Repo cloning and management can be move to orchestrator itself.
| Result of the training bot run. | ||
| """ | ||
|
|
||
| workdir = Path(tempfile.mkdtemp(prefix="training_workdir_")) |
There was a problem hiding this comment.
Training is not going to update the git repo. So, you can just gather the path from the orchestrator and use that directory as is.
| shutil.rmtree(workdir, ignore_errors=True) | ||
|
|
||
|
|
||
| def run_training_loop( |
There was a problem hiding this comment.
This loop will run from the Orchestrator end. So, only run_training alone is sufficient in this file.
Summary:
ReadingBotlearn a repository and persist what it learns as durable notes via thememorytool. Given a repo and optional feedback, it runs one bot pass and accumulates maintainer-level notes in a memory directory that can be reused across future runs.