Repository navigation
133 documentation getting started - #135
Conversation
There was a problem hiding this comment.
🟡 Not ready to approve
The tutorial README’s stated sampling-key migration (t_sample_*) is inconsistent with the included simulator config, which can cause the tutorial to fail or confuse users.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Adds a new “Getting Started” tutorial under examples/getting-started/ to help users set up and run an MPC-driven multi-agent system in the AgentLib-MPC ecosystem.
Changes:
- Introduces a 3-part runnable tutorial (
main_part1.py–main_part3.py) with corresponding MPC model/config examples. - Adds a simple predictor module and configuration to provide forecast inputs to the MPC agent.
- Adds an overview README including notes about AgentLib sampling configuration changes.
Change Classification: Documentation update (with runnable example code)
Backward Compatibility: Compatible (examples/docs only)
CI Risk: Low–Medium (examples are new; one internal inconsistency may cause tutorial runtime failure depending on AgentLib version/config expectations)
File summaries
| File | Description |
|---|---|
| examples/getting-started/README.md | Tutorial overview + AgentLib sampling configuration note |
| examples/getting-started/main_part1.py | Part 1 runner (FMU + predictor + MPC) |
| examples/getting-started/main_part2.py | Part 2 runner (objective-function examples) |
| examples/getting-started/main_part3.py | Part 3 runner (advanced solver/discretization config) |
| examples/getting-started/fmu/config.json | Simulator (FMU) agent configuration |
| examples/getting-started/predictor/simple_predictor.py | Predictor module producing a temperature forecast series |
| examples/getting-started/predictor/config.json | Predictor agent configuration |
| examples/getting-started/mpc/part1_simple_mpc_model.py | Part 1 CasADi model with simple objective definition |
| examples/getting-started/mpc/part1_config.json | Part 1 MPC agent configuration |
| examples/getting-started/mpc/part2_simple_mpc_model.py | Part 2 CasADi model demonstrating multiple objective types |
| examples/getting-started/mpc/part2_config.json | Part 2 MPC agent configuration |
| examples/getting-started/mpc/part3_simple_mpc_model.py | Part 3 CasADi model used with advanced settings |
| examples/getting-started/mpc/part3_config.py | Part 3 MPC configuration as a Python dict (solver/discretization options) |
Review details
Comments suppressed due to low confidence (1)
examples/getting-started/README.md:37
- The JSON example uses tab characters for indentation; use spaces to keep formatting consistent and avoid rendering oddities in Markdown diffs.
{
"t_sample_simulation": 60,
"t_sample_communication": 60
}
- Files reviewed: 13/16 changed files
- Comments generated: 3
- Review effort level: Low
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 17 changed files in this pull request and generated no new comments.
Suppressed comments (10)
examples/getting-started/README.md:32
- The Collocation snippet is currently an inline fenced block and the following “Further information…” line breaks the numbered-list nesting. Converting this to a proper fenced code block and indenting the follow-up bullets keeps the list formatting intact.
- Collocation ```"discretization_options": {
"collocation_order": 2,
"collocation_method": "radau"
}```
agentlib_mpc/utils/plotting/mpc.py:54
prediction_stepwas inserted beforeconvert_toin theplot_mpcsignature, which breaks callers that passconvert_topositionally (the old 6th argument). To keep backward compatibility, moveprediction_stepafterconvert_to(or otherwise keepconvert_toin the same positional slot).
step: bool = False,
prediction_step: int = 1,
convert_to: Literal["seconds", "minutes", "hours", "days"] = "seconds",
agentlib_mpc/utils/plotting/mpc.py:92
i % prediction_stepwill raiseZeroDivisionErrorifprediction_stepis set to 0 (or negative). Add a small validation/guard so invalid values fail fast with a clear error.
if plot_predictions and i % prediction_step == 0:
docs/source/tutorials/tutorial.md:10
- The docs link hard-codes a feature branch name (
133-documentation-getting-started), which will become stale/broken after merge. Link tomain(or use a relative link) so the docs remain valid.
You can also find a “getting started” guide in the examples in agentlib_mpc, which explain the first steps for creating an MPC:
https://github.com/RWTH-EBC/AgentLib-MPC/tree/133-documentation-getting-started/examples/getting-started
examples/getting-started/README.md:28
- The inline fenced code block for the Multiple Shooting example won’t render correctly inside the list item. Use a proper fenced code block on its own lines (and indent it under the bullet) so Markdown renders it as intended.
This issue also appears on line 29 of the same file.
- Multiple Shooting ```"discretization_options": {
"method": "multiple_shooting"
}```
examples/getting-started/predictor/simple_predictor.py:2
- Typo in the module docstring: “Its a manually written module” should be “It’s a manually written module”.
This is the predictor module. Its purpose is to provide random variables to the MPC agent. Its a manually written module and
examples/getting-started/predictor/simple_predictor.py:3
- Wording in the module docstring is off: “referenced in the according config.json file” should be “referenced in the corresponding config.json file”.
is referenced in the according config.json file (here: examples/getting-started/predictor/config.json). There are three parameters
examples/getting-started/mpc/part1_simple_mpc_model.py:70
- This example module has several unused imports/variables (
logging,matplotlib.pyplot,LocalMASAgency, andlogger). If linting runs onexamples/, these will fail CI; removing them keeps the tutorial code clean.
import logging
from typing import List
import matplotlib.pyplot as plt
from agentlib_mpc.models.casadi_model import (
CasadiModel,
examples/getting-started/mpc/part2_simple_mpc_model.py:30
- This example module has several unused imports/variables (
logging,matplotlib.pyplot,LocalMASAgency, andlogger). If linting runs onexamples/, these will fail CI; removing them keeps the tutorial code clean.
import logging
from typing import List
import matplotlib.pyplot as plt
from agentlib_mpc.models.casadi_model import (
CasadiModel,
examples/getting-started/mpc/part3_simple_mpc_model.py:24
- This example module has several unused imports/variables (
logging,matplotlib.pyplot,LocalMASAgency, andlogger). If linting runs onexamples/, these will fail CI; removing them keeps the tutorial code clean.
import logging
from typing import List
import matplotlib.pyplot as plt
from agentlib_mpc.models.casadi_model import (
CasadiModel,
Pull Request
Description
Add a getting started for MPC as tutorial.
Type of Change
Required Checklist
Testing
Examples
Compatibility
pyproject.toml(required independenciesor optional in[project.optional-dependencies])OPTIONAL: Release Information
agentlib_mpc/__init__.py(Required for PyPI release)___.___.___Documentation
Breaking Changes
Optional
GitHub Copilot Review
Note: PRs will not be merged without completed required checklist items and passing CI/CD pipeline.