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
8 changes: 8 additions & 0 deletions common/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,11 @@ const (
DATABASE_TOS_REGION = "DATABASE_TOS_REGION"
DATABASE_TOS_BUCKET = "DATABASE_TOS_BUCKET"
)

// AGENTKIT TOOL
const (
AGENTKIT_TOOL_ID = "AGENTKIT_TOOL_ID"
AGENTKIT_TOOL_REGION = "AGENTKIT_TOOL_REGION"
AGENTKIT_TOOL_SERVICE_CODE = "AGENTKIT_TOOL_SERVICE_CODE"
AGENTKIT_TOOL_HOST = "AGENTKIT_TOOL_HOST"
)
9 changes: 7 additions & 2 deletions common/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,13 @@ const (
DEFAULT_DATABASE_TOS_BUCKET = "veadk-go-bucket"
)

//web_search

// WebSearch
const (
DEFAULT_WEB_SEARCH_REGION = "cn-beijing"
)

// AGENTKIT TOOL
const (
DEFAULT_AGENTKIT_TOOL_REGION = "cn-beijing"
DEFAULT_AGENTKIT_TOOL_SERVICE_CODE = "agentkit"
)
2 changes: 1 addition & 1 deletion examples/knowledgebase/agent_with_knowledge.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func CalculateDateDifferenceTool() (tool.Tool, error) {
}
return functiontool.New(
functiontool.Config{
Name: "calculate date difference",
Name: "calculate_date_difference",
Description: "计算两个日期之间的天数差异\nArgs:\n\tdate1: 第一个日期,格式为YYYY-MM-DD\n\tdate2: 第二个日期,格式为YYYY-MM-DD\nReturns:\n\t两个日期之间的天数差异(绝对值)",
},
handler,
Expand Down
2 changes: 1 addition & 1 deletion examples/tool/image_generate/agent_with_image_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func main() {
APIKey: os.Getenv(common.MODEL_IMAGE_API_KEY),
})
if err != nil {
fmt.Printf("NewLLMAgent failed: %v", err)
fmt.Printf("NewImageGenerateTool failed: %v", err)
return
}

Expand Down
87 changes: 87 additions & 0 deletions examples/tool/run_code/agent_with_run_code.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// 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.

package main

import (
"context"
"fmt"
"log"
"os"

veagent "github.com/volcengine/veadk-go/agent/llmagent"
"github.com/volcengine/veadk-go/tool/builtin_tools"
"github.com/volcengine/veadk-go/tool/builtin_tools/web_search"
"google.golang.org/adk/agent"
"google.golang.org/adk/agent/llmagent"
"google.golang.org/adk/cmd/launcher"
"google.golang.org/adk/cmd/launcher/full"
"google.golang.org/adk/session"
"google.golang.org/adk/tool"
)

func main() {
ctx := context.Background()
cfg := veagent.Config{
Config: llmagent.Config{
Name: "data_analysis_agent",
Description: "A data analysis for stock marketing",
Instruction: `你是一个资深软件工程师,在沙箱里执行生产的代码, 可以使用 import subprocess
import sys
subprocess.check_call([sys.executable, "-m", "pip", "install", "akshare", "ipywidgets"])
import akshare as ak
realtime_df = ak.stock_zh_a_spot_em()
target_df = realtime_df[realtime_df['代码'] == stock_code]
print(target_df) 下载相关的股票数据,#只需在上述代码中增加真实stock_code赋值,禁止修改其他代码#,超时时间设为5分钟。可以通过web_search工具搜索相关公司的经营数据。`,
},
ModelExtraConfig: map[string]any{
"extra_body": map[string]any{
"thinking": map[string]string{
"type": "disabled",
},
},
},
ModelName: "deepseek-v3-2-251201",
}

webSearch, err := web_search.NewWebSearchTool(&web_search.Config{})
if err != nil {
fmt.Printf("NewWebSearchTool failed: %v", err)
return
}

runCode, err := builtin_tools.NewRunCodeSandboxTool()
if err != nil {
fmt.Printf("NewRunCodeSandboxTool failed: %v", err)
return
}

cfg.Tools = []tool.Tool{webSearch, runCode}

a, err := veagent.New(&cfg)
if err != nil {
fmt.Printf("NewLLMAgent failed: %v", err)
return
}

config := &launcher.Config{
AgentLoader: agent.NewSingleLoader(a),
SessionService: session.InMemoryService(),
}

l := full.NewLauncher()
if err = l.Execute(ctx, config, os.Args[1:]); err != nil {
log.Fatalf("Run failed: %v\n\n%s", err, l.CommandLineSyntax())
}
}
2 changes: 1 addition & 1 deletion examples/tool/video_generate/agent_with_video_tool.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func main() {
APIKey: os.Getenv(common.MODEL_VIDEO_API_KEY),
})
if err != nil {
fmt.Printf("NewLLMAgent failed: %v", err)
fmt.Printf("NewVideoGenerateTool failed: %v", err)
return
}

Expand Down
2 changes: 1 addition & 1 deletion examples/tool/web_search/agent_with_web_search.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func main() {

webSearch, err := web_search.NewWebSearchTool(&web_search.Config{})
if err != nil {
fmt.Printf("NewLLMAgent failed: %v", err)
fmt.Printf("NewWebSearchTool failed: %v", err)
return
}

Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/joho/godotenv v1.5.1
github.com/stretchr/testify v1.11.1
github.com/volcengine/ve-tos-golang-sdk/v2 v2.7.26
github.com/volcengine/volc-sdk-golang v1.0.229
github.com/volcengine/volcengine-go-sdk v1.1.53
go.uber.org/zap v1.27.1
google.golang.org/adk v0.3.0
Expand All @@ -28,7 +27,6 @@ require (
github.com/awalterschulze/gographviz v2.0.3+incompatible // indirect
github.com/bytedance/sonic v1.14.2 // indirect
github.com/bytedance/sonic/loader v0.4.0 // indirect
github.com/cenkalti/backoff/v4 v4.1.2 // indirect
github.com/cloudwego/base64x v0.1.6 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
Expand Down Expand Up @@ -56,6 +54,7 @@ require (
github.com/smarty/assertions v1.15.0 // indirect
github.com/smartystreets/goconvey v1.8.1 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/volcengine/volc-sdk-golang v1.0.23 // indirect
go.mongodb.org/mongo-driver v1.17.6 // indirect
go.opentelemetry.io/auto/sdk v1.2.1 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect
Expand Down
Loading