fix(examples): sync AgentRuntime SDK example name#329
fix(examples): sync AgentRuntime SDK example name#329mrinalchaturvedi27 wants to merge 1 commit into
Conversation
Signed-off-by: Mrinal Chaturvedi <mrinal.chaturvedi27@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
There was a problem hiding this comment.
Pull request overview
Updates the Python SDK AgentRuntime usage example so it references the same AgentRuntime resource name as the sample YAML (simple-agentruntime), avoiding a mismatch when users apply the YAML and run the example.
Changes:
- Introduced a single
AGENT_NAME = "simple-agentruntime"constant insdk-python/examples/agent_runtime_usage.py. - Updated both
AgentRuntimeClientinstantiations to useAGENT_NAMEinstead of the previous hard-coded"my-agent".
There was a problem hiding this comment.
Code Review
This pull request refactors the agent_runtime_usage.py example by introducing an AGENT_NAME constant to replace hardcoded strings in AgentRuntimeClient instantiations. The feedback suggests adding verbose=True to the second client instance for consistency with the first, ensuring uniform logging behavior throughout the example.
| # second time: it will try to reuse the pod created before | ||
| agent_client_v2 = AgentRuntimeClient( | ||
| agent_name="my-agent", | ||
| agent_name=AGENT_NAME, |
There was a problem hiding this comment.
For consistency with the first AgentRuntimeClient instantiation (line 20), consider setting verbose=True here as well. This ensures that debug logs are available for both the initial bootstrapping and the subsequent session reuse, providing a consistent and informative experience for users running the example.
| agent_name=AGENT_NAME, | |
| agent_name=AGENT_NAME, | |
| verbose=True, |
There was a problem hiding this comment.
@gemini-code-assist verbose=True is already present in this client initialization below session_id, so I’m leaving this unchanged to avoid duplicating the keyword argument.
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #329 +/- ##
==========================================
+ Coverage 47.57% 49.12% +1.55%
==========================================
Files 30 30
Lines 2819 2858 +39
==========================================
+ Hits 1341 1404 +63
+ Misses 1338 1301 -37
- Partials 140 153 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Hi @LiZhenCheng9527 @YaoZengzeng quick ping for this PR :) |
What type of PR is this?
/kind bug
What this PR does / why we need it:
This makes the Python SDK AgentRuntime example use the same name as the sample YAML.
Before this change, the YAML created
simple-agentruntime, but the Python example usedmy-agent.Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
This is only an example-name fix.
Does this PR introduce a user-facing change?:
What I fixed
I fixed a small mismatch in the AgentRuntime examples.
The YAML example creates an AgentRuntime named
simple-agentruntime, but the Python SDK example was still usingmy-agent. Now the Python example usessimple-agentruntimetoo.How I found it
I checked the two files from the report. The names did not match, and nearby examples did not show a larger change was needed.
What I changed
AGENT_NAME = "simple-agentruntime"insdk-python/examples/agent_runtime_usage.py.AgentRuntimeClientcalls.Why this is legit
This is a real example bug. If someone applies the YAML and then runs the Python example, both should point to the same AgentRuntime.
I only changed the Python example because the YAML name already looked correct for this example.
Validation
../.venv/bin/python -m pytest tests/test_agent_runtime.py -qfromsdk-python/- Passed, 7 tests.../.venv/bin/python -m ruff check examples/agent_runtime_usage.py tests/test_agent_runtime.py --config ../pyproject.tomlfromsdk-python/- Passed..venv/bin/python -m ruff check . --config pyproject.tomlfrom repo root - Passed.git diff --check -- sdk-python/examples/agent_runtime_usage.py- Passed.