Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions gradient_adk/cli/agent/deployment/deploy_service.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import annotations
import asyncio
import importlib.metadata
import time
from pathlib import Path
from typing import Protocol

import gradient_adk
from gradient_adk.logging import get_logger
from gradient_adk.digital_ocean_api.client_async import AsyncDigitalOceanGenAI
from gradient_adk.digital_ocean_api.models import (
Expand All @@ -26,6 +26,14 @@
logger = get_logger(__name__)


def _get_adk_version() -> str:
"""Get the version from package metadata."""
try:
return importlib.metadata.version("gradient-adk")
except importlib.metadata.PackageNotFoundError:
return "unknown"


class DeployService(Protocol):
"""Protocol for agent deployment operations."""

Expand Down Expand Up @@ -330,7 +338,7 @@ async def _create_or_update_deployment(
agent_deployment_name=agent_deployment_name,
agent_deployment_code_artifact=code_artifact,
project_id=project_id,
library_version=gradient_adk.__version__,
library_version=_get_adk_version(),
description=description,
)
workspace_output = await self.client.create_agent_workspace(workspace_input)
Expand All @@ -357,7 +365,7 @@ async def _create_or_update_deployment(
agent_workspace_name=agent_workspace_name,
agent_deployment_name=agent_deployment_name,
agent_deployment_code_artifact=code_artifact,
library_version=gradient_adk.__version__,
library_version=_get_adk_version(),
description=description,
)
deployment_output = await self.client.create_agent_workspace_deployment(
Expand All @@ -376,7 +384,7 @@ async def _create_or_update_deployment(
agent_workspace_name=agent_workspace_name,
agent_deployment_name=agent_deployment_name,
agent_deployment_code_artifact=code_artifact,
library_version=gradient_adk.__version__,
library_version=_get_adk_version(),
)
release_output = await self.client.create_agent_deployment_release(
release_input
Expand Down