एजेंट मोड
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
Android Studio में Gemini का एजेंट मोड, डेवलपमेंट से जुड़े मुश्किल और कई चरणों वाले टास्क को हैंडल करने के लिए डिज़ाइन किया गया है. ये ऐसे टास्क होते हैं जिन्हें सिर्फ़ Gemini से चैट करके पूरा नहीं किया जा सकता. आपको सिर्फ़ एक मुख्य लक्ष्य के बारे में बताना होगा. इसके बाद, एजेंट एक प्लान बनाएगा और उसे लागू करेगा. इसके लिए, वह ज़रूरी टूल का इस्तेमाल करेगा, कई फ़ाइलों में बदलाव करेगा, और बार-बार होने वाली गड़बड़ियों को ठीक करेगा. एजेंट की मदद से काम करने की सुविधा वाले इस वर्कफ़्लो से, आपको मुश्किल चुनौतियों से निपटने में मदद मिलती है. साथ ही, इससे डेवलपमेंट की प्रोसेस को तेज़ किया जा सकता है.
शुरू करें
Android Studio में एजेंट मोड का इस्तेमाल शुरू करने के लिए, यह तरीका अपनाएं:
- साइड बार में, Gemini
पर क्लिक करें. अगर ज़रूरी हो, तो साइन इन करें और ऑनबोर्ड करें.
- एजेंट टैब चुनें.
- उस टास्क के बारे में बताएं जिसे आपको एजेंट से पूरा करवाना है.
एजेंट के टास्क पूरा करने के दौरान, आपके पास किसी भी बदलाव की समीक्षा करने और उसे स्वीकार करने का विकल्प होगा.
ज़रूरी नहीं: बदलावों को अपने-आप मंज़ूरी देने के लिए, एजेंट के विकल्प
> बदलावों को अपने-आप मंज़ूरी दें को चुनें.
इस्तेमाल के उदाहरण
यहाँ कुछ ऐसे उदाहरण दिए गए हैं जिनमें एजेंट आपकी मदद कर सकता है:
बिल्ड से जुड़ी गड़बड़ियां ठीक करें. जब एजेंट से "मेरे प्रोजेक्ट में बिल्ड से जुड़ी गड़बड़ियों को ठीक करो" जैसे प्रॉम्प्ट का इस्तेमाल करके, बिल्ड से जुड़ी गड़बड़ी को ठीक करने के लिए कहा जाता है, तो वह गड़बड़ी को ठीक करने का सुझाव लागू करेगा. इसके बाद, समाधान की पुष्टि करने के लिए प्रोजेक्ट को बिल्ड करेगा और समस्या हल होने तक इस प्रोसेस को दोहराएगा.
एजेंट मोड, यूज़र इंटरफ़ेस (यूआई) के एलिमेंट को अपने-आप जोड़ सकता है या अपडेट कर सकता है. उदाहरण के लिए, एजेंट से "उपयोगकर्ता की प्राथमिकताओं में डार्क मोड को डिफ़ॉल्ट मोड के तौर पर सेट करो" के लिए कहा जा सकता है. इसके बाद, एजेंट काम की फ़ाइलें खोजेगा और टास्क पूरा करने के लिए बदलावों का सुझाव देगा. आपको डिवाइसों पर चल रहा है टूल विंडो में, यूज़र इंटरफ़ेस (यूआई) से जुड़े अपडेट की झलक तुरंत दिख सकती है.
प्रोटोटाइप बनाने और ऐप्लिकेशन की जांच करने के दौरान, मॉक डेटा का इस्तेमाल करना फ़ायदेमंद होता है. खुद से नकली डेटा बनाने के बजाय, इस काम को एजेंट को सौंपा जा सकता है.
यहां हमने एजेंट से कहा है कि "फ़र्ज़ी डेटा में दो और सेशन जोड़ो." यह फ़ाइल ढूंढता है और mockSessions
सूची में दो और इवेंट जोड़ता है.
आज़माने के लिए कुछ अन्य प्रॉम्प्ट:
- "<module> में <class> के लिए यूनिट टेस्ट लिखो."
- "अभी खुली हुई फ़ाइल के लिए दस्तावेज़ जनरेट करो."
- "ऐप्लिकेशन का टाइटल <current name> से बदलकर <new name> करो."
- "शून्य पॉइंटर अपवाद को ठीक करें."
- "मेरे कोड को फिर से व्यवस्थित करो. इसके लिए, <composable name> कंपोज़ेबल को नई फ़ाइल में ले जाओ.
पक्का करें कि सभी इंपोर्ट अपडेट किए गए हों."
- "ऐप्लिकेशन की होम स्क्रीन पर 'फ़ॉलो करें' नाम का एक नया बटन जोड़ो. इस बटन पर क्लिक करने से, विषयों की सूची दिखे."
- "<composable name> कंपोज़ेबल में, <modifier name> मॉडिफ़ायर की पैडिंग कम करो."
- "सोशल मीडिया पर शेयर करने के लिए, शेयर करने का बटन बनाओ."
एजेंट कैसे काम करता है
एजेंट मोड में, आपके प्रॉम्प्ट को Gemini API पर भेजा जाता है. साथ ही, उपलब्ध टूल की सूची भी भेजी जाती है. टूल को कौशल के तौर पर देखा जा सकता है. इनमें ये काम शामिल हैं: फ़ाइलें खोजना, फ़ाइलें पढ़ना, फ़ाइलों में मौजूद टेक्स्ट खोजना, कॉन्फ़िगर किए गए किसी भी एमसीपी सर्वर का इस्तेमाल करना वगैरह.
एजेंट को कोई टास्क देने पर, वह एक प्लान बनाता है और यह पता लगाता है कि इसके लिए किन टूल की ज़रूरत है. इनमें से कुछ टूल का इस्तेमाल करने से पहले, आपको एजेंट को अनुमति देनी पड़ सकती है. अनुमति देने के बाद, एजेंट ज़रूरी कार्रवाई करने के लिए टूल का इस्तेमाल करता है. इसके बाद, वह Gemini API को नतीजे भेजता है. Gemini, कार्रवाई के नतीजे को प्रोसेस करता है और एक और जवाब जनरेट करता है. कार्रवाई और आकलन का यह साइकल, टास्क पूरा होने तक जारी रहता है.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-08-05 (UTC) को अपडेट किया गया.
[[["समझने में आसान है","easyToUnderstand","thumb-up"],["मेरी समस्या हल हो गई","solvedMyProblem","thumb-up"],["अन्य","otherUp","thumb-up"]],[["वह जानकारी मौजूद नहीं है जो मुझे चाहिए","missingTheInformationINeed","thumb-down"],["बहुत मुश्किल है / बहुत सारे चरण हैं","tooComplicatedTooManySteps","thumb-down"],["पुराना","outOfDate","thumb-down"],["अनुवाद से जुड़ी समस्या","translationIssue","thumb-down"],["सैंपल / कोड से जुड़ी समस्या","samplesCodeIssue","thumb-down"],["अन्य","otherDown","thumb-down"]],["आखिरी बार 2025-08-05 (UTC) को अपडेट किया गया."],[],[],null,["# Agent Mode\n\nGemini in Android Studio's Agent Mode is designed to handle complex, multi-stage\ndevelopment tasks that go beyond what you can experience by just chatting with\nGemini. You can describe a high-level goal, and the agent will create and\nexecute a plan, invoking the necessary [tools](#how-it-works), making changes\nacross multiple files, and iteratively fixing bugs. This agent-assisted workflow\nempowers you to tackle intricate challenges, accelerating your development\nprocess.\n\nGet started\n-----------\n\nTo get started in Agent Mode in Android Studio, follow these steps:\n\n1. Click **Gemini** in the side bar. Sign in and onboard if you need to.\n2. Select the **Agent** tab.\n3. Describe the task you want the agent to perform.\n4. As the agent goes through the steps to accomplish the task, you'll have the\n option to review and approve any changes.\n\n5. Optional: To automatically approve changes, select **Agent options\n \\\u003e Auto-approve changes**.\n\nUse cases\n---------\n\nHere are some examples of use cases that the agent can help you with:\n\n- Fix build errors. When you ask the agent to fix a build error using a prompt\n like \"Fix build errors in my project,\" it will apply a recommended fix, build\n the project to verify the solution, and iterate until the issue is resolved.\n\n- Agent Mode can add or update UI elements all on its own. For example, ask the\n agent to \"Make dark mode the default in user preferences\" and it'll search for\n the relevant files and suggest changes to accomplish the task. You can\n immediately preview the UI updates in the **Running devices** tool window.\n\n- It's helpful to have mock data when prototyping and testing your app. Instead\n of manually creating fake data yourself, you can give that task to the agent.\n Here we've asked the agent to \"Add two more sessions to the fake data.\" It\n finds the relevant file and adds two more events to the `mockSessions` list.\n\nSome other prompts to try:\n\n- \"Write unit tests for \\\u003cclass\\\u003e in \\\u003cmodule\\\u003e.\"\n- \"Generate documentation for the currently open file.\"\n- \"Change the app title from \\\u003ccurrent name\\\u003e to \\\u003cnew name\\\u003e.\"\n- \"Resolve the null pointer exception.\"\n- \"Refactor my code by moving the \\\u003ccomposable name\\\u003e composable to a new file. Ensure all imports are updated.\"\n- \"Add a new button to the app's home screen called 'Follow' that takes you to a list of topics.\"\n- \"In the \\\u003ccomposable name\\\u003e composable, reduce the padding of the \\\u003cmodifier name\\\u003e modifier.\"\n- \"Create a share button to share to social media.\"\n\nHow the agent works\n-------------------\n\nIn Agent Mode, your prompt is sent to the Gemini API with a list of *tools* that\nare available. You can think of tools as skills: they include the ability to\nsearch for files, read files, search the text within files, use any\n[MCP servers](/studio/gemini/add-mcp-server) you have configured, and more.\n\nWhen you give the agent a task, it comes up with a plan and figures out which\ntools are needed. Some of these tools might need you to grant permission before\nthe agent can use them. Once you grant permission, the agent uses the tool to\nperform the necessary action and sends the result back to the Gemini API. Gemini\nprocesses the result of the action and generates another response. This cycle of\naction and evaluation continues until the task is complete."]]