ํ™˜๊ฒฝ ์„ค์ •

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๋Š” ์‚ฌ์šฉ์ž ๋˜๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“  ์‚ฌ๋žŒ์ด ์ง€์ •ํ•ฉ๋‹ˆ๋‹ค. ํ”„๋กœ์ ํŠธ๋ฅผ ์„ค์ •ํ•˜๋ ค๋ฉด ๋‹ค์Œ ๋‹จ๊ณ„๋ฅผ ๋”ฐ๋ฅด์„ธ์š”.

  1. 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.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  3. Make sure that billing is enabled for your Google Cloud project.

  4. Enable the Vertex AI, Cloud Storage, Cloud Logging, Cloud Monitoring, and Cloud Trace APIs.

    Enable the APIs

  5. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Go to project selector

  6. Make sure that billing is enabled for your Google Cloud project.

  7. Enable the Vertex AI, Cloud Storage, Cloud Logging, Cloud Monitoring, and Cloud Trace APIs.

    Enable the APIs

  8. ํ•„์š”ํ•œ ์—ญํ•  ๊ฐ€์ ธ์˜ค๊ธฐ

    Vertex AI Agent Engine์„ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ๊ถŒํ•œ์„ ์–ป์œผ๋ ค๋ฉด ๊ด€๋ฆฌ์ž์—๊ฒŒ ํ”„๋กœ์ ํŠธ์— ๋Œ€ํ•œ ๋‹ค์Œ IAM ์—ญํ• ์„ ๋ถ€์—ฌํ•ด ๋‹ฌ๋ผ๊ณ  ์š”์ฒญํ•˜์„ธ์š”.

    ์—ญํ•  ๋ถ€์—ฌ์— ๋Œ€ํ•œ ์ž์„ธํ•œ ๋‚ด์šฉ์€ ํ”„๋กœ์ ํŠธ, ํด๋”, ์กฐ์ง์— ๋Œ€ํ•œ ์•ก์„ธ์Šค ๊ด€๋ฆฌ๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

    ์ปค์Šคํ…€ ์—ญํ• ์ด๋‚˜ ๋‹ค๋ฅธ ์‚ฌ์ „ ์ •์˜๋œ ์—ญํ• ์„ ํ†ตํ•ด ํ•„์š”ํ•œ ๊ถŒํ•œ์„ ์–ป์„ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.

    ์„œ๋น„์Šค ์—์ด์ „ํŠธ ๊ถŒํ•œ ์„ค์ •

    Vertex AI Agent Engine์— ๋ฐฐํฌํ•˜๋Š” ์—์ด์ „ํŠธ๋Š” AI Platform Reasoning Engine ์„œ๋น„์Šค ์—์ด์ „ํŠธ ์„œ๋น„์Šค ๊ณ„์ •์„ ์‚ฌ์šฉํ•˜์—ฌ ์‹คํ–‰๋ฉ๋‹ˆ๋‹ค. ์ด ๊ณ„์ •์—๋Š” ๋ฐฐํฌ๋œ ์—์ด์ „ํŠธ์— ํ•„์š”ํ•œ ๊ธฐ๋ณธ ๊ถŒํ•œ์„ ๋ถ€์—ฌํ•˜๋Š” Vertex AI Reasoning Engine ์„œ๋น„์Šค ์—์ด์ „ํŠธ ์—ญํ• ์ด ์žˆ์Šต๋‹ˆ๋‹ค. IAM ๋ฌธ์„œ์—์„œ ๊ธฐ๋ณธ ๊ถŒํ•œ์˜ ์ „์ฒด ๋ชฉ๋ก์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    ์ถ”๊ฐ€ ๊ถŒํ•œ์ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ๋‹ค์Œ ๋‹จ๊ณ„์— ๋”ฐ๋ผ ์ด ์„œ๋น„์Šค ์—์ด์ „ํŠธ์— ์ถ”๊ฐ€ ์—ญํ• ์„ ๋ถ€์—ฌํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

    1. IAM ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•˜์—ฌ 'Google ์ œ๊ณต ์—ญํ•  ๋ถ€์—ฌ ํฌํ•จ' ์ฒดํฌ๋ฐ•์Šค๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

      IAM์œผ๋กœ ์ด๋™

    2. service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com์™€ ์ผ์น˜ํ•˜๋Š” ์ฃผ ๊ตฌ์„ฑ์›์„ ์ฐพ์Šต๋‹ˆ๋‹ค.

    3. ์ˆ˜์ • ๋ฒ„ํŠผ์„ ํด๋ฆญํ•œ ๋‹ค์Œ ์ €์žฅ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ์ฃผ ๊ตฌ์„ฑ์›์— ํ•„์š”ํ•œ ์—ญํ• ์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

    ์„œ๋น„์Šค ์—์ด์ „ํŠธ ์ˆ˜๋™ ์ƒ์„ฑ

    Reasoning Engine ์„œ๋น„์Šค ์—์ด์ „ํŠธ๋Š” Vertex AI ์—์ด์ „ํŠธ ์—”์ง„ ๋ฐฐํฌ ์ค‘์— ์ž๋™์œผ๋กœ ํ”„๋กœ๋น„์ €๋‹๋˜์ง€๋งŒ, ์‚ฌ์ „์— ์ˆ˜๋™์œผ๋กœ ์ƒ์„ฑํ•ด์•ผ ํ•˜๋Š” ์‹œ๋‚˜๋ฆฌ์˜ค๊ฐ€ ์žˆ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด๋Š” ๋ฐฐํฌ ํ”„๋กœ์„ธ์Šค์— ํ•„์š”ํ•œ ๊ถŒํ•œ์ด ์žˆ๊ณ  ์ž ์žฌ์ ์ธ ๋ฐฐํฌ ์‹คํŒจ๋ฅผ ๋ฐฉ์ง€ํ•  ์ˆ˜ ์žˆ๋„๋ก ์„œ๋น„์Šค ์—์ด์ „ํŠธ์— ํŠน์ • ์—ญํ• ์„ ๋ถ€์—ฌํ•ด์•ผ ํ•˜๋Š” ๊ฒฝ์šฐ์— ํŠนํžˆ ์ค‘์š”ํ•ฉ๋‹ˆ๋‹ค.

    Reasoning Engine ์„œ๋น„์Šค ์—์ด์ „ํŠธ๋ฅผ ์ˆ˜๋™์œผ๋กœ ์ƒ์„ฑํ•˜๋Š” ๋‹จ๊ณ„๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

    1. Google Cloud CLI๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ Reasoning Engine ์„œ๋น„์Šค ์—์ด์ „ํŠธ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

      gcloud beta services identity create --service=aiplatform.googleapis.com --project=PROJECT-ID-OR-PROJECT-NUMBER
    2. IAM ํŽ˜์ด์ง€๋กœ ์ด๋™ํ•˜์—ฌ ์•ก์„ธ์Šค ๊ถŒํ•œ ๋ถ€์—ฌ๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

      IAM์œผ๋กœ ์ด๋™

    3. ์ฃผ ๊ตฌ์„ฑ์› ์ถ”๊ฐ€ ์„น์…˜์˜ ์ƒˆ ์ฃผ ๊ตฌ์„ฑ์› ํ•„๋“œ์— service-PROJECT_NUMBER@gcp-sa-aiplatform-re.iam.gserviceaccount.com๋ฅผ ์ž…๋ ฅํ•ฉ๋‹ˆ๋‹ค.

    4. ์—ญํ•  ํ• ๋‹น ์„น์…˜์—์„œ ํ•„์š”ํ•œ ์—ญํ• ์„ ์ฐพ์•„ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค.

    5. ์ €์žฅ ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

    Cloud Storage ๋ฒ„ํ‚ท ๋งŒ๋“ค๊ธฐ

    Vertex AI Agent Engine์€ ๋ฐฐํฌ ํ”„๋กœ์„ธ์Šค์˜ ์ผ๋ถ€๋กœ ๋ฐฐํฌ๋œ ์—์ด์ „ํŠธ์˜ ์•„ํ‹ฐํŒฉํŠธ๋ฅผ Cloud Storage ๋ฒ„ํ‚ท์—์„œ ์Šคํ…Œ์ด์ง•ํ•ฉ๋‹ˆ๋‹ค. Vertex AI๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์ธ์ฆ๋œ ์ฃผ ๊ตฌ์„ฑ์›(์‚ฌ์šฉ์ž ๋˜๋Š” ์„œ๋น„์Šค ๊ณ„์ •)์—๊ฒŒ ์ด ๋ฒ„ํ‚ท์— ๋Œ€ํ•œ Storage Admin ์•ก์„ธ์Šค ๊ถŒํ•œ์ด ์žˆ๋Š”์ง€ ํ™•์ธํ•ฉ๋‹ˆ๋‹ค. Vertex AI SDK for Python์ด ์ด ๋ฒ„ํ‚ท์— ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜๊ธฐ ๋•Œ๋ฌธ์— ์ด ์ž‘์—…์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.

    ๋ฒ„ํ‚ท์ด ์ด๋ฏธ ์„ค์ •๋˜์–ด ์žˆ์œผ๋ฉด ์ด ๋‹จ๊ณ„๋ฅผ ๊ฑด๋„ˆ๋›ธ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ๋˜๋Š” ํ‘œ์ค€ ๋ฒ„ํ‚ท ๋งŒ๋“ค๊ธฐ ์•ˆ๋‚ด๋ฅผ ๋”ฐ๋ฅด์„ธ์š”.

    Google Cloud ์ฝ˜์†”

    1. In the Google Cloud console, go to the Cloud Storage Buckets page.

      Go to Buckets

    2. Click Create.
    3. On the Create a bucket page, enter your bucket information. To go to the next step, click Continue.
      1. 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 label, and specify a key and a value for your label.
      2. In the Choose where to store your data section, do the following:
        1. Select a Location type.
        2. Choose a location where your bucket's data is permanently stored from the Location type drop-down menu.
        3. To set up cross-bucket replication, select Add cross-bucket replication via Storage Transfer Service and follow these steps:

          Set up cross-bucket replication

          1. In the Bucket menu, select a bucket.
          2. 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.
      3. In the Choose how to store your data section, do the following:
        1. Select a default storage class for the bucket or Autoclass for automatic storage class management of your bucket's data.
        2. To enable hierarchical namespace, in the Optimize storage for data-intensive workloads section, select Enable hierarchical namespace on this bucket.
      4. 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.
      5. 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 (), and select a Data encryption method.
    4. Click Create.

    ๋ช…๋ น์ค„

      Create a Cloud Storage bucket and configure it as follows:

    Python์šฉ Vertex AI SDK ์„ค์น˜ ๋ฐ ์ดˆ๊ธฐํ™”

    ์ด ์„น์…˜์—์„œ๋Š” Python ๊ฐœ๋ฐœ ํ™˜๊ฒฝ์„ ์„ค์ •ํ–ˆ๊ฑฐ๋‚˜ Colab(๋˜๋Š” ์ด๋ฅผ ์„ค์ •ํ•œ ๋‹ค๋ฅธ ์ ํ•ฉํ•œ ๋Ÿฐํƒ€์ž„)์„ ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋‹ค๊ณ  ๊ฐ€์ •ํ•ฉ๋‹ˆ๋‹ค.

    (์„ ํƒ์‚ฌํ•ญ) ๊ฐ€์ƒ ํ™˜๊ฒฝ์„ ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค.

    ๋˜ํ•œ ์ข…์† ํ•ญ๋ชฉ์„ ๊ฒฉ๋ฆฌํ•˜๊ธฐ ์œ„ํ•ด ๊ฐ€์ƒ ํ™˜๊ฒฝ์„ ์„ค์ •ํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค.

    ์„ค์น˜

    ์„ค์น˜ํ•ด์•ผ ํ•˜๋Š” ์ข…์† ํ•ญ๋ชฉ ์ง‘ํ•ฉ์„ ์ตœ์†Œํ™”ํ•˜๊ธฐ ์œ„ํ•ด ์ข…์† ํ•ญ๋ชฉ์„ ๋‹ค์Œ๊ณผ ๊ฐ™์ด ๋ถ„๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค.

    • agent_engines: Vertex AI Agent Engine์— ๋ฐฐํฌํ•˜๋Š” ๋ฐ ํ•„์š”ํ•œ ํŒจํ‚ค์ง€ ์ง‘ํ•ฉ์ž…๋‹ˆ๋‹ค.
    • adk: ํ˜ธํ™˜๋˜๋Š” ์—์ด์ „ํŠธ ๊ฐœ๋ฐœ ํ‚คํŠธ ํŒจํ‚ค์ง€ ์ง‘ํ•ฉ์ž…๋‹ˆ๋‹ค.
    • langchain: ํ˜ธํ™˜๋˜๋Š” LangChain ๋ฐ LangGraph ํŒจํ‚ค์ง€ ์ง‘ํ•ฉ์ž…๋‹ˆ๋‹ค.
    • ag2: ํ˜ธํ™˜๋˜๋Š” AG2 ํŒจํ‚ค์ง€ ์ง‘ํ•ฉ์ž…๋‹ˆ๋‹ค.
    • llama_index: ํ˜ธํ™˜๋˜๋Š” LlamaIndex ํŒจํ‚ค์ง€ ์ง‘ํ•ฉ์ž…๋‹ˆ๋‹ค.

    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",
    )
    

    ๊ฐ ํ•ญ๋ชฉ์˜ ์˜๋ฏธ๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์Šต๋‹ˆ๋‹ค.

    ๋‹ค์Œ ๋‹จ๊ณ„