Hội thảo về tác nhân AI từ đầu đến cuối

1. Kiến thức bạn sẽ học được

Ngăn xếp đầy đủ về tác nhân AI

Chào mừng bạn! Bạn sắp học được kỹ năng quan trọng tiếp theo trong phát triển phần mềm: cách hướng dẫn Trí tuệ nhân tạo một cách hiệu quả để tạo, kiểm thử và triển khai phần mềm cấp sản xuất. AI tạo sinh không phải là "chế độ lái tự động", mà là một trợ lý ảo mạnh mẽ cần có người chỉ đạo tài ba.

Hội thảo này cung cấp một phương pháp có cấu trúc và có thể lặp lại để hợp tác với AI ở mọi giai đoạn của Vòng đời phát triển phần mềm (SDLC) chuyên nghiệp. Bạn sẽ chuyển từ một người viết mã từng dòng sang một giám đốc kỹ thuật – một kiến trúc sư có tầm nhìn và một tổng thầu sử dụng AI để thực hiện tầm nhìn đó một cách chính xác. 🚀

bản minh họa

Khi kết thúc hướng dẫn này, bạn sẽ:

  • Dùng AI để chuyển một ý tưởng tổng quan thành kiến trúc đám mây.
  • Tạo một phần phụ trợ Python hoàn chỉnh bằng các câu lệnh cụ thể, có mục tiêu.
  • Sử dụng AI làm lập trình viên hỗ trợ để gỡ lỗi và sửa mã.
  • Uỷ quyền cho AI tạo các bài kiểm thử đơn vị, bao gồm cả các đối tượng mô phỏng.

Tạo Cơ sở hạ tầng dưới dạng mã (IaC) sẵn sàng cho hoạt động sản xuất bằng Terraform.

Tạo một quy trình CI/CD hoàn chỉnh trong GitHub Actions chỉ bằng một câu lệnh.

Giám sát và quản lý ứng dụng đang hoạt động bằng các công cụ vận hành dựa trên AI.

Bạn sẽ không chỉ có một ứng dụng hoạt động mà còn có một bản thiết kế để phát triển ứng dụng bằng AI. Bắt đầu nào!

2. Điều kiện tiên quyết và cách thiết lập

Trước khi bắt đầu, hãy chuẩn bị môi trường của bạn. Đây là một bước quan trọng để đảm bảo hội thảo diễn ra suôn sẻ.

Để hỗ trợ các tác nhân AI của chúng tôi, bạn cần có 2 thứ: một Dự án Google Cloud để cung cấp nền tảng và một Khoá Gemini API để truy cập vào các mô hình mạnh mẽ của Google.

Bước 1: Bật Tài khoản thanh toán

  • Bạn cần phải yêu cầu tài khoản thanh toán có khoản tín dụng 5 đô la để triển khai. Đảm bảo bạn đã đăng nhập vào tài khoản gmail.

Bước 2: Tạo một dự án GCP mới

  • Truy cập vào Google Cloud Console rồi tạo một dự án mới.

tạo tài khoản gcp mới

  • Truy cập vào Google Cloud Console rồi tạo một dự án mới.
  • Mở bảng điều khiển bên trái, nhấp vào Billing, kiểm tra xem tài khoản thanh toán có được liên kết với tài khoản GCP này hay không.

Liên kết tài khoản thanh toán với tài khoản gcp

Nếu bạn thấy trang này, hãy đánh dấu vào manage billing account, chọn Google Cloud Trial One rồi liên kết đến trang đó.

Bước 3: Tạo khoá Gemini API

Trước khi có thể bảo mật khoá, bạn cần phải có khoá.

  • Truy cập vào Google AI Studio : https://aistudio.google.com/
  • Đăng nhập bằng tài khoản Gmail của bạn.
  • Nhấp vào nút "Lấy khoá API", thường nằm trong ngăn điều hướng bên trái hoặc ở góc trên cùng bên phải.
  • Trong hộp thoại "Khoá API", hãy nhấp vào "Tạo khoá API trong dự án mới". Tạo khoá API trong dự án mới
  • Chọn dự án mới mà bạn đã tạo và có tài khoản thanh toán được thiết lập. Chọn dự án mới
  • Một khoá API mới sẽ được tạo cho bạn. Sao chép ngay khoá này và tạm thời lưu trữ ở một nơi an toàn (chẳng hạn như trình quản lý mật khẩu hoặc ghi chú bảo mật). Đây là giá trị bạn sẽ sử dụng trong các bước tiếp theo.

Xác thực GitHub

Mở Cloud Shell bằng cách chuyển đến Google Cloud Console, trên nút "Kích hoạt Cloud Shell" ở trên cùng bên phải.

Bước 1: Mở Cloud Shell

👉Nhấp vào biểu tượng Kích hoạt Cloud Shell ở đầu bảng điều khiển Google Cloud (Đây là biểu tượng có hình dạng thiết bị đầu cuối ở đầu ngăn Cloud Shell), cloud-shell.png

👉Nhấp vào nút "Mở trình chỉnh sửa" (nút này trông giống như một thư mục đang mở có bút chì). Thao tác này sẽ mở Cloud Shell Code Editor trong cửa sổ. Bạn sẽ thấy một trình khám phá tệp ở bên trái. open-editor.png

👉Tìm mã dự án trên Google Cloud:

  • Mở Google Cloud Console: https://console.cloud.google.com
  • Chọn dự án bạn muốn sử dụng cho hội thảo này trong trình đơn thả xuống dự án ở đầu trang.
  • Mã dự án của bạn sẽ xuất hiện trong thẻ Thông tin dự án trên Trang tổng quan

03-04-project-id.png

👉Mở cửa sổ dòng lệnh trong IDE trên đám mây,

03-05-new-terminal.png

👉💻 Trong thiết bị đầu cuối, hãy xác minh rằng bạn đã được xác thực và dự án được đặt thành mã dự án của bạn bằng lệnh sau:

gcloud auth list

Bước 2: Xác thực bằng GitHub và Fork

Xác thực bằng GitHub:

👉💻

gh auth login

git1.png

sao chép mã vào trang xác minh đăng nhập

git2.png

Phân nhánh và sao chép kho lưu trữ: 👉💻

gh repo fork cuppibla/storygen-learning --clone=true

3. Kiến trúc: Từ ý tưởng đến bản thiết kế với Cloud Assist

Mọi dự án lớn đều bắt đầu bằng một tầm nhìn rõ ràng. Chúng ta sẽ sử dụng trợ lý AI Cloud Assist để thiết kế cấu trúc ứng dụng.

cấu trúc

Thao tác

  • Mở Google Cloud Console: https://console.cloud.google.com
  • Ở góc trên cùng bên phải, hãy nhấp vào "mở Cloud Assist Chat"

cloud_assist_1

Bật Cloud Assist

  • Nhấp vào Get Gemini Assist, rồi nhấp vào Enable Cloud Assist at no cost.
  • Và bắt đầu trò chuyện!

cloud_assist_3 Cung cấp câu lệnh chi tiết sau cho Cloud Assist:

Nhập ý tưởng của bạn

Generate a Python web application that uses AI to generate children's stories and illustrations. It has Python backend and React frontend host separately on Cloudrun. They communicate through Websocket. It needs to use a generative model for text and another for images. The generated images must be used by Imagen from Vertex AI and stored in a Google Cloud Storage bucket so that frontend can fetch from the bucket to render images. I do not want any load balancer or a database for the story text. We need a solution to store the API key.

Lập bản kế hoạch cho ứng dụng

  • Nhấp vào "Chỉnh sửa thiết kế ứng dụng", bạn sẽ thấy sơ đồ. Nhấp vào bảng điều khiển trên cùng bên phải "<> Get Code" (Lấy mã) để tải mã Terraform xuống.
  • Cloud Assist sẽ tạo một sơ đồ kiến trúc. Đây là bản kế hoạch trực quan của chúng tôi. cloud_assist_4

Khoảnh khắc học tập quan trọng: AI vượt trội trong việc thiết kế hệ thống cấp cao. Công cụ này có thể dịch ngay các yêu cầu bằng ngôn ngữ tự nhiên thành một cấu trúc trực quan, chuyên nghiệp.

4. Phát triển: Xây dựng ADK bằng Gemini CLI

SDLC

Thiết lập ban đầu

Đảm bảo chúng ta sử dụng Gemini CLI để phân nhánh kho lưu trữ và chuẩn bị không gian làm việc:

Cấu hình môi trường

Chuyển đến Cloud Shell, nhấp vào nút "Mở thiết bị đầu cuối".

  1. Sao chép mẫu môi trường:
    cd ~/storygen-learning
    cp ~/storygen-learning/env.template ~/storygen-learning/.env
    

Xem tệp ẩn trong trình chỉnh sửa nếu bạn không tìm thấy .env

  • Nhấp vào Xem trong thanh trình đơn trên cùng.
  • Chọn Toggle Hidden Files (Hiện/ẩn tệp).

Chỉnh sửa tệp .env 2. Thay thế các giá trị sau trong .env:

GOOGLE_API_KEY=[REPLACE YOUR API KEY HERE]
GOOGLE_CLOUD_PROJECT_ID=[REPLACE YOUR PROJECT ID]
GITHUB_USERNAME=[REPLACE YOUR USERNAME]
GENMEDIA_BUCKET=[REPLACE YOUR PROJECT ID]-bucket

ví dụ: Nếu mã dự án của bạn là: testproject, bạn nên đặt GOOGLE_CLOUD_PROJECT_ID=testprojectGENMEDIA_BUCKET=testproject-bucket

Tập lệnh thiết lập

Chuyển đến 00_Starting_Here Mở một cửa sổ dòng lệnh mới (không phải trong Gemini CLI)

cd ~/storygen-learning/00_Starting_Here

Chạy quy trình thiết lập hoàn chỉnh:

./setup-complete.sh

Bạn sẽ thấy kết quả thiết lập trong thiết bị đầu cuối

Tạo tác nhân đầu tiên

Chuyển đến 01a_First_Agent_Ready Hãy dùng Gemini CLI để tạo tác nhân ADK:**

cd ~/storygen-learning/01a_First_Agent_Ready

Mở Gemini CLI

gemini

Trong cửa sổ Gamini CLI, hãy thử câu lệnh:

I need you to help me create a Google ADK (Agent Development Kit) agent for story generation. I'm working on a children's storybook app that generates creative stories with visual scenes.

Please create a complete `agent.py` file that implements an LlmAgent using Google's ADK framework. The agent should:

**Requirements:**
1. Use the `google.adk.agents.LlmAgent` class
2. Use the "gemini-2.5-flash" model (supports streaming)
3. Be named "story_agent"
4. Generate structured stories with exactly 4 scenes each
5. Output valid JSON with story text, main characters, and scene data
6. No tools needed (images are handled separately)

**Agent Specifications:**
- **Model:** gemini-2.5-flash
- **Name:** story_agent  
- **Description:** "Generates creative short stories and accompanying visual keyframes based on user-provided keywords and themes."
**Story Structure Required:**
- Exactly 4 scenes: Setup  Inciting Incident  Climax  Resolution
- 100-200 words total
- Simple, charming language for all audiences
- Natural keyword integration
**JSON Output Format:**

{
  "story": "Complete story text...",
  "main_characters": [
    {
      "name": "Character Name",
      "description": "VERY detailed visual description with specific colors, features, size, etc."
    }
  ],
  "scenes": [
    {
      "index": 1,
      "title": "The Setup",
      "description": "Scene action and setting WITHOUT character descriptions",
      "text": "Story text for this scene"
    }
    // ... 3 more scenes
  ]
}


**Key Instructions for the Agent:**
- Extract 1-2 main characters maximum
- Character descriptions should be extremely detailed and visual
- Scene descriptions focus on ACTION and SETTING only
- Do NOT repeat character appearance in scene descriptions
- Always respond with valid JSON

Please include a complete example in the instructions showing the exact format using keywords like "tiny robot", "lost kitten", "rainy city".

The file should start with necessary imports, define an empty tools list, include a print statement for initialization, and then create the LlmAgent with all the detailed instructions.

Can you create this agent in backend/story_agent/agent.py

Sau khi hoàn tất, hãy tắt thiết bị đầu cuối Gemini CLI bằng cách nhấn Control+C

—————————————— Không bắt buộc, bạn có thể chuyển đến phần Giải pháp——————————————–

Xác minh thay đổi của bạn trong ADK Web ngay

cd ~/storygen-learning/01a_First_Agent_Ready/backend

source ../../.venv/bin/activate

adk web --port 8080

Spin Up The Website

cd ~/storygen-learning/01a_First_Agent_Ready

./start.sh

Nếu thay đổi của bạn không có tác dụng, bạn sẽ thấy lỗi trong giao diện người dùng web và trang web ADK.

——————————————– Giải pháp bắt đầu từ đây ——————————————–

Giải pháp

Kết thúc quy trình trước đó bằng Control+C hoặc bạn có thể mở một thiết bị đầu cuối khác:

cd ~/storygen-learning/01b_First_Agent_Done

Tạo trang web:

./start.sh

Bạn sẽ thấy trang web:

trang web

Thử giao diện người dùng ADK: Mở một cửa sổ dòng lệnh khác:

cd ~/storygen-learning/01b_First_Agent_Done/backend
source ../../.venv/bin/activate

adk web --port 8080

Bạn sẽ thấy giao diện người dùng ADK, nơi bạn có thể đặt câu hỏi cho trợ lý ảo

adkweb

Trước khi chuyển sang phần tiếp theo, hãy nhấn tổ hợp phím Ctrl+C để kết thúc quy trình.

5. Phát triển: Tạo tác nhân tuỳ chỉnh bằng Imagen

2adk

Tạo Công cụ Imagen (Nhân viên hỗ trợ thứ hai)

cd ~/storygen-learning/02a_Image_Agent_Ready

Sử dụng Gemini CLI để tạo tác nhân tạo hình ảnh:

gemini generate "I need you to help me create a custom Google ADK (Agent Development Kit) agent for image generation. This is different from the story agent - this one handles image generation directly using the BaseAgent pattern for full control over tool execution.

Please create a complete `agent.py` file that implements a custom image generation agent. The agent should:

**Requirements:**
1. Use the `google.adk.agents.BaseAgent` class (NOT LlmAgent)
2. Be named "custom_image_agent" 
3. Directly execute the ImagenTool without LLM intermediation
4. Handle JSON input with scene descriptions and character descriptions
5. Store results in session state for retrieval by main.py
6. Use async generators and yield Events

**Key Specifications:**
- **Class Name:** CustomImageAgent (inherits from BaseAgent)
- **Agent Name:** "custom_image_agent"
- **Tool:** Uses ImagenTool for direct image generation
- **Purpose:** Bypass LLM agent limitations and directly call ImagenTool

**Input Format:**
The agent should handle JSON input like:
{
  "scene_description": "Scene action and setting",
  "character_descriptions": {
    "CharacterName": "detailed visual description"
  }
}


**Core Method:** `async def _run_async_impl(self, ctx: InvocationContext) -> AsyncGenerator[Event, None]:`
   - Extract user message from `ctx.user_content.parts`
   - Parse JSON input or fallback to plain text
   - Extract scene_description and character_descriptions
   - Build image prompt with style prefix: "Children's book cartoon illustration with bright vibrant colors, simple shapes, friendly characters."
   - Include character descriptions for consistency
   - Call `await self.imagen_tool.run()` directly
   - Store results in `ctx.session.state["image_result"]`
   - Yield Event with results


 **Session State:**
   - Store JSON results in `ctx.session.state["image_result"]`
   - Include success/error status
   - Store actual image URLs or error messages

Expected Output Structure:
- Successful results stored as JSON with image URLs
- Error results stored as JSON with error messages
- Results accessible via session state in main.py

Can you create this agent in backend/story_image_agent/agent.py

"

—————————————— Không bắt buộc, bạn có thể chuyển đến phần Giải pháp——————————————–

Xác minh thay đổi của bạn trong ADK Web ngay

cd ~/storygen-learning/02a_Image_Agent_Ready/backend

source ../../.venv/bin/activate

adk web --port 8080

Spin Up The Website

cd ~/storygen-learning/02a_Second_Agent_Ready

./start.sh

Nếu thay đổi của bạn không có tác dụng, bạn sẽ thấy lỗi trong giao diện người dùng web và trang web ADK.

—————————————— Giải pháp bắt đầu từ đây ——————————————–

Giải pháp

Kết thúc quy trình trước đó bằng Control+C hoặc bạn có thể mở một thiết bị đầu cuối khác:

# Open new terminal
cd ~/storygen-learning/02b_Image_Agent_Done

Tạo trang web:

./start.sh

Bạn sẽ thấy trang web:

trang web

Thử giao diện người dùng ADK: Mở một cửa sổ dòng lệnh khác:

# Open new terminal
cd ~/storygen-learning/02b_Image_Agent_Done/backend

source ../../.venv/bin/activate

adk web --port 8080

Bạn sẽ thấy giao diện người dùng ADK, nơi bạn có thể đặt câu hỏi cho trợ lý ảo:

adkweb

Trước khi chuyển sang phần tiếp theo, hãy nhấn tổ hợp phím Ctrl+C để kết thúc quy trình.

6. Thử nghiệm: Đánh giá nhân viên hỗ trợ

Ứng dụng của chúng ta hoạt động, nhưng chúng ta cần một mạng lưới kiểm thử tự động để đảm bảo an toàn. Đây là một nhiệm vụ hoàn hảo để uỷ quyền cho AI đồng hành.

Thao tác

cd ~/storygen-learning/03a_Agent_Evaluation_Ready/backend

Dùng Gemini CLI để viết các bài kiểm thử toàn diện:

Mở Gemini CLI

gemini

Trong cửa sổ Gamini CLI, hãy thử câu lệnh:

I need you to create comprehensive test files for my backend/story_agent in Google ADK. I need three specific JSON files that match the testing structure used in ADK evaluation.

**Context:** 
- The story agent generates structured JSON stories with exactly 4 scenes
- It uses LlmAgent with no tools, just direct LLM responses
- Input: Keywords
- Output: JSON with story, main_characters, and scenes arrays

**Files to Create:**

### 1. `story_agent_eval.evalset.json` (Comprehensive Integration Tests)
Create a comprehensive evaluation set with:
- **eval_set_id**: "story_agent_comprehensive_evalset"
- **name**: "Story Agent Comprehensive Evaluation Set" 
- **description**: "Comprehensive evaluation scenarios for story_agent covering various keyword combinations, edge cases, and story quality metrics"


Each eval_case should include:
- Full conversation arrays with invocation_id, user_content, final_response
- Complete expected JSON responses with detailed stories, characters, and 4 scenes
- session_input with app_name "story_agent"
- All fields: story (narrative text), main_characters (with detailed visual descriptions), scenes (with index, title, description, text)

### 2. `story_generation.test.json` (Unit Tests)
Create basic generation tests with:
- **eval_set_id**: "story_agent_basic_generation_tests"
- **name**: "Story Agent Basic Generation Tests"
- **description**: "Unit tests for story_agent focusing on JSON structure compliance, scene generation, and keyword integration"

### 3. `test_config.json` (Evaluation Configuration)
Create test configuration with:
- **criteria**: response_match_score: 0.7, tool_trajectory_avg_score: 1.0
- **custom_evaluators**: 
  - json_structure_validator (validates required fields, scene count, character fields)
  - story_quality_metrics (word count 80-250, keyword integration threshold 0.8)
- **evaluation_notes**: Story agent specifics and trajectory expectations

**Important Requirements:**
1. All responses must be valid, parseable JSON
2. Stories must have exactly 4 scenes with indices 1-4
3. Each scene must have: index, title, description, text
4. Main characters must have detailed visual descriptions
5. No tool_uses expected (empty arrays) since story agent uses direct LLM
6. Word count should be 100-200 words total
7. Keywords must be naturally integrated into the narrative

Please generate all three files with realistic example stories and comprehensive test coverage matching the ADK evaluation format.

—————————————— Không bắt buộc, bạn có thể chuyển đến phần Giải pháp——————————————–

Cách xem kết quả đánh giá:

./run_adk_web_persistent.sh

Chuyển đến thẻ eval trên giao diện người dùng ADK.

Bạn sẽ thấy giao diện người dùng web ADK có các chức năng kiểm thử liên tục

Khoảnh khắc học tập quan trọng: AI là một đối tác mạnh mẽ trong việc tự động hoá quy trình đảm bảo chất lượng. Công cụ này có thể xử lý mã nguyên mẫu của việc viết kiểm thử, giúp bạn tập trung vào việc xây dựng các tính năng.

——————————————– Giải pháp bắt đầu từ đây ——————————————–

Giải pháp

  • Chuyển đến thư mục giải pháp:
cd ~/storygen-learning/03b_Agent_Evaluation_Done/backend
  • Mở giao diện người dùng web ADK
./run_adk_web_persistent.sh

Bạn có thể xem các trường hợp kiểm thử trong thẻ Eval:

eval1

Điều chỉnh các chỉ số tại đây:

eval2

Xem kết quả chạy quy trình đánh giá tại đây:

eval3

7. Cơ sở hạ tầng dưới dạng mã (IaC): Xây dựng một ngôi nhà trên đám mây

Mã của chúng tôi đã được kiểm thử, nhưng cần có một vị trí sẵn sàng cho việc phát hành công khai. Chúng ta sẽ sử dụng "Cơ sở hạ tầng dưới dạng mã" để xác định môi trường.

deployprocess

Thao tác

cd ~/storygen-learning/04a_Manual_Deployment_Ready

Dùng Gemini CLI để tạo Dockerfile cho phần phụ trợ: Mở Gemini CLI

Gemini

Trong Gemini CLI, hãy thử câu lệnh:

Create a manual deployment plan for my StoryGen app with Google Cloud Platform. I have a Next.js frontend, Python backend, and Terraform infrastructure.

Generate these deployment files:
1. **01-setup.sh** - Environment setup and authentication
2. **02-build-images.sh** - Build and push Docker images to Google Container Registry
3. **03-deploy-infrastructure.sh** - Deploy with Terraform and configure services
4. **load-env.sh** - Load environment variables for deployment

**Requirements:**
- Use Google Cloud Run for both frontend and backend
- Configure Imagen API and storage buckets
- Set up proper IAM permissions
- Use environment variables from .env file
- Include error handling and status checks

Keep scripts simple, well-commented, and production-ready for manual execution.

Giải pháp:

cd ~/storygen-learning/04b_Manual_Deployment_Done

Chạy:

source ../.venv/bin/activate
./01-setup.sh
./02-build-images.sh
./03-deploy-infrastructure.sh

Bạn sẽ thấy kết quả triển khai và quá trình tạo cơ sở hạ tầng

8. Tự động hoá (CI/CD): Dây chuyền lắp ráp kỹ thuật số

Việc triển khai ứng dụng theo cách thủ công diễn ra chậm và có nhiều rủi ro. Hãy yêu cầu AI viết một quy trình CI/CD hoàn chỉnh bằng GitHub Actions.

Thao tác

cd ~/storygen-learning/05a_CICD_Pipeline_Ready

Sử dụng Gemini CLI để tạo quy trình CI/CD bằng GitHub:

Mở Gemini CLI

Gemini

Trong Gemini CLI, hãy thử câu lệnh:

Create a CI/CD pipeline for my StoryGen app using Google Cloud Build and GitHub integration.

Generate these automation files:
1. **cloudbuild.yaml** (for backend) - Automated build, test, and deploy pipeline
2. **GitHub Actions workflow** - Trigger builds on push/PR
3. **Deployment automation scripts** - Streamlined deployment process

**Requirements:**
- Auto-trigger on GitHub push to main branch
- Build and push Docker images
- Run automated tests if available
- Deploy to Google Cloud Run
- Environment-specific deployments (staging/prod)
- Notification on success/failure

Focus on fully automated deployment with minimal manual intervention. Include proper secret management and rollback capabilities.

——————————————– Giải pháp bắt đầu từ đây ——————————————–

Giải pháp:

cd ~/storygen-learning/06_Final_Solution/
# Copy the GitHub workflow to parent folder
cp -r 06_Final_Solution/.github ../../../.github

Quay lại thư mục 06_Final_Solution rồi chạy tập lệnh:

cd ~/storygen-learning/06_Final_Solution/

./setup-cicd-complete.sh

Bạn sẽ thấy quá trình thiết lập quy trình CI/CD đã hoàn tất

Kích hoạt quy trình: Xác nhận và đẩy mã của bạn lên nhánh chính. Xin lưu ý rằng bạn cần thiết lập email và tên trên GitHub để cho phép quyền này.

git add .
git commit -m "feat: Add backend, IaC, and CI/CD workflow"
git push origin main

Chuyển đến thẻ "Actions" (Hành động) trong kho lưu trữ GitHub để xem quá trình triển khai tự động.

Khoảnh khắc học tập quan trọng: Toàn bộ quy trình CI/CD (một phần phức tạp và quan trọng của DevOps) có thể được tạo bằng AI.

9. Hoạt động: Trung tâm kiểm soát AI

Chúng tôi đang phát trực tiếp! Nhưng hành trình này chưa kết thúc. Đây là "Ngày 2" – hoạt động. Hãy quay lại Cloud Assist để quản lý ứng dụng đang chạy.

Thao tác

  1. Chuyển đến dịch vụ Cloud Run trong bảng điều khiển Google Cloud. Tương tác với ứng dụng đang hoạt động để tạo ra một số lưu lượng truy cập và nhật ký.
  2. Mở ngăn Cloud Assist và sử dụng ngăn này làm trợ lý vận hành với các câu lệnh như sau:

Phân tích nhật ký:

Summarize the errors in my Cloud Run logs for the service 'genai-backend' from the last 15 minutes.

Điều chỉnh hiệu suất:

My Cloud Run service 'genai-backend' has high startup latency. What are common causes for a Python app and how can I investigate with Cloud Trace?

Tối ưu hoá chi phí:

Analyze the costs for my 'genai-backend' service and its GCS bucket. Are there any opportunities to save money?

Thời điểm học tập quan trọng: SDLC AI là một vòng lặp liên tục. Cùng với AI, ứng dụng này là một đối tác không thể thiếu để giám sát, khắc phục sự cố và tối ưu hoá ứng dụng trong quá trình sản xuất.