AI 에이전트는 고급 AI 모델의 인텔리전스와 도구 액세스를 결합하여 사용자를 대신해 사용자의 제어 하에 작업을 수행합니다.
비동기 작업 집합을 조정하고 여러 요청-응답 상호작용을 통해 사용자에게 정보를 제공하기 위해 AI 에이전트를 Cloud Run 서비스로 구현할 수 있습니다.
Cloud Run 기반 AI 에이전트 아키텍처
Cloud Run에 배포된 일반적인 AI 에이전트 아키텍처에는 Google Cloud 및 Google Cloud외부의 여러 구성요소가 포함될 수 있습니다.
서빙 및 조정: Cloud Run 서비스는 확장 가능한 API 엔드포인트 역할을 하며 인스턴스의 자동, 주문형, 신속한 확장을 통해 여러 동시 사용자를 처리할 수 있습니다. 이 서비스는 LangGraph 또는 에이전트 개발 키트(ADK)와 같은 AI 조정 프레임워크를 사용하여 핵심 에이전트 로직을 실행합니다. 이 레이어는 다른 구성요소에 대한 호출을 조정합니다. Cloud Run은 WebSockets를 사용하여 사용자에게 다시 HTTP 응답 스트리밍을 지원합니다. Cloud Run의 기본 제공 서비스 ID는 API 키를 관리하지 않고도 Google Cloud API를 호출할 수 있는 안전한 자동 사용자 인증 정보를 제공합니다.
AI 모델: 조정 레이어는 추론 기능을 위해 모델을 호출합니다. 여기에는 다음이 포함됩니다.
도구: 조정자는 모델에 적합하지 않은 특정 작업을 수행하거나 외부 서비스, API 또는 웹사이트와 상호작용하기 위해 도구를 사용합니다. 여기에는 다음이 포함될 수 있습니다.
기본 유틸리티: 정확한 수학 계산, 시간 변환 또는 기타 유사한 유틸리티는 조정 Cloud Run 서비스에서 실행할 수 있습니다.
API 호출: 다른 내부 또는 서드 파티 API를 호출합니다(읽기 또는 쓰기 액세스).
이미지 또는 차트 생성: 이미지 생성 모델을 사용하거나 차트 라이브러리를 실행하여 시각적 콘텐츠를 빠르고 효과적으로 만듭니다.
브라우저 및 OS 자동화: 컨테이너 인스턴스 내에서 헤드리스 또는 전체 그래픽 운영체제를 실행하여 에이전트가 웹을 탐색하고, 웹사이트에서 정보를 추출하거나, 클릭 및 키보드 입력을 사용하여 작업을 실행할 수 있습니다. Cloud Run 서비스는 화면의 픽셀을 반환합니다. Puppeteer와 같은 라이브러리를 사용하여 브라우저를 제어합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-07-10(UTC)"],[],[],null,["# Host AI apps and agents on Cloud Run\n\nThis page highlights some use cases for using Cloud Run as a\nhosting platform for the following AI use cases:\n\n- [AI applications](#ai-apps)\n- [AI agents](#ai-agents)\n\nHost AI applications on Cloud Run\n---------------------------------\n\nAI applications use AI models to operate or perform a specific task.\nFor example, an AI application can use an AI model to summarize documents, or be a chat interface that uses a vector database to retrieve more context.\n\nCloud Run is one of the [application hosting infrastructures](/docs/generative-ai/choose-models-infra-for-ai) that provides a fully managed environment for your AI application workloads.\nCloud Run integrates with AI models such as [Gemini API](/vertex-ai/generative-ai/docs/model-reference/inference), [Vertex AI endpoints](/vertex-ai/docs/general/deployment), or models hosted on [a GPU-enabled Cloud Run service](/run/docs/configuring/services/gpu).\nCloud Run also integrates with [Cloud SQL for PostgreSQL](/sql/docs/postgres/connect-run) and [AlloyDB for PostgreSQL](/alloydb/docs/quickstart/integrate-cloud-run), which are two databases offering the `pgvector` extension for Retrieval-Augmented Generation (RAG).\n\nHost AI Agents on Cloud Run\n---------------------------\n\nAI agents combine the intelligence of advanced AI models, with access to tools,\nto take actions on behalf of the user and under the user's control.\n\nYou can implement AI agents as Cloud Run services to orchestrate a set\nof asynchronous tasks and provide information to users, through involving multiple\nrequest-response interactions.\n\n### AI agent on Cloud Run architecture\n\nA typical AI agent architecture deployed on Cloud Run can involve\nseveral components from Google Cloud and outside of Google Cloud:\n\n1. **Serving and Orchestration:** A Cloud Run service acts as a scalable API endpoint, and can handle multiple concurrent users through automatic, on-demand, rapid scaling of instances. This service runs the core agent logic, often using an AI orchestration framework like [LangGraph](https://www.langchain.com/langgraph) or [Agent Development Kit (ADK)](https://google.github.io/adk-docs/). This layer coordinates calls to other components. Cloud Run supports [streaming HTTP responses](/run/docs/triggering/https-request#streaming) back to the user using [WebSockets](/run/docs/triggering/websockets). Cloud Run's built-in [service identity](/run/docs/securing/service-identity) provides secure and automatic credentials for calling Google Cloud APIs without managing API keys.\n\n2. **AI Models:** The orchestration layer calls models for reasoning capabilities. These can be:\n\n - The [Gemini API](/vertex-ai/generative-ai/docs/model-reference/inference)\n - Custom models or other foundation models deployed on [Vertex AI endpoints](/vertex-ai/docs/general/deployment)\n - Your own fine-tuned models served from a separate [GPU-enabled-Cloud Run service](/run/docs/configuring/services/gpu)\n3. **Memory:** Agents often need memory to retain context and learn from past interactions.\n\n - **Short-term memory** can be implemented by [connecting Cloud Run to Memorystore for Redis](/memorystore/docs/redis/connect-redis-instance-cloud-run).\n - **Long-term memory** for storing the conversational history or remembering the user's preferences can be implemented by connecting Cloud Run to [Firestore](/firestore/docs), a scalable, serverless NoSQL database.\n4. **Databases and Retrieval:** For Retrieval-Augmented Generation (RAG) or fetching structured data:\n\n - Query specific entity information or perform similarity searches over embeddings by connecting Cloud Run to vector databases like [Cloud SQL for PostgreSQL](/sql/docs/postgres/connect-run) or [AlloyDB for PostgreSQL](/alloydb/docs/quickstart/integrate-cloud-run) with the `pgvector` extension.\n5. **Tools:** The orchestrator uses tools to perform specific tasks that models are not suited for or to interact with external services, APIs, or websites. This can include:\n\n - Basic utilities: Precise math calculations, time conversions, or other similar utilities can run in the orchestrating Cloud Run service.\n - API calling: Make calls to other internal or third-party APIs (read or write access).\n - Image or chart generation: Use image generation models or run chart libraries to quickly and effectively create visual content.\n - Browser and OS automation: Run a headless or a full graphical Operating System within container instances to allow the agent to browse the web, extract information from websites, or perform actions using clicks and keyboard input. The Cloud Run service returns pixels of screens. Use libraries like [Puppeteer](https://pptr.dev/) to control the browser.\n - Code execution: Cloud Run provides a [secure environment with multi-layered sandboxing](/run/docs/securing/security#compute-security) and can be configured to the code execution service with minimal or no [IAM permissions](/run/docs/securing/service-identity). A [Cloud Run job](/run/docs/create-jobs) can be used to execute code asynchronously and a [Cloud Run service](/run/docs/deploying) with a [concurrency of 1](/run/docs/configuring/concurrency) can be used for synchronous execution.\n\nWhat's next\n-----------\n\n- Watch [Build AI agents on Cloud Run](https://www.youtube.com/watch?v=GwL8e5Z1tl4).\n- Try the [codelab](https://codelabs.developers.google.com/codelabs/build-and-deploy-a-langchain-app-on-cloud-run) for learning how to build and deploy a LangChain app to Cloud Run.\n- Learn how to [deploy Agent Development Kit (ADK) to Cloud Run](https://google.github.io/adk-docs/deploy/cloud-run/).\n- Find ready-to-use agent samples in [Agent Development Kit (ADK) samples](https://github.com/google/adk-samples).\n- [Host Model Context Protocol (MCP) servers on Cloud Run](/run/docs/host-mcp-servers)."]]