Skip to content

fix(agents): expose runtime version on agent models#2568

Open
ks93 wants to merge 7 commits intomasterfrom
feat/agents/add-runtime-version
Open

fix(agents): expose runtime version on agent models#2568
ks93 wants to merge 7 commits intomasterfrom
feat/agents/add-runtime-version

Conversation

@ks93
Copy link
Copy Markdown
Contributor

@ks93 ks93 commented Apr 16, 2026

Summary

  • surface the documented runtimeVersion field as runtime_version on agent read and write models
  • preserve the field through load, dump, and as_write() so agent round-trips keep the API value intact
  • extend unit and integration coverage to verify payload serialization and live CRUD round-trips

Test plan

  • Run poetry run pytest tests/tests_unit/test_data_classes/test_agents/test_agents.py tests/tests_unit/test_api/test_agents.py
  • Run poetry run pytest tests/tests_integration/test_api/test_agents.py

Align the Agents SDK with the documented API by surfacing runtimeVersion on agent read and write models and covering the round-trip in unit and integration tests.
@ks93 ks93 marked this pull request as ready for review April 16, 2026 04:40
@ks93 ks93 requested review from a team as code owners April 16, 2026 04:40
@ks93
Copy link
Copy Markdown
Contributor Author

ks93 commented Apr 16, 2026

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a runtime_version field to the Agent data classes, including AgentCore, AgentUpsert, and Agent. The implementation covers updates to class definitions, constructor signatures, serialization/deserialization logic in _load and as_write, and corresponding updates to integration and unit tests. I have no feedback to provide.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the runtime_version field to the Agent data classes (AgentCore, AgentUpsert, and Agent) and updates the corresponding API methods and tests to support this new attribute. I have no feedback to provide.

ks93 added 2 commits April 15, 2026 22:41
The geospatial service returns 500 errors, causing all geospatial
integration tests to fail in the session-scoped autouse fixture.
@ks93 ks93 enabled auto-merge April 16, 2026 05:51
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.72%. Comparing base (373b6d7) to head (7210c03).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2568      +/-   ##
==========================================
- Coverage   93.47%   92.72%   -0.75%     
==========================================
  Files         480      480              
  Lines       48318    48314       -4     
==========================================
- Hits        45164    44798     -366     
- Misses       3154     3516     +362     
Files with missing lines Coverage Δ
cognite/client/data_classes/agents/agents.py 100.00% <100.00%> (ø)
tests/tests_integration/test_api/test_agents.py 98.11% <100.00%> (+0.07%) ⬆️
...ests/tests_integration/test_api/test_geospatial.py 28.90% <100.00%> (-68.78%) ⬇️
tests/tests_unit/conftest.py 95.16% <ø> (ø)
tests/tests_unit/test_api/test_agents.py 100.00% <100.00%> (ø)
..._unit/test_data_classes/test_agents/test_agents.py 100.00% <100.00%> (ø)

... and 12 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

@haakonvt haakonvt left a comment

Choose a reason for hiding this comment

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

I'm not sure how you asked Claude to add tests, but please be more targeted 😅

Comment thread tests/tests_integration/test_api/test_agents.py Outdated
Comment thread tests/tests_integration/test_api/test_agents.py Outdated
Comment thread tests/tests_integration/test_api/test_geospatial.py Outdated
description (str | None): The human readable description of the agent.
instructions (str | None): Instructions for the agent.
model (str | None): Name of the language model to use. For example, "azure/gpt-4o", "gcp/gemini-2.0" or "aws/claude-3.5-sonnet".
runtime_version (str | None): Version of the runtime environment used by the agent.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

How are people expected to know which are available for selection? The API docs are very limited:

runtimeVersion | string (Runtimeversion)

The runtime version of the agent. Defines the complete execution environment including system
prompt, available tools, and core features. Defaults to the latest version (1.1.1).

Also, 1.1.1 does not look like what you used below at all (2024.09.1). Have you changed to calendar versioning?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I also found this randomly in the docs:
The tool can only be added to an agent if the agent's runtime version is 2.0.0-alpha or higher.

Copy link
Copy Markdown
Contributor Author

@ks93 ks93 Apr 16, 2026

Choose a reason for hiding this comment

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

Updated to semver and updated docstring with link to info and better description: https://docs.cognite.com/cdf/atlas_ai/references/atlas_ai_agent_runtime_versions

Comment thread tests/tests_unit/test_data_classes/test_agents/test_agents.py Outdated
Comment thread tests/tests_unit/test_api/test_agents.py Outdated
@ks93 ks93 added the waiting-for-risk-review Waiting for a member of the risk review team to take an action label Apr 16, 2026
ks93 added 3 commits April 15, 2026 23:32
Address PR feedback: remove runtime_version checks from tests not
specifically testing that field, and delete manually written as_write
test that is already covered by test_base.py.
Update test values from "2024.09.1" to "1.1.1" to match actual API
versioning, and add documentation link for available runtime versions.
Use skipif with a date check so tests resume automatically once the
geospatial service is expected to be available again.
ks93 added a commit that referenced this pull request Apr 16, 2026
…cked PR

These changes are part of #2568 and should not be duplicated here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-for-risk-review Waiting for a member of the risk review team to take an action

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants