Skip to content
Merged
Show file tree
Hide file tree
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
27 changes: 21 additions & 6 deletions veadk/cloud/cloud_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

import json
import time
from typing import Any
from uuid import uuid4

Expand Down Expand Up @@ -60,9 +61,11 @@ def __init__(
if not vefaas_endpoint:
self.vefaas_endpoint = self._get_vefaas_endpoint()

if not self.vefaas_endpoint.startswith(
"http"
) and not self.vefaas_endpoint.startswith("https"):
if (
self.vefaas_endpoint
and not self.vefaas_endpoint.startswith("http")
and not self.vefaas_endpoint.startswith("https")
):
raise ValueError(
f"Invalid endpoint: {vefaas_endpoint}. The endpoint must start with `http` or `https`."
)
Expand Down Expand Up @@ -92,12 +95,13 @@ def _get_vefaas_endpoint(
raise ValueError(
f"VeFaaS CloudAPP with application_id `{self.vefaas_application_id}` or application_name `{self.vefaas_application_name}` not found."
)
cloud_resource = json.loads(app["CloudResource"])

try:
cloud_resource = json.loads(app["CloudResource"])
vefaas_endpoint = cloud_resource["framework"]["url"]["system_url"]
except Exception as e:
raise ValueError(f"VeFaaS cloudAPP could not get endpoint. Error: {e}")
logger.warning(f"VeFaaS cloudAPP could not get endpoint. Error: {e}")
vefaas_endpoint = ""
return vefaas_endpoint

def _get_vefaas_application_id_by_name(self) -> str:
Expand Down Expand Up @@ -167,7 +171,18 @@ def delete_self(

vefaas_client = VeFaaS(access_key=volcengine_ak, secret_key=volcengine_sk)
vefaas_client.delete(self.vefaas_application_id)
print(f"Cloud app {self.vefaas_application_id} is deleting...")
print(
f"Cloud app {self.vefaas_application_id} delete request has been sent to VeFaaS"
)
while True:
try:
id = self._get_vefaas_application_id_by_name()
if not id:
break
time.sleep(3)
except Exception as _:
break
print("Delete application done.")

async def message_send(
self, message: str, session_id: str, user_id: str, timeout: float = 600.0
Expand Down
12 changes: 11 additions & 1 deletion veadk/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@
from veadk.version import VERSION

DEFAULT_MODEL_AGENT_NAME = "doubao-seed-1-6-250615"
DEFALUT_MODEL_AGENT_PROVIDER = "openai"
DEFAULT_MODEL_AGENT_PROVIDER = "openai"
DEFAULT_MODEL_AGENT_API_BASE = "https://ark.cn-beijing.volces.com/api/v3/"
DEFAULT_MODEL_EXTRA_HEADERS = {"veadk-source": "veadk", "veadk-version": VERSION}

DEFAULT_APMPLUS_OTEL_EXPORTER_ENDPOINT = "http://apmplus-cn-beijing.volces.com:4317"
DEFAULT_APMPLUS_OTEL_EXPORTER_SERVICE_NAME = "veadk_tracing"

DEFAULT_COZELOOP_OTEL_EXPORTER_ENDPOINT = (
"https://api.coze.cn/v1/loop/opentelemetry/v1/traces"
)

DEFAULT_TLS_OTEL_EXPORTER_ENDPOINT = "https://tls-cn-beijing.volces.com:4318/v1/traces"
DEFAULT_TLS_OTEL_EXPORTER_REGION = "cn-beijing"
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2025 Beijing Volcano Engine Technology Co., Ltd. and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from veadk.cloud.cloud_app import CloudApp

def main() -> None:
cloud_app = CloudApp(vefaas_application_name="{{cookiecutter.vefaas_application_name}}")
cloud_app.delete_self()


if __name__ == "__main__":
main()
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from starlette.routing import Route

from google.adk.a2a.utils.agent_card_builder import AgentCardBuilder
from a2a.types import AgentProvider

from veadk.a2a.ve_a2a_server import init_app
from veadk.runner import Runner
Expand All @@ -46,7 +47,9 @@
agent = agent_run_config.agent
short_term_memory = agent_run_config.short_term_memory

agent_card_builder = AgentCardBuilder(agent=agent)
VEFAAS_REGION = os.getenv("APP_REGION", "cn-beijing")
VEFAAS_FUNC_ID = os.getenv("_FAAS_FUNC_ID", "")
agent_card_builder = AgentCardBuilder(agent=agent, provider=AgentProvider(organization="Volcengine Agent Development Kit (VeADK)", url=f"https://console.volcengine.com/vefaas/region:vefaas+{VEFAAS_REGION}/function/detail/{VEFAAS_FUNC_ID}"))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

if AgentCard include the version+commit id of veadk?



def load_tracer() -> None:
Expand Down
Loading