Vertex AI Agent Engine์ผ๋ก ์์ ํ๊ธฐ ์ ์ ํ๊ฒฝ์ด ์ค์ ๋์ด ์๋์ง ํ์ธํด์ผ ํฉ๋๋ค. ๊ฒฐ์ ๊ฐ ์ฌ์ฉ ์ค์ ๋ Google Cloud ํ๋ก์ ํธ๊ฐ ์๊ณ ํ์ํ ๊ถํ์ด ์์ด์ผ ํ๋ฉฐ Cloud Storage ๋ฒํท์ ์ค์ ํ๊ณ Vertex AI SDK for Python์ ์ค์นํด์ผ ํฉ๋๋ค. ๋ค์ ์ฃผ์ ๋ฅผ ์ฌ์ฉํ์ฌ Vertex AI Agent Engine์ผ๋ก ์์ ํ ์ค๋น๋ฅผ ํ์ธ์.
Vertex AI Agent Engine ํ๊ฒฝ ์ค์ ๋ฐ ๋ฐฐํฌ๋ฅผ ๊ฐ์ํํ๋ ์ฐธ์กฐ Terraform ์์๋ agent-starter-pack์ ์ดํด๋ณด์ธ์.
Google Cloud ํ๋ก์ ํธ ์ค์
๋ชจ๋ ํ๋ก์ ํธ๋ ํ๋ก์ ํธ ๋ฒํธ ๋๋ ํ๋ก์ ํธ ID์ ๋ ๊ฐ์ง ๋ฐฉ๋ฒ์ผ๋ก ์๋ณ๋ ์ ์์ต๋๋ค. PROJECT_NUMBER
๋ ์ฌ์ฉ์๊ฐ ํ๋ก์ ํธ๋ฅผ ๋ง๋ค ๋ ์๋์ผ๋ก ์์ฑ๋๊ณ , PROJECT_ID
๋ ์ฌ์ฉ์ ๋๋ ํ๋ก์ ํธ๋ฅผ ๋ง๋ ์ฌ๋์ด ์ง์ ํฉ๋๋ค. ํ๋ก์ ํธ๋ฅผ ์ค์ ํ๋ ค๋ฉด ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ฅด์ธ์.
- Sign in to your Google Cloud account. If you're new to Google Cloud, create an account to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI, Cloud Storage, Cloud Logging, Cloud Monitoring, and Cloud Trace APIs.
-
In the Google Cloud console, on the project selector page, select or create a Google Cloud project.
-
Make sure that billing is enabled for your Google Cloud project.
-
Enable the Vertex AI, Cloud Storage, Cloud Logging, Cloud Monitoring, and Cloud Trace APIs.
-
Vertex AI ์ฌ์ฉ์(
roles/aiplatform.user
) -
์คํ ๋ฆฌ์ง ๊ด๋ฆฌ์(
roles/storage.admin
) IAM ํ์ด์ง๋ก ์ด๋ํ์ฌ 'Google ์ ๊ณต ์ญํ ๋ถ์ฌ ํฌํจ' ์ฒดํฌ๋ฐ์ค๋ฅผ ์ ํํฉ๋๋ค.
service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com
์ ์ผ์นํ๋ ์ฃผ ๊ตฌ์ฑ์์ ์ฐพ์ต๋๋ค.์์ ๋ฒํผ์ ํด๋ฆญํ ๋ค์ ์ ์ฅ ๋ฒํผ์ ํด๋ฆญํ์ฌ ์ฃผ ๊ตฌ์ฑ์์ ํ์ํ ์ญํ ์ ์ถ๊ฐํฉ๋๋ค.
Google Cloud CLI๋ฅผ ์ฌ์ฉํ์ฌ Reasoning Engine ์๋น์ค ์์ด์ ํธ๋ฅผ ์์ฑํฉ๋๋ค.
gcloud beta services identity create --service=aiplatform.googleapis.com --project=PROJECT-ID-OR-PROJECT-NUMBER
IAM ํ์ด์ง๋ก ์ด๋ํ์ฌ ์ก์ธ์ค ๊ถํ ๋ถ์ฌ๋ฅผ ํด๋ฆญํฉ๋๋ค.
์ฃผ ๊ตฌ์ฑ์ ์ถ๊ฐ ์น์ ์ ์ ์ฃผ ๊ตฌ์ฑ์ ํ๋์
service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com
๋ฅผ ์ ๋ ฅํฉ๋๋ค.์ญํ ํ ๋น ์น์ ์์ ํ์ํ ์ญํ ์ ์ฐพ์ ์ ํํฉ๋๋ค.
์ ์ฅ ๋ฒํผ์ ํด๋ฆญํฉ๋๋ค.
- In the Google Cloud console, go to the Cloud Storage Buckets page.
- Click Create.
- On the Create a bucket page, enter your bucket information. To go to the next
step, click Continue.
-
In the Get started section, do the following:
- Enter a globally unique name that meets the bucket naming requirements.
- To add a
bucket label,
expand the Labels section ( ),
click add_box
Add label, and specify a
key
and avalue
for your label.
-
In the Choose where to store your data section, do the following:
- Select a Location type.
- Choose a location where your bucket's data is permanently stored from the Location type drop-down menu.
- If you select the dual-region location type, you can also choose to enable turbo replication by using the relevant checkbox.
- To set up cross-bucket replication, select
Add cross-bucket replication via Storage Transfer Service and
follow these steps:
Set up cross-bucket replication
- In the Bucket menu, select a bucket.
In the Replication settings section, click Configure to configure settings for the replication job.
The Configure cross-bucket replication pane appears.
- To filter objects to replicate by object name prefix, enter a prefix that you want to include or exclude objects from, then click Add a prefix.
- To set a storage class for the replicated objects, select a storage class from the Storage class menu. If you skip this step, the replicated objects will use the destination bucket's storage class by default.
- Click Done.
-
In the Choose how to store your data section, do the following:
- Select a default storage class for the bucket or Autoclass for automatic storage class management of your bucket's data.
- To enable hierarchical namespace, in the Optimize storage for data-intensive workloads section, select Enable hierarchical namespace on this bucket.
- In the Choose how to control access to objects section, select whether or not your bucket enforces public access prevention, and select an access control method for your bucket's objects.
-
In the Choose how to protect object data section, do the
following:
- Select any of the options under Data protection that you
want to set for your bucket.
- To enable soft delete, click the Soft delete policy (For data recovery) checkbox, and specify the number of days you want to retain objects after deletion.
- To set Object Versioning, click the Object versioning (For version control) checkbox, and specify the maximum number of versions per object and the number of days after which the noncurrent versions expire.
- To enable the retention policy on objects and buckets, click the Retention (For compliance) checkbox, and then do the following:
- To enable Object Retention Lock, click the Enable object retention checkbox.
- To enable Bucket Lock, click the Set bucket retention policy checkbox, and choose a unit of time and a length of time for your retention period.
- To choose how your object data will be encrypted, expand the Data encryption section (Data encryption method. ), and select a
- Select any of the options under Data protection that you
want to set for your bucket.
-
In the Get started section, do the following:
- Click Create.
-
STORAGE_CLASS
๋ฅผ ์ํ๋ ์คํ ๋ฆฌ์ง ํด๋์ค๋ก ๋ฐ๊ฟ๋๋ค. -
LOCATION
์ ์ํ๋ ์์น(ASIA
,EU
,US
)๋ก ๋ฐ๊ฟ๋๋ค. -
BUCKET_NAME
์ ๋ฒํท ์ด๋ฆ ์๊ตฌ์ฌํญ์ ์ถฉ์กฑํ๋ ๋ฒํท ์ด๋ฆ์ผ๋ก ๋ฐ๊ฟ๋๋ค. agent_engines
: Vertex AI Agent Engine์ ๋ฐฐํฌํ๋ ๋ฐ ํ์ํ ํจํค์ง ์งํฉ์ ๋๋ค.adk
: ํธํ๋๋ ์์ด์ ํธ ๊ฐ๋ฐ ํคํธ ํจํค์ง ์งํฉ์ ๋๋ค.langchain
: ํธํ๋๋ LangChain ๋ฐ LangGraph ํจํค์ง ์งํฉ์ ๋๋ค.ag2
: ํธํ๋๋ AG2 ํจํค์ง ์งํฉ์ ๋๋ค.llama_index
: ํธํ๋๋ LlamaIndex ํจํค์ง ์งํฉ์ ๋๋ค.PROJECT_ID
๋ ๊ฐ๋ฐ ๋ฐ ๋ฐฐํฌํ ์์ด์ ํธ์ Google Cloud ํ๋ก์ ํธ ID์ ๋๋ค.LOCATION
์ ์ง์๋๋ ๋ฆฌ์ ์ค ํ๋์ด๋ฉฐBUCKET_NAME
์ ์์ด์ ํธ ๋ฐฐํฌ ์ ์ํฐํฉํธ๋ฅผ ์คํ ์ด์งํ๊ธฐ ์ํ Cloud Storage ๋ฒํท์ ์ด๋ฆ์ ๋๋ค.
ํ์ํ ์ญํ ๊ฐ์ ธ์ค๊ธฐ
Vertex AI Agent Engine์ ์ฌ์ฉํ๋ ๋ฐ ํ์ํ ๊ถํ์ ์ป์ผ๋ ค๋ฉด ๊ด๋ฆฌ์์๊ฒ ํ๋ก์ ํธ์ ๋ํ ๋ค์ IAM ์ญํ ์ ๋ถ์ฌํด ๋ฌ๋ผ๊ณ ์์ฒญํ์ธ์.
์ญํ ๋ถ์ฌ์ ๋ํ ์์ธํ ๋ด์ฉ์ ํ๋ก์ ํธ, ํด๋, ์กฐ์ง์ ๋ํ ์ก์ธ์ค ๊ด๋ฆฌ๋ฅผ ์ฐธ์กฐํ์ธ์.
์ปค์คํ ์ญํ ์ด๋ ๋ค๋ฅธ ์ฌ์ ์ ์๋ ์ญํ ์ ํตํด ํ์ํ ๊ถํ์ ์ป์ ์๋ ์์ต๋๋ค.
์๋น์ค ์์ด์ ํธ ๊ถํ ์ค์
Vertex AI Agent Engine์ ๋ฐฐํฌํ๋ ์์ด์ ํธ๋ AI Platform Reasoning Engine ์๋น์ค ์์ด์ ํธ ์๋น์ค ๊ณ์ ์ ์ฌ์ฉํ์ฌ ์คํ๋ฉ๋๋ค. ์ด ๊ณ์ ์๋ ๋ฐฐํฌ๋ ์์ด์ ํธ์ ํ์ํ ๊ธฐ๋ณธ ๊ถํ์ ๋ถ์ฌํ๋ Vertex AI Reasoning Engine ์๋น์ค ์์ด์ ํธ ์ญํ ์ด ์์ต๋๋ค. IAM ๋ฌธ์์์ ๊ธฐ๋ณธ ๊ถํ์ ์ ์ฒด ๋ชฉ๋ก์ ํ์ธํ ์ ์์ต๋๋ค.
์ถ๊ฐ ๊ถํ์ด ํ์ํ ๊ฒฝ์ฐ ๋ค์ ๋จ๊ณ์ ๋ฐ๋ผ ์ด ์๋น์ค ์์ด์ ํธ์ ์ถ๊ฐ ์ญํ ์ ๋ถ์ฌํ ์ ์์ต๋๋ค.
์๋น์ค ์์ด์ ํธ ์๋ ์์ฑ
Reasoning Engine ์๋น์ค ์์ด์ ํธ๋ Vertex AI ์์ด์ ํธ ์์ง ๋ฐฐํฌ ์ค์ ์๋์ผ๋ก ํ๋ก๋น์ ๋๋์ง๋ง, ์ฌ์ ์ ์๋์ผ๋ก ์์ฑํด์ผ ํ๋ ์๋๋ฆฌ์ค๊ฐ ์์ ์ ์์ต๋๋ค. ์ด๋ ๋ฐฐํฌ ํ๋ก์ธ์ค์ ํ์ํ ๊ถํ์ด ์๊ณ ์ ์ฌ์ ์ธ ๋ฐฐํฌ ์คํจ๋ฅผ ๋ฐฉ์งํ ์ ์๋๋ก ์๋น์ค ์์ด์ ํธ์ ํน์ ์ญํ ์ ๋ถ์ฌํด์ผ ํ๋ ๊ฒฝ์ฐ์ ํนํ ์ค์ํฉ๋๋ค.
Reasoning Engine ์๋น์ค ์์ด์ ํธ๋ฅผ ์๋์ผ๋ก ์์ฑํ๋ ๋จ๊ณ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
Cloud Storage ๋ฒํท ๋ง๋ค๊ธฐ
Vertex AI Agent Engine์ ๋ฐฐํฌ ํ๋ก์ธ์ค์ ์ผ๋ถ๋ก ๋ฐฐํฌ๋ ์์ด์ ํธ์ ์ํฐํฉํธ๋ฅผ Cloud Storage ๋ฒํท์์ ์คํ
์ด์งํฉ๋๋ค. Vertex AI๋ฅผ ์ฌ์ฉํ๋๋ก ์ธ์ฆ๋ ์ฃผ ๊ตฌ์ฑ์(์ฌ์ฉ์ ๋๋ ์๋น์ค ๊ณ์ )์๊ฒ ์ด ๋ฒํท์ ๋ํ Storage Admin
์ก์ธ์ค ๊ถํ์ด ์๋์ง ํ์ธํฉ๋๋ค. Vertex AI SDK for Python์ด ์ด ๋ฒํท์ ์ฝ๋๋ฅผ ์์ฑํ๊ธฐ ๋๋ฌธ์ ์ด ์์
์ด ํ์ํฉ๋๋ค.
๋ฒํท์ด ์ด๋ฏธ ์ค์ ๋์ด ์์ผ๋ฉด ์ด ๋จ๊ณ๋ฅผ ๊ฑด๋๋ธ ์ ์์ต๋๋ค. ๋๋ ํ์ค ๋ฒํท ๋ง๋ค๊ธฐ ์๋ด๋ฅผ ๋ฐ๋ฅด์ธ์.
Google Cloud ์ฝ์
๋ช ๋ น์ค
-
Create a Cloud Storage bucket and configure it as follows:
gcloud storage buckets create gs://BUCKET_NAME --default-storage-class STORAGE_CLASS --location LOCATION
Python์ฉ Vertex AI SDK ์ค์น ๋ฐ ์ด๊ธฐํ
์ด ์น์ ์์๋ Python ๊ฐ๋ฐ ํ๊ฒฝ์ ์ค์ ํ๊ฑฐ๋ Colab(๋๋ ์ด๋ฅผ ์ค์ ํ ๋ค๋ฅธ ์ ํฉํ ๋ฐํ์)์ ์ฌ์ฉํ๊ณ ์๋ค๊ณ ๊ฐ์ ํฉ๋๋ค.
(์ ํ์ฌํญ) ๊ฐ์ ํ๊ฒฝ์ ์ค์ ํฉ๋๋ค.
๋ํ ์ข ์ ํญ๋ชฉ์ ๊ฒฉ๋ฆฌํ๊ธฐ ์ํด ๊ฐ์ ํ๊ฒฝ์ ์ค์ ํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
์ค์น
์ค์นํด์ผ ํ๋ ์ข ์ ํญ๋ชฉ ์งํฉ์ ์ต์ํํ๊ธฐ ์ํด ์ข ์ ํญ๋ชฉ์ ๋ค์๊ณผ ๊ฐ์ด ๋ถ๋ฆฌํ์ต๋๋ค.
Vertex AI SDK for Python์ ์ค์นํ ๋ ํ์ํ ์ข ์ ํญ๋ชฉ์ ์ง์ ํ ์ ์์ต๋๋ค(์ผํ๋ก ๊ตฌ๋ถ). ๋ชจ๋ ์ค์นํ๋ ค๋ฉด ๋ค์ ๋จ๊ณ๋ฅผ ๋ฐ๋ฅด์ธ์.
pip install google-cloud-aiplatform[agent_engines,adk,langchain,ag2,llama_index]>=1.88.0
์ธ์ฆ
Colab
๋ค์ ์ฝ๋๋ฅผ ์คํํฉ๋๋ค.
from google.colab import auth
auth.authenticate_user(project_id="PROJECT_ID")
Cloud Shell
์ด๋ค ์กฐ์น๋ ํ์ํ์ง ์์ต๋๋ค.
๋ก์ปฌ ์ ธ
๋ค์ ๋ช ๋ น์ด๋ฅผ ์คํํฉ๋๋ค.
gcloud auth application-default login
SDK ๊ฐ์ ธ์ค๊ธฐ ๋ฐ ์ด๊ธฐํ
๋ค์ ์ฝ๋๋ฅผ ์คํํ์ฌ Vertex AI Agent Engine์ฉ SDK๋ฅผ ๊ฐ์ ธ์ค๊ณ ์ด๊ธฐํํฉ๋๋ค.
import vertexai
from vertexai import agent_engines
vertexai.init(
project="PROJECT_ID",
location="LOCATION",
staging_bucket="gs://BUCKET_NAME",
)
๊ฐ ํญ๋ชฉ์ ์๋ฏธ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.