Skip to content

Migrate examples to the new Runner API#301

Merged
Nash0x7E2 merged 6 commits intomainfrom
chore/new-runner-api
Jan 20, 2026
Merged

Migrate examples to the new Runner API#301
Nash0x7E2 merged 6 commits intomainfrom
chore/new-runner-api

Conversation

@dangusev
Copy link
Collaborator

@dangusev dangusev commented Jan 20, 2026

The new Runner class allows running agents in both console and server modes.

Summary by CodeRabbit

  • Refactor

    • Replaced the previous CLI entrypoint with a new Runner-based startup across examples and core imports.
  • Documentation

    • Standardized README and guide formatting, improving line-wrapping and readability; updated run instructions to include an explicit "run" subcommand.
  • New Features

    • Added Prometheus/OpenTelemetry metrics initialization and exposure in the metrics example.

✏️ Tip: You can customize this high-level summary in your review settings.

The new `Runner` class allows running agents in both console and server modes.
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

Removed the Click-based cli runner and its export; migrated examples and plugin scripts to use Runner(AgentLauncher(...)).cli() as the new entrypoint. Updated many README/docs for line-wrapping and changed run invocations to include a run subcommand. Added Prometheus/OpenTelemetry setup in a metrics example.

Changes

Cohort / File(s) Summary
Core CLI Removal
agents-core/vision_agents/core/cli/cli_runner.py
Deleted the Click-based CLI runner and its cli() orchestration (async lifecycle, logging, demo handling).
Core Exports
agents-core/vision_agents/core/__init__.py
Removed cli from imports/__all__; examples now use Runner as the public entrypoint.
Examples & Plugin Entrypoints
examples/*/*.py, plugins/*/example/*.py (many files; see diff)
Replaced cli imports with Runner and updated bootstraps from cli(AgentLauncher(...))Runner(AgentLauncher(...)).cli() across ~40+ scripts; minor import reorderings.
Metrics / Prometheus Examples
examples/02_golf_coach_example/golf_coach_with_metrics.py, examples/06_prometheus_metrics_example/prometheus_metrics_example.py
Added Prometheus/OpenTelemetry initialization and moved metrics setup earlier; switched entrypoints to Runner(...).cli().
Deploy / Docker
examples/07_deploy_example/deploy_example.py, examples/07_deploy_example/Dockerfile*, examples/07_deploy_example/README.md
Switched to Runner bootstrap; Dockerfiles and README updated to invoke scripts with the run subcommand.
Docs & READMEs
DEVELOPMENT.md, README.md, examples/*/README.md, plugins/*/example/README.md
Broad formatting, line-wrapping, minor wording tweaks; many run-command examples updated to append run.
Plugin Examples — Misc
plugins/*/example/* (aws, cartesia, deepgram, elevenlabs, fish, heygen, huggingface, inworld, kokoro, moondream, nvidia, openrouter, pocket, qwen, roboflow, sample_plugin, smart_turn, vogent, wizper, etc.)
Consistent replacement of cli with Runner imports/usage; adjusted plugin import ordering in many files; no business-logic changes aside from entrypoint wiring.

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

  • Nash0x7E2
  • tschellenbach

Poem

I press the runner into the darkened moth of code,
it hums like a small machine beneath a stopped sky.
The old click bell folded into silence, and scripts whisper "run".
A shallow light stitches the filepaths into a single seam.
The examples wake; the night exhales.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Migrate examples to the new Runner API' clearly and accurately summarizes the main objective of this pull request, which involves updating example code across the codebase to use the new Runner class.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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_example but this file is in 06_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-metrics

Note: The command should also include the run subcommand 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 the detect_objects bullet 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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

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 alt attributes, 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 with
examples/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)

@Nash0x7E2 Nash0x7E2 merged commit 9215834 into main Jan 20, 2026
10 checks passed
@Nash0x7E2 Nash0x7E2 deleted the chore/new-runner-api branch January 20, 2026 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants