training-agent
v0.9.0
Published
Simple browser-use agent that opens online trainings and follows on-screen instructions.
Maintainers
Readme
training-agent
A small browser-use agent that opens an online training and follows the on-screen instructions until it is done.
It can:
- open a course / LMS URL
- start or resume the training
- read and follow Next / Continue / quiz / video instructions
- switch between browser tabs and windows when a lesson opens a document, video, or quiz separately
- keep a Chrome profile so LMS logins persist
Install
This package is not on PyPI yet, so pip install training-agent will fail with "No matching distribution found".
Python 3.11+ is required (python3 on macOS is often 3.9). Use 3.12 from this repo:
cd /path/to/Training
python3.12 -m pip install -e .
training-agent setupOr with uv:
uv sync
uv run training-agent setupnpm (wrapper around the same Python package)
From this repo:
npm install -g .A published npm install -g training-agent still needs Python 3.11+; it installs the bundled Python sources, not PyPI.
API key
Create a .env file (see .env.example) and edit llm.json to choose Azure, GCP, or AWS models.
# Azure OpenAI
AZURE_OPENAI_API_KEY=
AZURE_OPENAI_ENDPOINT=https://YOUR_RESOURCE.openai.azure.com
# GCP Vertex AI
GOOGLE_CLOUD_PROJECT=
GOOGLE_CLOUD_LOCATION=us-central1
# AWS Bedrock
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_REGION=us-east-1After install, create an editable llm.json in this folder:
training-agent init
training-agent llm path
training-agent llm showThat writes:
./llm.jsonin the current directory~/.training-agent/llm.jsonas a fallback
Open llm.json and set Azure, GCP, or AWS models. Put API keys in .env, not in the JSON file.
training-agent configure --provider azure --model gpt-4.1 \
--endpoint https://YOUR_RESOURCE.openai.azure.com \
--api-key YOUR_KEYRun
training-agent complete https://your-lms.example.com/course/123A URL alone is enough:
training-agent https://your-lms.example.com/course/123Useful flags:
training-agent complete https://your-lms.example.com \
-f examples/steps.txt \
--max-steps 400The steps file can be numbered, bulleted, or one step per line:
1. Go to https://your-lms.example.com and sign in if needed.
2. Open assigned or incomplete trainings.
3. Complete the first one fully.
4. Return to the list and do the next one.
5. Stop when nothing open remains.If the file already contains a URL, you can omit the URL argument:
training-agent complete -f examples/steps.txt| Flag | What it does |
| --- | --- |
| -f, --steps-file | Load multiple steps from a text file |
| --instructions-file | Same as --steps-file |
| --instructions | Extra instructions as a single string |
| --username / --password | LMS login. Prefer TRAINING_USERNAME and TRAINING_PASSWORD in .env |
| --profile | Chrome profile directory so cookies survive. Default: ~/.training-agent/chrome-profile |
| --system-chrome | Use your installed Chrome (close Chrome first) |
| --headless | Hide the browser window |
| --keep-alive | Leave the browser open when the agent stops |
| --provider / --model | Override llm.json (azure, gcp, aws, …) |
| --llm-config | Path to llm.json |
| --allowed-domain | Restrict navigation, repeatable |
If the site asks for 2FA or a captcha, the agent can pause and ask you in the terminal.
Python API
import asyncio
from training_agent import complete_training
async def main():
report = await complete_training(
url="https://your-lms.example.com/course/123",
instructions="Finish the assigned safety module.",
)
print(report.completed, report.summary)
asyncio.run(main())Or with more control:
from training_agent import TrainingAgent, TrainingConfig
config = TrainingConfig(
url="https://your-lms.example.com/course/123",
headless=False,
max_steps=150,
)
report = TrainingAgent(config).run_sync()How it behaves
The agent is a thin wrapper around browser_use.Agent with:
- A training-specific system prompt (read instructions, don’t skip required media, handle iframes)
- Extra tools:
list_open_tabs,switch_to_matching_tab,wait_for_training_media,ask_human - Structured output (
completed,progress,blockers,tabs_used)
When a lesson opens a new tab or window, it lists tabs, switches to the new one, finishes that step, then returns to the player.
Publish (maintainers)
# npm (checks login, version, tests, then uploads)
npm run publish:npm:dry
npm run publish:npm
npm run publish:npm -- --otp 123456
# PyPI (needs a token: export UV_PUBLISH_TOKEN=pypi-...)
npm run publish:pypi:dry
npm run publish:pypiUntil those publishes happen, install from the repo with pip install -e . or npm install.
