Skip to content

feat: add training agent - #185

Merged
Bala (0xba1a) merged 8 commits into
mainfrom
kkaitepalli/training-agent
Aug 31, 2026
Merged

feat: add training agent #185
Bala (0xba1a) merged 8 commits into
mainfrom
kkaitepalli/training-agent

Conversation

@KavyaSree2610

@KavyaSree2610 Kavya Sree Kaitepalli (KavyaSree2610) commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Summary:

  • Adds a minimal training agent that lets a ReadingBot learn a repository and persist what it learns as durable notes via the memory tool. 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.

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.37%. Comparing base (e55194c) to head (e02abaf).

Additional details and impacted files

Impacted file tree graph

@@            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     
Flag Coverage Δ
ghcp 30.04% <58.33%> (+0.14%) ⬆️
integration 34.53% <58.33%> (-0.05%) ⬇️
ollama_local 31.92% <58.33%> (+0.13%) ⬆️
slow-browser 20.30% <ø> (ø)
slow-other 38.23% <58.33%> (-0.24%) ⬇️
unit 59.76% <100.00%> (+0.20%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/microbots/auto_memory/training/__init__.py 100.00% <100.00%> (ø)
src/microbots/auto_memory/training/runner.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 executes ReadingBot with MemoryTool.
  • 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.

Comment thread src/microbots/auto_memory/training/runner.py Outdated
Comment thread test/auto_memory/training/test_runner.py Outdated
Comment thread test/auto_memory/training/test_runner.py Outdated
Comment thread src/microbots/auto_memory/training/cli.py Outdated
@KavyaSree2610
Kavya Sree Kaitepalli (KavyaSree2610) marked this pull request as ready for review August 24, 2026 10:10

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repo cloning and management can be move to orchestrator itself.

Result of the training bot run.
"""

workdir = Path(tempfile.mkdtemp(prefix="training_workdir_"))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This loop will run from the Orchestrator end. So, only run_training alone is sufficient in this file.

@KavyaSree2610 Kavya Sree Kaitepalli (KavyaSree2610) changed the title feat: add training agent and cli interface feat: add training agent Aug 31, 2026
@0xba1a
Bala (0xba1a) merged commit 9f1c87b into main Aug 31, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants