diff --git a/python/01-tutorials/01-agentkit-runtime/05_callback/README.md b/python/01-tutorials/01-agentkit-runtime/05_callback/README.md
index 6e7197e..219e821 100644
--- a/python/01-tutorials/01-agentkit-runtime/05_callback/README.md
+++ b/python/01-tutorials/01-agentkit-runtime/05_callback/README.md
@@ -233,7 +233,7 @@ agentkit invoke '请帮我写一篇关于人工智能未来的500字文章'
agentkit invoke '你好,我想了解一些关于 zanghua 的信息'
# 或使用 client.py 连接云端服务
-# 需要编辑 client.py,将其中的第 14 行和第 15 行的 base_url 和 api_key 修改为 agentkit.yaml 中生成的 runtime_endpoint 和 runtime_apikey 字段
+# 需要编辑 client.py,将其中的第 13 行和第 14 行的 base_url 和 api_key 修改为 agentkit.yaml 中生成的 runtime_endpoint 和 runtime_apikey 字段
# 按需修改 client.py,第 56 行,请求的内容
uv run client.py
```
diff --git a/python/01-tutorials/01-agentkit-runtime/05_callback/README_en.md b/python/01-tutorials/01-agentkit-runtime/05_callback/README_en.md
index e1ed324..180146e 100644
--- a/python/01-tutorials/01-agentkit-runtime/05_callback/README_en.md
+++ b/python/01-tutorials/01-agentkit-runtime/05_callback/README_en.md
@@ -238,10 +238,6 @@ agentkit invoke 'Hello, I would like to know some information about zanghua'
uv run client.py
```
-## Example Prompts
-
-## Effect Demonstration
-
## Detailed Explanation of Callback Functions
### 1. before_agent_callback
diff --git a/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/README.md b/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/README.md
index 931ac86..ad445aa 100644
--- a/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/README.md
+++ b/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/README.md
@@ -1,6 +1,6 @@
# Image and Video Tools - 生图生视频工具
-基于火山引擎 VeADK 和多媒体生成工具构建的创意内容生成示例,展示如何通过多智能体协作生成图片和视频内容。
+基于火山引擎 VeADK 和多媒体生成工具构建的创意内容生成示例,展示如何通过 Agent 生成图片和视频内容。
## 概述
@@ -8,7 +8,7 @@
## 核心功能
-- 多智能体架构:主 Agent 协调多个子 Agent
+- 单 Agent 架构:使用单一 Agent 协调所有工具
- 图像生成:将文字描述转换为图片
- 视频生成:基于图片或文字生成视频
- 内容搜索:使用 Web 搜索增强创作能力
@@ -18,60 +18,73 @@
```text
用户输入(文本描述)
↓
-主 Agent (eposide_generator)
- ├── Image Generator (图像生成子 Agent)
- │ └── image_generate 工具
- │
- ├── Video Generator (视频生成子 Agent)
- │ └── video_generate 工具
- │
- └── Web Search (内容搜索)
- └── web_search 工具
+主 Agent (image_video_tools_agent)
+ ├── web_search 工具(搜索背景信息)
+ ├── image_generate 工具(生成图片)
+ └── video_generate 工具(生成视频)
```
### 核心组件
| 组件 | 描述 |
| - | - |
-| **主 Agent** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L37-L43) - eposide_generator,协调子 Agent |
-| **图像生成 Agent** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L30-L35) - image_generator,生成图片 |
-| **视频生成 Agent** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L23-L28) - video_generator,生成视频 |
+| **主 Agent** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L38-L69) - image_video_tools_agent,负责理解用户意图并调用工具 |
| **内置工具** | `image_generate`, `video_generate`, `web_search` |
-| **项目配置** | [pyproject.toml](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/pyproject.toml) - 依赖管理(uv 工具) |
+| **服务框架** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L81-L89) - AgentkitAgentServerApp,提供 HTTP 服务接口 |
+| **客户端测试** | [client.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/client.py) - 测试客户端,用于调用部署的云端服务 |
+| **项目配置** | [pyproject.toml](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/pyproject.toml) - 依赖管理 |
### 代码特点
-**子 Agent 定义**([agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L23-L35)):
+**主 Agent 配置**([agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L38-L69)):
```python
-video_generator = Agent(
- name="video_generator",
- description="视频生成 Agent",
- instruction="你是一个原子化的 Agent,具备视频生成能力,每次执行完毕后,考虑回到主 Agent。",
- tools=[video_generate],
-)
-
-image_generator = Agent(
- name="image_generator",
- description="图像生成 Agent",
- instruction="你是一个原子化的 Agent,具备图像生成能力,每次执行完毕后,考虑回到主 Agent。",
- tools=[image_generate],
+root_agent = Agent(
+ name="image_video_tools_agent",
+ description="调用 tools 生成图片或者视频",
+ instruction="""
+ 你是一个生图生视频助手,具备图像生成和视频生成能力。有三个可用的工具:
+ - web_search:用于搜索相关信息。
+ - image_generate:用于生成图像。
+ - video_generate:用于生成视频。
+
+ ### 工作流程:
+
+ 1. 当用户提供输入时,根据用户输入,准备相关背景信息:
+ - 若用户输入为故事或情节,直接调用 web_search 工具;
+ - 若用户输入为其他类型(如问题、请求),则先调用 web_search 工具 (最多调用2次),找到合适的信息。
+ 2. 根据准备好的背景信息,调用 image_generate 工具生成分镜图片。生成后,以 Markdown 图片列表形式返回,例如:
+ ```
+ 
+ ```
+ 3. 根据用户输入,判断是否需要调用 video_generate 工具生成视频。返回视频 URL 时,使用 Markdown 视频链接列表,例如:
+ ```
+
+ ```
+
+ ### 注意事项:
+ - 输入输出中,任何涉及图片或视频的链接url,**绝对禁止任何形式的修改、截断、拼接或替换**,必须100%保持原始内容的完整性与准确性。
+ """,
+ tools=[web_search, image_generate, video_generate],
)
```
-**主 Agent 配置**([agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L37-L43)):
+**服务启动**([agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L81-L89)):
```python
-root_agent = Agent(
- name="eposide_generator",
- description="调用子Agents生成图片或者视频",
- instruction="""你可以根据用户输入的一段小文字来生成视频或者生成图片""",
- sub_agents=[image_generator, video_generator],
- tools=[web_search],
+short_term_memory = ShortTermMemory(backend="local")
+
+agent_server_app = AgentkitAgentServerApp(
+ agent=root_agent,
+ short_term_memory=short_term_memory,
)
+
+if __name__ == "__main__":
+ agent_server_app.run(host="0.0.0.0", port=8000)
```
-**使用示例**([agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L47-L67)):
+**使用示例**([agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L71-L79)):
+
```python
async def main(prompts: list[str]):
@@ -114,7 +127,7 @@ asyncio.run(main([
**2. 开通多媒体生成服务:**
- 确保已开通图像生成和视频生成服务
-- 参考 [视频生成文档](https://www.volcengine.com/docs/6791/1106485)
+- 参考 [视频生成文档](https://www.volcengine.com/docs/82379/1366799)
**3. 获取火山引擎访问凭证:**
@@ -137,15 +150,8 @@ brew install uv
```bash
# 进入项目目录
cd 01-tutorials/01-agentkit-runtime/06_image_video_tools
-```
-
-使用 `uv` 工具来安装本项目依赖:
-
-```bash
-# 如果没有 `uv` 虚拟环境,可以使用命令先创建一个虚拟环境
-uv venv --python 3.12
-# 使用 `pyproject.toml` 管理依赖
+# 使用 uv 安装依赖
uv sync --index-url https://pypi.tuna.tsinghua.edu.cn/simple
# 激活虚拟环境
@@ -163,9 +169,20 @@ export VOLCENGINE_ACCESS_KEY=
export VOLCENGINE_SECRET_KEY=
```
-### 调试方法
+### 启动服务
+
+#### 方式一:直接运行服务(推荐)
+
+```bash
+# 启动 Agent 服务(默认端口 8000)
+uv run agent.py
+
+# 服务启动后,可通过以下方式测试:
+# 1. 使用 client.py 测试
+# 2. 使用 VeADK Web 调试界面
+```
-#### 方式一:使用 VeADK Web 调试界面
+#### 方式二:使用 VeADK Web 调试界面
```bash
# 进入上级目录
@@ -179,17 +196,6 @@ veadk web
Web 界面提供图形化对话测试环境,支持实时查看生成的图片和视频。
-#### 方式二:命令行测试(推荐学习)
-
-```bash
-# 运行示例脚本
-uv run agent.py
-
-# 脚本会依次执行两个任务:
-# 1. 生成古文片段的图片
-# 2. 基于图片生成视频
-```
-
## AgentKit 部署
### 前置准备
@@ -218,10 +224,20 @@ agentkit launch
# 测试部署的 Agent
agentkit invoke '请生成古文片段 落霞与孤鹜齐飞,秋水共长天一色 的首帧图片'
+```
+
+### 使用客户端测试
+
+编辑 [client.py](client.py#L14-L16),将 `base_url` 和 `api_key` 修改为 `agentkit.yaml` 中生成的 `runtime_endpoint` 和 `runtime_apikey` 字段:
+
+```python
+base_url = "http://"
+api_key = ""
+```
+
+运行客户端测试:
-# 或使用 client.py 连接云端服务
-# 需要编辑 client.py,将其中的第 14 行和第 15 行的 base_url 和 api_key 修改为 agentkit.yaml 中生成的 runtime_endpoint 和 runtime_apikey 字段
-# 按需修改 client.py,第 56 行,请求的内容
+```bash
uv run client.py
```
@@ -234,31 +250,22 @@ uv run client.py
```text
用户:请生成古文片段 落霞与孤鹜齐飞,秋水共长天一色 的首帧图片
Agent:我来为您生成这个古文场景的图片...
- [调用 image_generator → image_generate 工具]
+ [调用 web_search 搜索背景信息]
+ [调用 image_generate 生成图片]
已生成图片,展现了落霞、孤鹜与秋水长天的意境。
+ 
```
### 视频生成
-**基于图片生成视频**:
+**基于文字描述生成视频**:
```text
-用户:刚才的首帧图,生成视频。
-Agent:我来基于刚才的图片生成视频...
- [调用 video_generator → video_generate 工具]
- 视频已生成,为您呈现动态的古文意境。
-```
-
-### 创意场景
-
-**宇宙科幻场景**:
-
-```text
-用户:生成一个宇宙飞船在星际航行的场景图片
-Agent:[生成科幻风格的宇宙飞船图片]
-
-用户:把这张图片做成视频
-Agent:[生成宇宙飞船航行的动态视频]
+用户:生成一段宇宙飞船在星际航行的视频
+Agent:[调用 web_search 搜索相关背景]
+ [调用 video_generate 生成视频]
+ 视频已生成,为您呈现宇宙飞船在星际航行的场景。
+
```
### 结合搜索增强
@@ -276,12 +283,11 @@ Agent:[调用 web_search 搜索富士山信息]
## 技术要点
-### 多智能体架构
+### 单 Agent 架构
-- **主 Agent**:负责理解用户意图,协调子 Agent
-- **子 Agent**:专注于单一功能(图像或视频生成)
-- **原子化设计**:每个子 Agent 完成任务后返回主 Agent
-- **工具隔离**:每个子 Agent 只拥有特定工具
+- **主 Agent**:负责理解用户意图,直接调用所有工具
+- **工具集成**:所有工具(web_search, image_generate, video_generate)集成在主 Agent 中
+- **工作流程**:搜索背景信息 → 生成图片 → 按需生成视频
### 内置工具
@@ -306,16 +312,23 @@ from veadk.tools.builtin_tools.web_search import web_search
### 多轮对话上下文
- 使用 `session_id` 维护会话上下文
-- 支持连续生成(先图片,后视频)
-- Agent 能理解"刚才的图片"等上下文引用
+- 使用 `ShortTermMemory` 存储对话历史
+- Agent 能理解上下文引用
+
+### HTTP 服务接口
+
+- 使用 `AgentkitAgentServerApp` 提供 HTTP 服务
+- 默认端口 8000
+- 支持 SSE 流式响应
### 工作流程
1. **用户输入**:提供文字描述
-2. **主 Agent 理解**:分析是图片还是视频需求
-3. **委托子 Agent**:调用对应的子 Agent
-4. **工具执行**:子 Agent 调用生成工具
-5. **结果返回**:生成的图片/视频返回给用户
+2. **Agent 理解**:分析用户意图,确定需要调用的工具
+3. **背景搜索**(按需):调用 web_search 搜索相关信息
+4. **图片生成**:调用 image_generate 生成图片
+5. **视频生成**(按需):调用 video_generate 生成视频
+6. **结果返回**:以 Markdown 格式返回图片/视频链接
## 常见问题
diff --git a/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/README_en.md b/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/README_en.md
index 547407a..a531b7c 100644
--- a/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/README_en.md
+++ b/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/README_en.md
@@ -1,6 +1,6 @@
# Image and Video Tools - Image and Video Generation Agent
-A creative content generation example based on Volcano Engine VeADK and multimedia generation tools, demonstrating how to generate image and video content through multi-agent collaboration.
+A creative content generation example based on Volcano Engine VeADK and multimedia generation tools, demonstrating how to generate image and video content through Agent.
## Overview
@@ -8,7 +8,7 @@ This example demonstrates how to use VeADK to build a multi-agent system to gene
## Core Functions
-- Multi-agent architecture: The main Agent coordinates multiple sub-Agents
+- Single Agent architecture: Use a single Agent to coordinate all tools
- Image generation: Convert text descriptions into images
- Video generation: Generate videos based on images or text
- Content search: Use Web search to enhance creative capabilities
@@ -18,60 +18,73 @@ This example demonstrates how to use VeADK to build a multi-agent system to gene
```text
User Input (text description)
↓
-Main Agent (eposide_generator)
- ├── Image Generator (image generation sub-Agent)
- │ └── image_generate tool
- │
- ├── Video Generator (video generation sub-Agent)
- │ └── video_generate tool
- │
- └── Web Search (content search)
- └── web_search tool
+Main Agent (image_video_tools_agent)
+ ├── web_search tool (search background information)
+ ├── image_generate tool (generate images)
+ └── video_generate tool (generate videos)
```
### Core Components
| Component | Description |
| - | - |
-| **Main Agent** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L37-L43) - eposide_generator, coordinates sub-Agents |
-| **Image Generation Agent** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L30-L35) - image_generator, generates images |
-| **Video Generation Agent** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L23-L28) - video_generator, generates videos |
+| **Main Agent** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L38-L69) - image_video_tools_agent, responsible for understanding user intent and calling tools |
| **Built-in Tools** | `image_generate`, `video_generate`, `web_search` |
-| **Project Configuration** | [pyproject.toml](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/pyproject.toml) - dependency management (uv tool) |
+| **Service Framework** | [agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L81-L89) - AgentkitAgentServerApp, provides HTTP service interface |
+| **Client Test** | [client.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/client.py) - Test client, used to call deployed cloud service |
+| **Project Configuration** | [pyproject.toml](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/pyproject.toml) - dependency management |
### Code Features
-**Sub-Agent Definition** ([agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L23-L35)):
+**Main Agent Configuration** ([agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L38-L69)):
```python
-video_generator = Agent(
- name="video_generator",
- description="Video Generation Agent",
- instruction="You are an atomic Agent with video generation capabilities. After each execution, consider returning to the main Agent.",
- tools=[video_generate],
-)
-
-image_generator = Agent(
- name="image_generator",
- description="Image Generation Agent",
- instruction="You are an atomic Agent with image generation capabilities. After each execution, consider returning to the main Agent.",
- tools=[image_generate],
+root_agent = Agent(
+ name="image_video_tools_agent",
+ description="Call tools to generate images or videos",
+ instruction="""
+ You are an image and video generation assistant with image generation and video generation capabilities. There are three available tools:
+ - web_search: Used to search for relevant information.
+ - image_generate: Used to generate images.
+ - video_generate: Used to generate videos.
+
+ ### Workflow:
+
+ 1. When the user provides input, prepare relevant background information based on the user input:
+ - If the user input is a story or plot, directly call the web_search tool;
+ - If the user input is of other types (such as questions or requests), call the web_search tool first (up to 2 times) to find suitable information.
+ 2. Based on the prepared background information, call the image_generate tool to generate storyboard images. After generation, return them in Markdown image list format, for example:
+ ```
+ 
+ ```
+ 3. Based on the user input, determine whether to call the video_generate tool to generate videos. When returning video URLs, use Markdown video link list format, for example:
+ ```
+
+ ```
+
+ ### Notes:
+ - In any input and output, any URLs involving images or videos, **absolutely prohibit any form of modification, truncation, stitching, or replacement**, must maintain 100% the completeness and accuracy of the original content.
+ """,
+ tools=[web_search, image_generate, video_generate],
)
```
-**Main Agent Configuration** ([agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L37-L43)):
+**Service Startup** ([agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L81-L89)):
```python
-root_agent = Agent(
- name="eposide_generator",
- description="Call sub-Agents to generate images or videos",
- instruction="""You can generate videos or images based on a short piece of text entered by the user""",
- sub_agents=[image_generator, video_generator],
- tools=[web_search],
+short_term_memory = ShortTermMemory(backend="local")
+
+agent_server_app = AgentkitAgentServerApp(
+ agent=root_agent,
+ short_term_memory=short_term_memory,
)
+
+if __name__ == "__main__":
+ agent_server_app.run(host="0.0.0.0", port=8000)
```
-**Usage Example** ([agent.py](https://github.com/volcengine/agentkit-samples/blob/main/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L47-L67)):
+**Usage Example** ([agent.py](https://github.com/volcengine/agentkit-samples/blob/3bc92248d02a71c3a75d737931ed96b796aafc10/python/01-tutorials/01-agentkit-runtime/06_image_video_tools/agent.py#L71-L79)):
+
```python
async def main(prompts: list[str]):
@@ -85,7 +98,7 @@ async def main(prompts: list[str]):
# Example prompts
asyncio.run(main([
- "Please generate the first frame image of the ancient Chinese prose 'Luoxia yu guwu qifei, qiushui gong changtian yise' (Rosy clouds and solitary ducks fly together, autumn water merges with the vast sky).",
+ "Please generate the first frame image of the ancient Chinese prose 'Luoxia yu guwu qifei, qiushui gong changtian yise' (落霞与孤鹜齐飞,秋水共长天一色).",
"Generate a video from the first frame image just now.",
]))
```
@@ -114,7 +127,7 @@ asyncio.run(main([
**2. Activate Multimedia Generation Service:**
- Ensure that image generation and video generation services have been activated
-- Refer to [Video Generation Documentation](https://www.volcengine.com/docs/6791/1106485)
+- Refer to [Video Generation Documentation](https://www.volcengine.com/docs/82379/1366799)
**3. Obtain Volcano Engine Access Credentials:**
@@ -136,16 +149,9 @@ brew install uv
```bash
# Enter the project directory
-cd python/01-tutorials/01-agentkit-runtime/06_image_video_tools
-```
-
-Use the `uv` tool to install the project dependencies:
+cd 01-tutorials/01-agentkit-runtime/06_image_video_tools
-```bash
-# If there is no `uv` virtual environment, you can use the command to create a virtual environment first
-uv venv --python 3.12
-
-# Use `pyproject.toml` to manage dependencies
+# Use uv to install dependencies
uv sync --index-url https://pypi.tuna.tsinghua.edu.cn/simple
# Activate the virtual environment
@@ -163,9 +169,20 @@ export VOLCENGINE_ACCESS_KEY=
export VOLCENGINE_SECRET_KEY=
```
-### Debugging Methods
+### Start Service
+
+#### Method 1: Run service directly (recommended)
+
+```bash
+# Start Agent service (default port 8000)
+uv run agent.py
+
+# After service starts, you can test it in the following ways:
+# 1. Use client.py for testing
+# 2. Use VeADK Web debugging interface
+```
-#### Method 1: Use the VeADK Web debugging interface
+#### Method 2: Use VeADK Web debugging interface
```bash
# Go to the parent directory
@@ -179,17 +196,6 @@ veadk web
The Web interface provides a graphical dialogue testing environment, supporting real-time viewing of generated images and videos.
-#### Method 2: Command line testing (recommended for learning)
-
-```bash
-# Run the example script
-uv run agent.py
-
-# The script will execute two tasks in sequence:
-# 1. Generate an image of the ancient Chinese prose
-# 2. Generate a video based on the image
-```
-
## AgentKit Deployment
### Prerequisites
@@ -218,10 +224,20 @@ agentkit launch
# Test the deployed Agent
agentkit invoke 'Please generate the first frame image of the ancient Chinese prose "Luoxia yu guwu qifei, qiushui gong changtian yise"'
+```
+
+### Use Client for Testing
+
+Edit [client.py](client.py#L14-L16), change `base_url` and `api_key` to the `runtime_endpoint` and `runtime_apikey` fields generated in `agentkit.yaml`:
+
+```python
+base_url = "http://"
+api_key = ""
+```
-# Or use client.py to connect to the cloud service
-# You need to edit client.py and change the base_url and api_key in lines 14 and 15 to the runtime_endpoint and runtime_apikey fields generated in agentkit.yaml
-# Modify client.py as needed, line 56, the content of the request
+Run client for testing:
+
+```bash
uv run client.py
```
@@ -234,31 +250,22 @@ uv run client.py
```text
User: Please generate the first frame image of the ancient Chinese prose "Luoxia yu guwu qifei, qiushui gong changtian yise"
Agent: I will generate an image of this ancient Chinese scene for you...
- [Call image_generator → image_generate tool]
+ [Call web_search to search background information]
+ [Call image_generate to generate image]
The image has been generated, showing the artistic conception of rosy clouds, solitary ducks, and autumn water merging with the vast sky.
+ 
```
### Video Generation
-**Generate a video based on an image**:
-
-```text
-User: Generate a video from the first frame image just now.
-Agent: I will generate a video based on the image just now...
- [Call video_generator → video_generate tool]
- The video has been generated, presenting you with a dynamic artistic conception of ancient Chinese prose.
-```
-
-### Creative Scenes
-
-**Cosmic science fiction scene**:
+**Generate a video based on a text description**:
```text
-User: Generate a scene picture of a spaceship sailing in interstellar space
-Agent: [Generate a science fiction style spaceship picture]
-
-User: Make this picture into a video
-Agent: [Generate a dynamic video of the spaceship sailing]
+User: Generate a video of a spaceship sailing in interstellar space
+Agent: [Call web_search to search for relevant background]
+ [Call video_generate to generate video]
+ The video has been generated, presenting you with the scene of a spaceship sailing in interstellar space.
+
```
### Enhanced with Search
@@ -268,7 +275,7 @@ Agent: [Generate a dynamic video of the spaceship sailing]
```text
User: Search for the characteristics of Mount Fuji, and then generate a picture of Mount Fuji
Agent: [Call web_search to search for information about Mount Fuji]
- [Generate a picture of Mount Fuji based on the search results by calling image_generate]
+ [Based on search results, call image_generate to generate Mount Fuji picture]
A picture of Mount Fuji has been generated for you, showing features such as snow-capped mountains and cherry blossoms.
```
@@ -276,12 +283,11 @@ Agent: [Call web_search to search for information about Mount Fuji]
## Technical Points
-### Multi-agent Architecture
+### Single Agent Architecture
-- **Main Agent**: Responsible for understanding user intent and coordinating sub-Agents
-- **Sub-Agent**: Focus on a single function (image or video generation)
-- **Atomic design**: Each sub-Agent returns to the main Agent after completing its task
-- **Tool isolation**: Each sub-Agent only has specific tools
+- **Main Agent**: Responsible for understanding user intent, directly calling all tools
+- **Tool integration**: All tools (web_search, image_generate, video_generate) are integrated in the main Agent
+- **Workflow**: Search background information → Generate images → Generate videos as needed
### Built-in Tools
@@ -306,16 +312,23 @@ from veadk.tools.builtin_tools.web_search import web_search
### Multi-turn Dialogue Context
- Use `session_id` to maintain session context
-- Support continuous generation (image first, then video)
-- The Agent can understand contextual references such as "the image just now"
+- Use `ShortTermMemory` to store conversation history
+- The Agent can understand contextual references
+
+### HTTP Service Interface
+
+- Use `AgentkitAgentServerApp` to provide HTTP service
+- Default port 8000
+- Support SSE streaming response
### Workflow
1. **User input**: Provide a text description
-2. **Main Agent understanding**: Analyze whether it is an image or video request
-3. **Delegate to sub-Agent**: Call the corresponding sub-Agent
-4. **Tool execution**: The sub-Agent calls the generation tool
-5. **Result return**: The generated image/video is returned to the user
+2. **Agent understanding**: Analyze user intent, determine which tools to call
+3. **Background search** (as needed): Call web_search to search for relevant information
+4. **Image generation**: Call image_generate to generate images
+5. **Video generation** (as needed): Call video_generate to generate videos
+6. **Result return**: Return image/video links in Markdown format
## Frequently Asked Questions
diff --git a/python/01-tutorials/05-agentkit-memory/01_viking_memory/README.md b/python/01-tutorials/05-agentkit-memory/01_viking_memory/README.md
index 45b7f07..a4c34a4 100644
--- a/python/01-tutorials/05-agentkit-memory/01_viking_memory/README.md
+++ b/python/01-tutorials/05-agentkit-memory/01_viking_memory/README.md
@@ -209,7 +209,7 @@ agentkit config \
agentkit launch
# 测试部署的 Agent
-agentkit invoke 'What is my habby?'
+agentkit invoke 'What is my hobby?'
```
## 示例提示词
diff --git a/python/01-tutorials/05-agentkit-memory/01_viking_memory/README_en.md b/python/01-tutorials/05-agentkit-memory/01_viking_memory/README_en.md
index c517f2e..fc7c79d 100644
--- a/python/01-tutorials/05-agentkit-memory/01_viking_memory/README_en.md
+++ b/python/01-tutorials/05-agentkit-memory/01_viking_memory/README_en.md
@@ -76,7 +76,7 @@ agent2 = Agent(
## Directory Structure
```text
-0_viking_memory/
+01_viking_memory/
├── agent.py # Agent application entry point
├── local_test.py # Complete memory function demonstration script
├── requirements.txt # Python dependency list (required for agentkit deployment)
diff --git a/python/01-tutorials/05-agentkit-memory/01_viking_memory/client.py b/python/01-tutorials/05-agentkit-memory/01_viking_memory/client.py
index d753e99..d43da79 100644
--- a/python/01-tutorials/05-agentkit-memory/01_viking_memory/client.py
+++ b/python/01-tutorials/05-agentkit-memory/01_viking_memory/client.py
@@ -53,6 +53,6 @@ async def send_request(message: str):
print(line)
async def send_request_parallel():
- await send_request("My habby is 0xabcd")
+ await send_request("My hobby is 0xabcd")
asyncio.run(send_request_parallel())
diff --git a/python/01-tutorials/05-agentkit-memory/01_viking_memory/local_test.py b/python/01-tutorials/05-agentkit-memory/01_viking_memory/local_test.py
index 3c9e650..76d8df4 100644
--- a/python/01-tutorials/05-agentkit-memory/01_viking_memory/local_test.py
+++ b/python/01-tutorials/05-agentkit-memory/01_viking_memory/local_test.py
@@ -37,19 +37,19 @@
async def main():
# 存入短期记忆
response1 = await runner1.run(
- messages="My habby is 0xabcd", session_id=history_session_id
+ messages="My hobby is 0xabcd", session_id=history_session_id
)
print(f"Response 1: {response1}\n")
# 同session读取短期记忆
response2 = await runner1.run(
- messages="What is my habby?", session_id=history_session_id
+ messages="What is my hobby?", session_id=history_session_id
)
print(f"Response 2: {response2}\n")
# 新session无短期记忆(失败)
response3 = await runner1.run(
- messages="What is my habby?", session_id=new_session_id
+ messages="What is my hobby?", session_id=new_session_id
)
print(f"Response 3: {response3}\n")
@@ -71,7 +71,7 @@ async def main():
# 新session读取长期记忆
response4 = await runner2.run(
- messages="What is my habby?", session_id=new_session_id
+ messages="What is my hobby?", session_id=new_session_id
)
print(f"Response 4: {response4}")