Skip to content

fix: update sandbox and template models to use Pydantic Field for TTL…#58

Open
Sodawyx wants to merge 1 commit intomainfrom
fix-sandbox-ttl-seconds
Open

fix: update sandbox and template models to use Pydantic Field for TTL…#58
Sodawyx wants to merge 1 commit intomainfrom
fix-sandbox-ttl-seconds

Conversation

@Sodawyx
Copy link
Collaborator

@Sodawyx Sodawyx commented Mar 2, 2026

… aliases
issue: #53

This commit modifies the sandbox_ttlin_seconds and sandbox_idle_ttlin_seconds fields in the Sandbox and Template models to utilize Pydantic's Field for aliasing to sandboxTTLInSeconds and sandboxIdleTTLInSeconds, respectively. Additionally, tests have been added to ensure correct parsing and serialization of these fields with their aliases.

Co-developed-by: Aone Copilot noreply@alibaba-inc.com

Thank you for creating a pull request to contribute to Serverless Devs agentrun-sdk-python code! Before you open the request please answer the following questions to help it be more easily integrated. Please check the boxes "[ ]" with "[x]" when done too.
Please select one of the PR types below to complete


Fix bugs

Bug detail

The specific manifestation of the bug or the associated issue.

Pull request tasks

  • Add test cases for the changes
  • Passed the CI test

Update docs

Reason for update

Why do you need to update your documentation?

Pull request tasks

  • Update Chinese documentation
  • Update English documentation

Add contributor

Contributed content

  • Code
  • Document

Content detail

if content_type == 'code' || content_type == 'document':
    please tell us `PR url`,like: https://github.com/Serverless-Devs/agentrun-sdk-python/pull/1
else:
    please describe your contribution in detail

Others

Reason for update

Why do you need to update your documentation?

… aliases

This commit modifies the `sandbox_ttlin_seconds` and `sandbox_idle_ttlin_seconds` fields in the `Sandbox` and `Template` models to utilize Pydantic's `Field` for aliasing to `sandboxTTLInSeconds` and `sandboxIdleTTLInSeconds`, respectively. Additionally, tests have been added to ensure correct parsing and serialization of these fields with their aliases.

Co-developed-by: Aone Copilot <noreply@alibaba-inc.com>
Signed-off-by: Sodawyx <sodawyx@126.com>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes Issue #53 by explicitly aliasing TTL-related fields that contain an acronym (TTL) so they correctly parse from/serialize to the Alibaba Cloud API’s expected camelCase keys (e.g., sandboxTTLInSeconds).

Changes:

  • Add explicit Pydantic Field(..., alias=...) for TTL fields in Template, Sandbox, and TemplateInput.
  • Add unit tests covering alias parsing/serialization and from_inner_object() behavior for the TTL fields.
  • Minor test/style formatting cleanups in OpenAPI and integration test fixtures.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
agentrun/sandbox/template.py Explicit alias for Template.sandbox_ttlin_secondssandboxTTLInSeconds.
agentrun/sandbox/sandbox.py Explicit alias for Sandbox.sandbox_idle_ttlin_secondssandboxIdleTTLInSeconds.
agentrun/sandbox/model.py Explicit alias for TemplateInput.sandbox_ttlin_secondssandboxTTLInSeconds.
agentrun/sandbox/__template_async_template.py Keeps the codegen source template in sync with the TTL alias fix.
agentrun/sandbox/__sandbox_async_template.py Keeps the codegen source template in sync with the idle TTL alias fix.
tests/unittests/utils/test_model.py Adds tests validating TTL alias parse/serialize behavior and from_inner_object() parsing.
tests/unittests/toolset/api/test_openapi.py Formatting-only change to $ref strings in test schemas.
tests/unittests/integration/test_langchain_agui_integration.py Formatting-only change to request JSON message content strings.
agentrun/integration/utils/tool.py Formatting-only change for how description is constructed in schema building.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants