Migrate examples to the new Runner API#301
Conversation
The new `Runner` class allows running agents in both console and server modes.
📝 WalkthroughWalkthroughRemoved the Click-based Changes
Sequence Diagram(s)(Skipped — changes are entrypoint/usage replacements and docs formatting; they do not introduce a new multi-component sequential flow requiring diagramming.) Estimated code review effort🎯 3 (Moderate) | ⏱️ ~30 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
examples/06_prometheus_metrics_example/prometheus_metrics_example.py (1)
14-16: Docstring contains incorrect directory path.The docstring references
03_prometheus_metrics_examplebut this file is in06_prometheus_metrics_example.📝 Suggested fix
Run with: - cd examples/03_prometheus_metrics_example - uv run python prometheus_metrics_example.py --call-type default --call-id test-metrics + cd examples/06_prometheus_metrics_example + uv run python prometheus_metrics_example.py run --call-type default --call-id test-metricsNote: The command should also include the
runsubcommand to match the new Runner API pattern shown in the README.examples/04_football_commentator_example/football_commentator_example.py (1)
37-37: Minor typo: "happenning" → "happening".A small shadow in the questions list—"happenning" should be "happening."
✏️ Suggested fix
- "What is happenning on the field right now?", + "What is happening on the field right now?",
🤖 Fix all issues with AI agents
In `@DEVELOPMENT.md`:
- Around line 535-538: Edit the wording in the DEVELOPMENT.md notes: change
"till" to "until" in the sentence about Track.recv (the phrase "wait till the
next frame is available") and add the missing period and abbreviation formatting
to "etc" in the second line mentioning frame.to_ndarray(format="rgb24") (use
"etc."). Keep the rest of the phrasing intact.
In `@examples/02_golf_coach_example/README.md`:
- Around line 21-23: Fix the nested list indentation in README.md by reducing
the indentation of the three nested list items ("Gemini", "Stream", "OpenAI")
from 4 spaces to 2 spaces so the nested list conforms to MD007; locate the block
containing those list entries and adjust their leading spaces to be two instead
of four while preserving the exact list text and links.
In `@examples/04_football_commentator_example/RUNNING_THE_EXAMPLE.md`:
- Around line 9-10: Replace the bare URLs on the two bullet lines that currently
read "OpenAI API key: https://platform.openai.com/api-keys" and "GetStream API
key: https://getstream.io" with proper Markdown links or angle-bracketed URLs to
satisfy MD034; for example change to a labeled link like "OpenAI API key:
[https://platform.openai.com/api-keys](https://platform.openai.com/api-keys)" or
"OpenAI API key: <https://platform.openai.com/api-keys>" (and do the same for
GetStream) so the markdown linter no longer flags bare URLs.
In `@examples/06_prometheus_metrics_example/README.md`:
- Line 16: The README contains an incorrect directory path string
"03_prometheus_metrics_example" in the example command; update that string to
"06_prometheus_metrics_example" so the command points to the correct example
directory in the repository (edit the README.md entry that contains the cd
command).
In `@plugins/fish/example/README.md`:
- Around line 11-12: The README references two different
filenames—fish_tts_example.py (heading "Full Agent Example") and fish_example.py
(run command); pick the actual example filename and make them consistent by
either renaming the heading to fish_example.py or updating the run command to
fish_tts_example.py so both the section title and the command match the real
file name; verify that any other mentions in the file use the same chosen
filename.
In `@plugins/moondream/README.md`:
- Around line 240-241: The "Rate Limits:" line currently uses the terse token
"2rps"; update the wording to a consistent, more readable form such as "2 RPS
(requests per second)". Locate the "Rate Limits:" paragraph in
plugins/moondream/README.md and replace "2rps (requests per second)" or "2rps"
with "2 RPS (requests per second)" so the casing and spacing are consistent with
other docs.
In `@README.md`:
- Around line 187-188: The README tutorial entry has its bold marker split
across lines causing broken Markdown; edit the offending line so the bold syntax
surrounds the whole label and link correctly (e.g., change the two-line split
"**Tutorial:\n** [Building real-time sports coaching](...)" to a single properly
formatted bold/link line), targeting the tutorial text "Tutorial:" and the link
text "Building real-time sports coaching" to ensure the bold and link render as
intended.
- Around line 214-232: The inline <img> tags in README.md lack alt attributes
which fails accessibility checks; update each image tag (e.g., the repeated
[<img src="..."/>] instances) to include meaningful alt text describing the
person or logo (for example "Demis Hassabis portrait", "Ultralytics logo",
etc.), and apply the same change to every image occurrence in the file so screen
readers and markdownlint receive proper alt text.
🧹 Nitpick comments (1)
plugins/moondream/README.md (1)
231-235: Tighten thedetect_objectsbullet phrasing.The current sentence is awkward and includes an orphaned quote. Consider a quick reword for clarity.
📝 Proposed doc tweak
-- `detect_objects`: str | List[str] - Object(s) to detect using zero-shot detection. Can be any object name like " - person", "car", "basketball". Default: `"person"` +- `detect_objects`: str | List[str] - Object(s) to detect using zero-shot detection. Can be any object name, e.g. + "person", "car", "basketball". Default: `"person"`-- `detect_objects`: str | List[str] - Object(s) to detect using zero-shot detection. Can be any object name like " - person", "car", "basketball". Default: `"person"` +- `detect_objects`: str | List[str] - Object(s) to detect using zero-shot detection. Can be any object name, e.g. + "person", "car", "basketball". Default: `"person"`Also applies to: 245-246
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@examples/06_prometheus_metrics_example/prometheus_metrics_example.py`:
- Around line 14-17: Update the top-level docstring in
prometheus_metrics_example.py to show the new Runner CLI usage with the run
subcommand; replace the example command "uv run python
prometheus_metrics_example.py --call-type default --call-id test-metrics" (or
the current two-line docstring block) with the correct invocation that includes
the "run" subcommand (e.g., "uv run run python prometheus_metrics_example.py
--call-type default --call-id test-metrics" or the project-specific equivalent),
ensuring the docstring text near the module name prometheus_metrics_example.py
and any usage examples reflect the updated Runner CLI syntax.
♻️ Duplicate comments (1)
examples/04_football_commentator_example/RUNNING_THE_EXAMPLE.md (1)
9-10: Replace bare URLs to satisfy markdownlint.Same issue as previously noted: convert the API key URLs to Markdown links or angle-bracketed URLs to avoid MD034.
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@docs/ai/instructions/ai-tts.md`:
- Line 11: Update the inconsistent example references so the document
consistently points to the same TTS example; choose either the Deepgram example
or the Fish example and replace the other everywhere. Specifically, if you pick
Deepgram, change all occurrences of "fish_tts_example.py" and any "fish tests"
mentions to "deepgram_tts_example.py" (and corresponding test names); if you
pick Fish, replace the single reference to "deepgram_tts_example.py" with
"fish_tts_example.py" and adjust the tests reference accordingly. Ensure the
example directory reference (`plugins/<provider>/example/`) and the example
filename mentions match across the header, example callouts, and test references
so readers are not confused.
- Around line 8-11: The nested markdown list in ai-tts.md uses 4-space
indentation causing MD007 lint failures; update the indentation for the nested
items (`plugins/<provider>/pyproject.toml`,
`plugins/<provider>/vision_agents/plugins/<provider>/tts.py`,
`plugins/<provider>/tests/test_tts.py`, `plugins/<provider>/example/`) to use 2
spaces so each nested bullet is indented by two spaces under the parent list
entry; ensure spacing is consistent across the block so markdownlint no longer
flags MD007.
♻️ Duplicate comments (1)
README.md (1)
213-231: Add alt text to images for accessibility.The profile images in this section lack
altattributes, which markdownlint flags as MD045. Screen readers cannot describe these images without alt text.
🧹 Nitpick comments (2)
README.md (1)
92-96: Minor: Consider hyphenating compound adjectives.Static analysis suggests "on-the-job coaching" instead of "on the job coaching" for grammatical consistency.
📝 Suggested fix
-is quite versatile and can be used for: Sales coaching, job interview cheating, physical world/ on the job coaching with +is quite versatile and can be used for: Sales coaching, job interview cheating, physical world/ on-the-job coaching withexamples/06_prometheus_metrics_example/prometheus_metrics_example.py (1)
29-36: Module-level side effect: HTTP server starts on import.The
start_http_server(PROMETHEUS_PORT)call executes unconditionally at import time. If this module is ever imported (for testing, documentation generation, etc.) rather than run directly, it will spin up a server on port 9464.For an example file this is likely acceptable, but consider guarding it or documenting that this file should only be executed, not imported.
🛡️ Optional: Guard server startup
-# Start Prometheus HTTP server on port 9464 -PROMETHEUS_PORT = 9464 -start_http_server(PROMETHEUS_PORT) +# Prometheus HTTP server port +PROMETHEUS_PORT = 9464 + +# Start server only when run as main (moved to bottom of file, before Runner call) +# Note: For this example, we start it here so metrics are ready before vision_agents import +if __name__ == "__main__": + start_http_server(PROMETHEUS_PORT)Alternatively, add a comment clarifying the intentional import-time behavior:
# Start Prometheus HTTP server on port 9464 # NOTE: This runs at import time intentionally - do not import this module, only run it directly PROMETHEUS_PORT = 9464 start_http_server(PROMETHEUS_PORT)
The new
Runnerclass allows running agents in both console and server modes.Summary by CodeRabbit
Refactor
Documentation
New Features
✏️ Tip: You can customize this high-level summary in your review settings.