Галоўная / Артыкулы

Managed Agents у Gemini API: пясочніцы, навыкі і пастаянныя агенты

Практычны разбор Antigravity Managed Agents ад Google: аддаленая Linux-пясочніца, проксі выходнага трафіку, стан у шматкрокавых дыялогах, навыкі, іменныя агенты і прадакшн-патэрны.

Выдавец: REACTAPP.TOP40 хв чытання9197 слоў

Крыніцы: Antigravity Managed Agents Tutorial: Ship Production AI Agents

Стына, з якою стыкаецца кожэн розробнік агентаў

Кожэн, хто створував додаток на основі штучного інтэлекту, знае цю проблему. Ад мадэлі мові вімагаюць допомогты запустыты веб-сайт, і яна повінна надаты готовій код. Однак нічого не відбуваецца, оскількі мадэль не можа відкрыты рэдактор, зберэгты файл чы натыснуты „Запустыты“, шчоб перэвірыты яго працу. Усю важку працу доводыцца віконуваты самому розробніку.

Існуючы інструменты для агентаў дыйсно дозволяюць вірышуваты більшэ завдань, зокрэма запуск серверыв і выканання тэстыв. Проце самостыйна праца все одно перэдбачае выканання кількох обов’язків:

  • створэння сандбоксу, шчоб мадэль могла віконуваты код без знішчэння вашых файлів
  • напісання коду, які забезпечуе обмін данімі між модулямі
  • налаштування інструментаў, шчоб мадэль могла до ніх звертатыся, отрымуваты даныя чы віконуваты скрыпты

Далей выклікаецца ўсё большая колькасць адпрацоўчых вітатаў, якія ўсе ўзятыя для таго, каб усё працавала безпечна. Ось як гэта выглядае, калі модэлю трэба напісаць і працаваць з Python-скрыптам.

from google import genai
import subprocess

client = genai.Client()

# Step 1: Ask the model for code
response = client.models.generate_content(
    model="gemini-2.5-flash",
    contents="Write a Python script that checks password strength and saves a report."
)

# Step 2: YOU must manually extract the code block from the text response
code = extract_code_from_markdown(response.text)  # You wrote this function

# Step 3: YOU must save the file and run it locally
with open("password_checker.py", "w") as f:
    f.write(code)

# ⚠️ Danger: Running untrusted AI-generated code on YOUR machine!
result = subprocess.run(["python3", "password_checker.py"], capture_output=True, text=True)
print(result.stdout)

Распрацоўшчык несе за все адміністрацыйную адпаведнасць: выкарыстанне коду з адказу, працэю з файламі, рызыкаваную локальную експансію, а таксама цыкл выкарыстання падзеек, які неабяжна запускаецца, калі ўтвараюцца проблемы.

Чы можа адна толькі вызов API взяць на сябе усё гэта? Фрэймворк Managed Agents ад Google і яго ключовы агент Antigravity створаны самэй для гэтага. Мадэль стае службай: замест чат-бота, які вяртае толькі тэкст, ён отрымае захішчаны камп’ютар у воблаку, які керуе Google, а таксама рабочую суперфісу Linux, якая падключэнае да інтэрнэту.

У табліцы ніжчэй практыкуецца трохі рывнёў сістэмаў AI.

Основны цыкл агента

Пры отрыманні задачы агент Antigravity не проста здагадваецца. Ён працуе ў неперывным цыкле, падтрымванамы рэальным апаратам.

┌────────────────────────────────────────┐
│          1. PLAN & REASON              │
│  (Analyzes objective & breaks it down) │
└───────────────────┬────────────────────┘
                    │
                    ▼
┌────────────────────────────────────────┐
│               2. ACT                   │
│ (Executes a tool: Bash, Python, Web)   │
└───────────────────┬────────────────────┘
                    │
                    ▼
┌────────────────────────────────────────┐
│             3. OBSERVE                 │
│ (Reads execution output, errors, data) │
└───────────────────┬────────────────────┘
                    │
                    └─── Loop back until task is complete

Гэта выклікаецца не проста ўзнёмкам запіту і адпаведнай адпаведзі. Агент прабывае стварыць скрыпт, выконвае яго, бачыць SyntaxError у выходных даных тэрмінала, лагодзіць бяг і пробуе знову, паўтараючы гэты працэс да завершэння задання.

Аддалёны sandbox

Кожны раз, калі запускаецца агент, Google стварае спецыяльную рабочую прастору.

Рэзультатам яе ёсць справжній камп’ютар з Linux у воблаку, які належыць агенту працягом выкаання яго задання.

Два рэжыму за API

Работа з кераванымі агентамі включае два окрэмыя рэжыму, да кожнага з якіх можна дасягнуць праз API Gemini.

                  ┌─────────────────────────────────┐
                  │           YOUR APP              │
                  └────────┬───────────────┬────────┘
                           │               │
      1. Define/Configure  │               │ 2. Run Task
      (System rules, ID)   │               │ (Send Prompt)
                           ▼               ▼
 ┌───────────────────────────────────┐   ┌───────────────────────────────────┐
 │        THE CONTROL PLANE          │   │         THE RUNTIME PLANE         │
 │          (Agents API)             │   │        (Interactions API)         │
 ├───────────────────────────────────┤   ├───────────────────────────────────┤
 │ Saves persistent identity, system │   │ Spawns the Ubuntu sandbox, logs   │
 │ instructions, and data mounts.    │   │ live traces, and processes loops. │
 └───────────────────────────────────┘   └───────────────────────────────────┘

Канал карэнтры, тое ўзе API агентаў, — гэта месца, дзе агент канфігуруецца і рэўіструецца. Гэта падобна да стварэння прафіля работніка: імя, інструкцыі для сістэмы, спецыяльныя навыкі і рэпазітарыяў, якія можна клонаваць. Ён вяртае статычны ID агента.

Канал выканання, тое ўзе API абмену, — гэта месца, дзе выконваюцца задачы. Задача прабіраецца да ID агента як „Абмен“, і гэты канал займаецца стварэнням сандбокса, запускам інструментоў, фіксаванням следаў разумовых прыемоў і кераваннем цыклам агента.

Безпека за дапамогай проксі для выходу

Дазвол якому-небудзь автонамнаму агенту запускаць неперакананыя скрыпты ёсць рызыкаванае. Google ізаліюе цяперашнюе сераўысе за дапамогай шару проксі для выходу.

 ┌─────────────────────────┐
 │ REMOTE UBUNTU SANDBOX   │
 │ (No internal secrets)   │
 └───────────┬─────────────┘
             │ Agent attempts outbound API call
             ▼
 ┌─────────────────────────┐
 │   EGRESS PROXY LAYER    │ ◄── Checks Domain Allowlist
 ├─────────────────────────┤
 │ Intercepts connection,  │
 │ injects secrets securely│
 └───────────┬─────────────┘
             │ Safe, Authenticated Request Sent
             ▼
    [ External Target API ]

Ён запэўняе тры гарантыі:

  • Няма секрэтнаў у самантэксце sandbox-а. Клучы API і паролі базы дадзеных ніколі не зберагаюцца ў рабочай прасторы агента.
  • Спіс дазволеных домэнаў. Вы самі адлучваеце, якія зовнішні домэны можа адвядзець агент.
  • Трансфармацыя заголовкаў. Пры выкліканні зовнішняй API проксі ловіць запіт, пераканальваецца ў спісе дазволеных домэнаў і сама дадае токен аутанізацыі. Даныя вяртаюцца да агента, тады калі прыватны ключ застаецца ад яго сакрэтым.

Першы агент за прыблізна пяць хвілін

Тэрэтарыўныя вакуумы

  • Python 3.10 або новейшая версія; рэкамендуецца 3.12, каліж тая падходзіць да часу запуску sandbox-а
  • google-genai SDK версіі 2.0.0 або вышэй (на момент напісання была 2.8.0)
  • Клуч API, які можна атрыбуаваць у безкоштовнай версіі праз Google AI Studio
  • Будзька операцыйная сістэма (macOS, Linux, Windows або WSL), таму што код запускаецца локальна, а агент — у хмарах Google
  • Створыце вяртуальную срэду і установіце SDK.

    python3 -m venv managed-agents-env
    source managed-agents-env/bin/activate   # On Windows: managed-agents-env\Scripts\activate
    # Install (or upgrade) the Google GenAI SDK
    pip install -U google-genai
    # Verify the version — must be 1.14.0 or later
    python3 -c "import google.genai; print(google.genai.__version__)"
    # Set your API key (get one at https://aistudio.google.com/apikey)
    export GEMINI_API_KEY="your-api-key-here"
    

    Калі вы хочаце адзінакова прыступіць да настройкі без адпаведных дзеянняў, у Google AI Studio ёсць раздзіл з шаблонамі „Managed Agents“, які функцыянацыюнуюць як інтэрактыўная плошчадка ў браузеры.

    Адкліканне прыкладаў

    Кожны з прыкладаў тут — гэта цэлысны, самастойны скрыпт на Python. Зберажыце яго у файл, а пасля запусціце.

    # 1. Save the code to a file (an example name used here is hello_agent.py
    vim hello_agent.py   # or use any editor
    
    # 2. Run it
    python3 hello_agent.py
    

    Кожная взаімадзеянне трывае ад паловы мінуты да трох мінут, залежна ад задачы: агент запускае сандбокс, пішаў і запускае код, чытае адзінкі і вяршыць павтарэння. Простыя задачы завершаюцца за мінуту, а складныя ланцоўкі з калькоў можаць трываць ад двух да трох мінут за кожны кальк.

    Прывет, кераваныя агенты

    Пораўняйце незграбны код з калькоў, паказаны раней, з адпаведнікам у кераваных агентах.

    from google import genai
    
    client = genai.Client()
    
    # One API call. One autonomous agent. One remote Linux sandbox.
    interaction = client.interactions.create(
        agent="antigravity-preview-05-2026",
        input="Write a Python script that generates 100 random exam scores between 0 and 100, "
              "calculates the mean, median, and standard deviation, prints a summary, "
              "and saves a grade distribution histogram as grade_report.png using matplotlib.",
        environment="remote"  # This provisions a secure Linux sandbox hosted by Google
    )
    
    print(interaction.output_text)
    

    Заўяжыце яго.

    python3 hello_agent.py
    

    Першая адыякцыя дала следуючы выхад. Чысла разлічаюцца з адной эксперыментальнай практыкі да іншай, таму што даныя ўзлётна-падлётныя.

    I have successfully written and executed a Python script that generates 100 random exam scores, computes their key statistics, and plots a grade distribution histogram.
    
    ### 1. Generated Python Script (`generate_report.py`)
    
    Here is the Python script, which is saved in the environment as `generate_report.py`. It uses `numpy` for data generation, `statistics` conventions for calculation (such as sample standard deviation), and `matplotlib` to generate a high-quality visualization.
    
    ```python
    import numpy as np
    import matplotlib.pyplot as plt
    import statistics
    
    def generate_and_analyze_grades():
        # Set a random seed for reproducibility
        np.random.seed(42)
    
        # Generate 100 random exam scores between 0 and 100 (inclusive)
        scores = np.random.randint(0, 101, size=100)
    
        # Calculate statistics using Python's standard statistics module and NumPy
        # (Using ddof=1 for sample standard deviation, which is standard for student grade samples)
        mean_val = np.mean(scores)
        median_val = np.median(scores)
        std_val = np.std(scores, ddof=1)
    
        # Print summary to console
        print("=========================================")
        print("         EXAM GRADE REPORT SUMMARY       ")
        print("=========================================")
        print(f"Number of Students : {len(scores)}")
        print(f"Minimum Score      : {np.min(scores)}")
        print(f"Maximum Score      : {np.max(scores)}")
        print(f"Mean Score         : {mean_val:.2f}")
        print(f"Median Score       : {median_val:.2f}")
        print(f"Standard Deviation : {std_val:.2f}")
        print("=========================================")
    
        # Create the histogram plot
        plt.figure(figsize=(10, 6))
    
        # Customize the grid and style
        plt.grid(axis='y', linestyle='--', alpha=0.7, zorder=0)
    
        # Draw the histogram with bins of size 10 (0-10, 10-20, ..., 90-100)
        bins = range(0, 111, 10)
        plt.hist(scores, bins=bins, color='#4A90E2', edgecolor='black', rwidth=0.85, zorder=3)
    
        # Add labels and title
        plt.title('Distribution of Exam Scores', fontsize=16, fontweight='bold', pad=15)
        plt.xlabel('Exam Scores', fontsize=12, labelpad=10)
        plt.ylabel('Number of Students', fontsize=12, labelpad=10)
    
        # Mark Mean and Median with vertical lines
        plt.axvline(mean_val, color='#D0021B', linestyle='dashed', linewidth=2, zorder=4, label=f'Mean: {mean_val:.2f}')
        plt.axvline(median_val, color='#F5A623', linestyle='dotted', linewidth=2, zorder=4, label=f'Median: {median_val:.2f}')
    
        # Set x-ticks to align with bins
        plt.xticks(range(0, 101, 10))
    
        # Add a legend
        plt.legend(fontsize=11, loc='upper left')
    
        # Add details text box on the plot
        textstr = '\n'.join((
            f'Total Students: {len(scores)}',
            f'Mean: {mean_val:.2f}',
            f'Median: {median_val:.2f}',
            f'Std Dev: {std_val:.2f}'
        ))
        props = dict(boxstyle='round', facecolor='wheat', alpha=0.5)
        plt.gca().text(0.05, 0.75, textstr, transform=plt.gca().transAxes, fontsize=10,
                verticalalignment='top', bbox=props)
    
        # Adjust layout and save the figure
        plt.tight_layout()
        output_filename = 'grade_report.png'
        plt.savefig(output_filename, dpi=300)
        print(f"\nHistogram successfully saved to '{output_filename}'")
    
    if __name__ == '__main__':
        generate_and_analyze_grades()
    ```
    
    ---
    
    ### 2. Output Statistics Summary
    
    Upon running the script in the sandbox environment, it produced the following output:
    
    ```text
    =========================================
             EXAM GRADE REPORT SUMMARY
    =========================================
    Number of Students : 100
    Minimum Score      : 1
    Maximum Score      : 100
    Mean Score         : 51.31
    Median Score       : 53.50
    Standard Deviation : 29.70
    =========================================
    
    Histogram successfully saved to 'grade_report.png'
    ```
    
    ---
    
    ### 3. Generated Histogram Details (`grade_report.png`)
    
    The script successfully outputted `grade_report.png` in high-resolution format (300 DPI) containing:
    - **Clean Grid & Styling**: Standard light-gray horizontal grids to easily identify column heights.
    - **Grade Bins**: Defined score ranges of size 10 (e.g., 0–10, 10–20, ..., 90–100) using custom spacing to give the columns a professional look.
    - **Key Metrics Highlighted**:
      - A red dashed line representing the **Mean** (`51.31`).
      - A yellow dotted line representing the **Median** (`53.50`).
    - **An Info Legend and Box**: In the top-left area summarizing all descriptive statistics for easy offline reference.
    
    ### How to Run it Yourself
    If you want to run this script in another environment, ensure you have the required packages installed:
    ```bash
    pip install matplotlib numpy
    python generate_report.py
    ```
    

    Вяртаецца толькі статысмент на простай англійскай мове, а не выход дадзеныя з програмы. У ём упомінаюцца дзеянні агента: код, які ён напісаў, пакеты, якія ён установіў, і рэзультаты, тады калі самі скрыпты і файлы з графікамі застаюцца ў удаленай «піскулярной» асяроддзі.

    Гэта калькі ліній зрозумелага коду. У тылу агент:

    1. запускае «піскулярную» срэду Ubuntu Linux
    2. напісвае скрыпт на Python для стварэння аднойчыных дадзеных і вычыслення статыстык
    3. установівае matplotlib сам, без паведамлення пра ўпэўненасць у яго неабходнасці
    4. запускае скрыпт і стварае гістаграму у файл grade_report.png
    5. вяртае статысмент з статыстыкамі і падтверджэнням, што графік быў запісаны

    Для болей амбіцыйных задач патрэбны калькі інструментоў разам.

    from google import genai
    client = genai.Client()
    
    interaction = client.interactions.create(
        agent="antigravity-preview-05-2026",
        input="""
        Research the top 5 most popular Python web frameworks in 2026.
        For each framework:
        1. Find the latest version number and release date
        2. Count the GitHub stars
        3. Write a comparison table in Markdown
        """,
        environment="remote"
    )
    
    print(interaction.output_text)
    

    У гэтам запуску агент шукае інфармацыю ў Google праз перэгляд веб-сторонак, обрабоцвае даныя за дапамой выканання коду і зберагае рэзультаты праз кантроль файлаў, усё гэта самастойна, за аднаго вызову API. Яго рэзультаты прыводзяцца ніжчэй.

    The landscape of Python web development in **2026** is marked by a fascinating split [1, 2]. On one side, classic **backend-first** and **API-focused** frameworks (Django, FastAPI, Flask) remain the dominant standards for enterprise applications and microservices [3, 5]. On the other side, **pure-Python UI and full-stack** frameworks (Streamlit, Reflex) have seen explosive growth—driven by the need to build interactive web apps, data dashboards, and AI/ML interfaces without writing JavaScript or TypeScript [1, 2].
    
    Below is an in-depth research report on the **top 5 most popular Python web frameworks in 2026**, ranked by GitHub stars and overall developer adoption.
    
    ---
    
    ### Detailed Breakdown of the Top 5 Python Web Frameworks
    
    #### 1. FastAPI (99,034 GitHub Stars)
    *   **Latest Version:** `0.136.3` (Released: **May 23, 2026**)
    *   **Architecture Type:** ASGI (Asynchronous Server Gateway Interface)
    *   **Primary Focus:** High-Performance APIs and Microservices [4]
    *   **Core Philosophy:** FastAPI is designed to build APIs quickly with standard Python type hints. It leverages **Pydantic v2** for extremely fast data validation and serialization, and **Starlette** for high-concurrency async handling [3, 4]. It natively auto-generates interactive Swagger UI and ReDoc documentation.
    *   **Ideal Use Case:** AI/ML model deployment, backend APIs for single-page applications (React/Vue/Svelte), and low-latency microservices [5].
    
    #### 2. Django (87,811 GitHub Stars)
    *   **Latest Version:** `6.0.6` (Released: **June 3, 2026**)
    *   **Architecture Type:** WSGI & ASGI (Fully async-supported)
    *   **Primary Focus:** "Batteries-Included" Monolithic Web Applications [4]
    *   **Core Philosophy:** As an 18-year industry standard, Django remains the premier full-featured web framework [2]. It handles everything—database routing (via its powerful ORM), administration panels, user authentication, form validation, and robust security defaults (SQLi, CSRF, XSS protection) [1]. In 2026, Django 6.x is highly optimized with full native asynchronous views and type hints [4].
    *   **Ideal Use Case:** Large-scale enterprise applications, content management systems, e-commerce platforms, and fast SaaS MVP development where you need a complete, secure architecture out of the box [2, 5].
    
    #### 3. Flask (71,638 GitHub Stars)
    *   **Latest Version:** `3.1.3` (Released: **February 19, 2026**)
    *   **Architecture Type:** WSGI
    *   **Primary Focus:** Lightweight, Flexible Microframework [4]
    *   **Core Philosophy:** Flask provides a minimalist core, leaving the choice of database ORM, form handling, and security components completely up to the developer [1, 2]. Paired with modern 2026 extensions (SQLAlchemy 2.x, Pydantic), it represents a simple, un-opinionated foundation that never gets in the developer's way [3].
    *   **Ideal Use Case:** Small utility applications, lightweight APIs, microservices, and custom projects where developers want total control over their system design [1, 5].
    
    #### 4. Streamlit (44,895 GitHub Stars)
    *   **Latest Version:** `1.58.0` (Released: **May 28, 2026**)
    *   **Architecture Type:** UI-First Scripting Paradigm
    *   **Primary Focus:** Rapid Data and Machine Learning Applications [1]
    *   **Core Philosophy:** Streamlit turns standard Python scripts into interactive, beautiful web apps in a matter of minutes. It handles the entire frontend and backend flow by re-running the script from top to bottom whenever a user interacts with a widget.
    *   **Ideal Use Case:** Quick data dashboards, machine learning model prototypes, and internal analytical tools for teams without frontend resources [1, 2].
    
    #### 5. Reflex (28,467 GitHub Stars)
    *   **Latest Version:** `0.9.4` (Released: **June 4, 2026**)
    *   **Architecture Type:** Full-Stack Async React-Compiled
    *   **Primary Focus:** Interactive, Pure-Python Full-Stack Apps [2]
    *   **Core Philosophy:** Formerly known as Pynecone, Reflex compiles Python code into a high-performance **React/Next.js frontend** and a **FastAPI backend**, using real-time WebSockets to synchronize states between them [1, 2]. It bypasses JavaScript entirely, offering 60+ pre-built Radix UI components with native Tailwind integration [1, 2].
    *   **Ideal Use Case:** Complex, interactive web applications, real-time streaming dashboards (e.g., AI chat applications, financial trackers), and user-facing SaaS applications built entirely in Python [2].
    
    ---
    
    ### Other Honorable Mentions in 2026
    While they didn't make the top 5 by GitHub stars, these frameworks are heavily utilized:
    *   **Tornado** (22,182 stars, v6.5.7, Released June 8, 2026): A mature, asynchronous networking framework ideal for long-lived WebSocket connections [4].
    *   **Sanic** (18,629 stars, v25.12.1, Released May 31, 2026): An ASGI web framework built for extreme speed and Flask-like simplicity, running on its own high-performance web server.
    *   **Litestar** (8,269 stars, v2.23.0, Released May 29, 2026): A highly structured, strict, and enterprise-grade ASGI alternative to FastAPI [3, 4].
    
    ---
    
    ### 2026 Python Web Frameworks Comparison Table
    
    | Framework | GitHub Stars | Latest Version | Release Date | Architecture | Best For | Key Strength | Learning Curve |
    | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- |
    | **FastAPI** | ~99,034 | `0.136.3` | May 23, 2026 | ASGI (Async) | High-performance API development & AI model deployments [4, 5] | Autogenerated Swagger docs, native Pydantic v2 validation [4] | **Easy / Moderate** |
    | **Django** | ~87,811 | `6.0.6` | Jun 03, 2026 | WSGI / ASGI | Enterprise apps, content-heavy websites, secure SQL backends [1, 2] | "Batteries-included" (built-in admin, ORM, security, auth) [1, 2] | **Moderate / Hard** |
    | **Flask** | ~71,638 | `3.1.3` | Feb 19, 2026 | WSGI (Sync-first) | Microservices, custom MVPs, lightweight apps [1, 5] | Unrivaled design flexibility, minimal core overhead [1] | **Very Easy** |
    | **Streamlit**| ~44,895 | `1.58.0` | May 28, 2026 | Scripted Reactive | Data visualization dashboards & ML interactive tools [1] | Zero frontend experience needed; fast prototyping [1] | **Very Easy** |
    | **Reflex** | ~28,467 | `0.9.4` | Jun 04, 2026 | Async React-compiled | Interactive, real-time SaaS & full-stack apps in pure Python [2] | True multi-page routing, state management without JavaScript [2] | **Moderate** |
    
    ---
    
    ### Guidance: Which Framework Should You Choose in 2026?
    
    1.  **Choose FastAPI** if you are building modern REST/GraphQL APIs, backend microservices, or deploying AI/ML models with high concurrency and automatic documentation [3, 5].
    2.  **Choose Django** if you are building database-driven business platforms or SaaS architectures where user authentication, administrative interfaces, and built-in security are paramount [1, 2].
    3.  **Choose Flask** if you need to build simple backend services or you want to hand-select every tool in your stack (e.g., combining custom database layers with external identity providers) [1].
    4.  **Choose Streamlit** if your core team consists of data scientists or business analysts who need to quickly present internal analytics, charts, and interactive widgets without building a complex web architecture [1, 2].
    5.  **Choose Reflex** if you want to build a fully interactive, production-ready full-stack application (with complex states, WebSocket interactions, and beautiful custom styles) but do not want to divide your team between Python and JavaScript [2].
    
    ---
    
    ### Sources & References
    *   [1] [Best Python Web Frameworks 2026 Compared - Reflex](https://reflex.dev/blog/top-python-web-frameworks/)
    *   [2] [Django vs Flask vs Reflex (April 2026) - Reflex](https://reflex.dev/blog/django-vs-flask-vs-reflex-comparison/)
    *   [3] [12 Modern Python Frameworks to Try in 2026 - Medium](https://medium.com/the-pythonworld/12-modern-python-frameworks-to-try-in-2026-e7089305bb19)
    *   [4] [5 top Python web frameworks of 2026 - Educative.io](https://www.educative.io/blog/top-python-web-frameworks)
    *   [5] [The Python Backend Framework Decision Guide for 2026 - Rollbar](https://rollbar.com/blog/python-backend-frameworks/)
    

    Багатокрокаўскія кантакты з паставаемым станам

    По значэнню прызначэння кожны вызов interactions.create() пачынае абсолютна новы, порожній сэндбокс. Ёжчы агент могаў працаваць на базе пярэдніх робатаў, трэба вернуць два ID.

    from google import genai
    client = genai.Client()
    
    # Turn 1: Research and create a report
    interaction_1 = client.interactions.create(
        agent="antigravity-preview-05-2026",
        input="Research the current state of carbon capture technology in 2026. "
              "Write a comprehensive 500-word report and save it as report.md",
        environment="remote"
    )
    print(f"Environment ID: {interaction_1.environment_id}")
    print(f"Interaction ID: {interaction_1.id}")
    print(interaction_1.output_text)
    
    # Turn 2: Build on the previous work - same sandbox, same files
    interaction_2 = client.interactions.create(
        agent="antigravity-preview-05-2026",
        environment=interaction_1.environment_id,       # ← Re-attaches to same Ubuntu sandbox
        previous_interaction_id=interaction_1.id,       # ← Preserves conversation memory
        input="Convert that report.md file into a clean index.html webpage "
              "with modern inline CSS styling and responsive design."
              " Please output the contents of the index.html file"
    )
    print(interaction_2.output_text)
    

    Першая адыякцыя створыла файл report.md.

    Environment ID: 5eb9b4b8-c02f-4a8f-b7a0-c90a796c01a6
    Interaction ID: v1_ChdidXNuYXJLQkF1eWlqdU1QODRmUjJRZxIXYnVzbmFyS0JBdXlpanVNUDg0ZlIyUWc
    I have researched the state of carbon capture, utilization, and storage (CCUS)
    technology in 2026 and compiled a comprehensive 494-word report.
    The report has been successfully saved to your environment as **`report.md`**.
    
    Below is the full text of the report,
    highlighting how the CCUS sector has transitioned from pilot-stage
    demonstrations to industrial infrastructure in 2026.
    
    ***
    
    # The State of Carbon Capture Technology in 2026: From Pilot to Infrastructure
    
    ## Executive Summary
    ....
    
    ## Point-Source Capture: The Current Backbone
    ...
    
    ## Scaling Direct Air Capture (DAC)
    ...
    
    ## Infrastructure, Transport, and Policy
    ...
    
    ## Key Challenges
    ...
    
    ***
    
    ### Sources Cited
    
    * **[1] S&P Global:** [2026 CCUS: Navigating the tides of the great realignment](https://www.spglobal.com/energy/en/news-research/blog/energy-transition/041426-2026-ccus-navigating-the-tides-of-the-great-realignment) (April 2026)
    * **[2] Carbon Herald:** [What's Next For Carbon Capture, Utilization & Storage (CCUS) In 2026](https://carbonherald.com/whats-next-for-carbon-capture-utilization-storage-ccus-in-2026/) (January 2026)
    * **[3] Nature Tech Memos:** [Top 10 Carbon Capture Startups for Corporate Partnerships in 2026](https://www.naturetechmemos.com/p/top-10-carbon-capture-startups-for-corporate-partnerships-in-2026) (April 2026)
    .....
    

    У другай адзінкцы была выкарыстоўвана ранейшая асяроддзе і адзінкцы, і была запатрэбавана версія адчытнай кнігі у фармаце HTML, index.html, пры чым ў інструкцыі чыста прасілі падаць тэкст HTML у адпаведзі.

    I have successfully converted your `report.md` file into a clean, modern, and highly responsive **`index.html`** webpage!
    
    ### What was done:
    1. **Designed a cohesive palette:** Implemented a modern climate-tech inspired aesthetic using Slate (`#1e293b`) and a range of deep and light teals (`#0f766e`, `#14b8a6`, `#115e59`).
    2. **Added an Interactive Stat Dashboard:** Created a high-level statistical summary card grid displaying key 2026 data at a glance (e.g., global Mtpa capacity, Stratos targets, US Section 45Q tax credits).
    3. **Structured visual highlights:** Embedded two distinct grid comparison cards for the **Climeworks Mammoth** and **1PointFive Stratos** facilities, as well as a custom callout block highlighting the trans-European **Northern Lights** shipping route.
    4. **Professionalized the typography & chemistry:** Used system-ui fonts for excellent loading speeds and correctly formatted all chemical formulas to standard subscripts (e.g., **CO<sub>2</sub>**).
    5. **Citations & Interactivity:** Mapped the original references into clickable, superscript citation numbers (e.g., `[1]`) that link smoothly down to a beautifully bulleted "Sources Cited" section with custom index bullet styling.
    
    The full HTML contents of the newly created `index.html` are shown below:
    
    ```html
    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>The State of Carbon Capture Technology in 2026</title>
        <style>
            :root {
                --primary: #0f766e;
                --primary-light: #14b8a6;
                --primary-dark: #115e59;
                --bg: #f8fafc;
                --card-bg: #ffffff;
                --text-main: #1e293b;
                --text-muted: #475569;
                --accent: #0284c7;
                --border: #e2e8f0;
                --shadow: 0 4px 6px -1px rgba(15, 118, 110, 0.05), 0 2px 4px -2px rgba(15, 118, 110, 0.05);
                --shadow-md: 0 10px 15px -3px rgba(15, 118, 110, 0.1), 0 4px 6px -4px rgba(15, 118, 110, 0.1);
            }
            * {
                box-sizing: border-box;
            }
            body {
                font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
                background-color: var(--bg);
                color: var(--text-main);
                line-height: 1.8;
                margin: 0;
                padding: 0;
                -webkit-font-smoothing: antialiased;
            }
    
            <!-- LOTS MORE CSS STUFF :-) -->
    
            footer {
                text-align: center;
                color: var(--text-muted);
                font-size: 0.875rem;
                margin-top: 4rem;
                padding-top: 2rem;
                border-top: 1px solid var(--border);
            }
        </style>
    </head>
    <body>
    
        <header>
            <div class="header-content">
                <span class="meta">Special Intelligence Report</span>
                <h1>The State of Carbon Capture Technology in 2026</h1>
                <p>From Pilot to Infrastructure</p>
            </div>
        </header>
    
        <main>
            <!-- Key Metrics Dashboard -->
            <div class="stats-grid">
                <div class="stat-card">
                    <div class="stat-num">~73 Mtpa</div>
                    <div class="stat-label">Global Operational Capacity</div>
                </div>
                <div class="stat-card">
                    <div class="stat-num">500k Tons</div>
                    <div class="stat-label">Stratos DAC Annual Target</div>
                </div>
                <div class="stat-card">
                    <div class="stat-num">Up to $180</div>
                    <div class="stat-label">US 45Q Subsidy per Ton</div>
                </div>
                <div class="stat-card">
                    <div class="stat-num">36,000 T</div>
                    <div class="stat-label">Mammoth Iceland Capacity</div>
                </div>
            </div>
    
            <div class="content-wrapper">
                <!-- Executive Summary -->
                <section id="executive-summary">
                    <h2>Executive Summary</h2>
                    <p>
                        In 2026, the Carbon Capture, Utilization, and Storage (CCUS) industry is undergoing an "industrial hardening" phase, transitioning decisively from demonstration-stage pilots to commercial-scale infrastructure<sup><a href="#ref-1" class="citation-link">[1]</a></sup>. Global operational capture capacity has reached approximately 73 million metric tons per annum (Mtpa) as of mid-2026, up from 50 Mtpa in early 2025<sup><a href="#ref-1" class="citation-link">[1]</a></sup><sup><a href="#ref-2" class="citation-link">[2]</a></sup>. This momentum is propelled by robust climate policies, corporate carbon-removal commitments, and the commissioning of megaton-scale facilities.
                    </p>
                </section>
    
                <!-- Point-Source Capture -->
                <section id="point-source">
                    <h2>Point-Source Capture: The Current Backbone</h2>
                    <p>
                        Point-source carbon capture remains the commercial backbone of CCUS<sup><a href="#ref-2" class="citation-link">[2]</a></sup>. Technologies deployed at industrial and energy facilities—such as cement, steel, chemicals, and refining—now represent the vast majority of active capture capacity. Post-combustion chemical absorption using amine-based solvents is the most widely deployed technology<sup><a href="#ref-2" class="citation-link">[2]</a></sup>. Companies like Carbon Upcycling Technologies are successfully integrating capture systems with utilization, converting captured carbon dioxide (CO<sub>2</sub>) into high-quality construction materials, turning emissions from cement manufacturers into a low-carbon concrete feedstock<sup><a href="#ref-3" class="citation-link">[3]</a></sup>.
                    </p>
                </section>
    
                <!-- Scaling Direct Air Capture -->
                <section id="dac">
                    <h2>Scaling Direct Air Capture (DAC)</h2>
                    <p>
                        Direct Air Capture is experiencing a dramatic scale-up<sup><a href="#ref-4" class="citation-link">[4]</a></sup>. Climeworks' "Mammoth" facility in Iceland, operational since May 2024, captures up to 36,000 tons of CO<sub>2</sub> annually, storing it permanently underground via Carbfix mineralization<sup><a href="#ref-4" class="citation-link">[4]</a></sup><sup><a href="#ref-5" class="citation-link">[5]</a></sup>. Meanwhile, 1PointFive's (a subsidiary of Occidental Petroleum) "Stratos" facility in Ector County, Texas, is entering active operation in 2026<sup><a href="#ref-4" class="citation-link">[4]</a></sup>. Designed to capture up to 500,000 tons of atmospheric CO<sub>2</sub> annually using liquid solvent technology licensed from Carbon Engineering, Stratos is currently the world’s largest DAC plant<sup><a href="#ref-4" class="citation-link">[4]</a></sup><sup><a href="#ref-6" class="citation-link">[6]</a></sup>.
                    </p>
    
                    <div class="highlight-grid">
                        <div class="highlight-box">
                            <h4>Climeworks: Mammoth (Iceland)</h4>
                            <p>Nameplate capacity of 36,000 tons/year. Relies on solid-sorbent collectors powered by clean geothermal energy with deep Carbfix basaltic storage.</p>
                        </div>
                        <div class="highlight-box">
                            <h4>1PointFive: Stratos (Texas)</h4>
                            <p>World's largest facility with 500,000 tons/year target. Employs liquid-solvent infrastructure designed for rapid regional scalability.</p>
                        </div>
                    </div>
    
                    <p>
                        Major technology firms (including Microsoft, Google, Meta, and Amazon) have signed multi-year offtake agreements for high-quality, durable carbon credits, paying between $200 and $300 per ton, though current baseline DAC capture costs remain high, between $400 and $1,000 per ton<sup><a href="#ref-3" class="citation-link">[3]</a></sup><sup><a href="#ref-7" class="citation-link">[7]</a></sup>.
                    </p>
                </section>
    
                <!-- Infrastructure, Transport, and Policy -->
                <section id="infrastructure">
                    <h2>Infrastructure, Transport, and Policy</h2>
                    <p>
                        The commercial viability of carbon capture relies heavily on dedicated transportation and storage networks<sup><a href="#ref-2" class="citation-link">[2]</a></sup>. In Europe, 2026 marks the active operation of Norway’s "Northern Lights" project, the world's first open-source CO<sub>2</sub> transport and storage network<sup><a href="#ref-8" class="citation-link">[8]</a></sup>. For example, Yara's flagship Sluiskil ammonia plant in the Netherlands is liquefying up to 800,000 tons of CO<sub>2</sub> annually to be shipped by Northern Lights for permanent undersea storage<sup><a href="#ref-8" class="citation-link">[8]</a></sup>. Concurrently, Denmark’s "Greensand" offshore storage initiative is beginning operations<sup><a href="#ref-2" class="citation-link">[2]</a></sup>.
                    </p>
    
                    <div class="callout">
                        <div class="callout-title">The Trans-European Shipping Pathway</div>
                        <p>Northern Lights bridges emission-heavy inland industrial sites like Yara Sluiskil in the Netherlands directly with permanent injection storage wells beneath the North Sea seabed.</p>
                    </div>
    
                    <p>
                        On the policy front, the sector is heavily anchored by government subsidies. In the United States, the Inflation Reduction Act’s (IRA) modified Section 45Q tax credit provides up to $180 per metric ton for DAC and $85 per metric ton for point-source capture<sup><a href="#ref-9" class="citation-link">[9]</a></sup>. In the European Union, the Net Zero Industry Act has accelerated cross-border transport approvals, providing regulatory certainty.
                    </p>
                </section>
    
                <!-- Key Challenges -->
                <section id="challenges">
                    <h2>Key Challenges</h2>
                    <p>
                        Despite rapid progress, critical bottlenecks persist. Chief among these is the high energy intensity of DAC, which requires 1.5 to 2.5 megawatt-hours (MWh) of zero-carbon energy per ton of captured CO<sub>2</sub><sup><a href="#ref-7" class="citation-link">[7]</a></sup>. Permitting delays for geologic injection wells—specifically the EPA’s rigorous Class VI permits in the United States—also restrict how fast captured carbon can be sequestered<sup><a href="#ref-4" class="citation-link">[4]</a></sup>. Overcoming these economic and infrastructure hurdles remains essential to achieving megaton targets by 2030.
                    </p>
                </section>
    
                <!-- Sources Cited -->
                <div class="sources-section">
                    <h3>Sources Cited</h3>
                    <ul class="sources-list">
                        <li id="ref-1" data-index="1"><strong>S&P Global:</strong> <a href="https://www.spglobal.com/energy/en/news-research/blog/energy-transition/041426-2026-ccus-navigating-the-tides-of-the-great-realignment" target="_blank">2026 CCUS: Navigating the tides of the great realignment</a> (April 2026)</li>
                        <li id="ref-2" data-index="2"><strong>Carbon Herald:</strong> <a href="https://carbonherald.com/whats-next-for-carbon-capture-utilization-storage-ccus-in-2026/" target="_blank">What's Next For Carbon Capture, Utilization & Storage (CCUS) In 2026</a> (January 2026)</li>
                        <li id="ref-3" data-index="3"><strong>Nature Tech Memos:</strong> <a href="https://www.naturetechmemos.com/p/top-10-carbon-capture-startups-for-corporate-partnerships-in-2026" target="_blank">Top 10 Carbon Capture Startups for Corporate Partnerships in 2026</a> (April 2026)</li>
                        <li id="ref-4" data-index="4"><strong>Senken:</strong> <a href="https://www.senken.io/blog/top-direct-air-capture-carbon-removal-projects-buyers-guide" target="_blank">The Top 3 Direct Air Capture Carbon Removal Projects</a> (February 2026)</li>
                        <li id="ref-5" data-index="5"><strong>Climeworks:</strong> <a href="https://climeworks.com/plant-mammoth" target="_blank">Mammoth: our newest direct air capture and storage facility</a> (May 2024)</li>
                        <li id="ref-6" data-index="6"><strong>Carbon Credits:</strong> <a href="https://carboncredits.com/top-3-carbon-capture-leaders-to-drive-the-net-zero-race-in-2026/" target="_blank">Top 3 Carbon Capture Leaders to Drive the Net-Zero Race in 2026</a> (January 2026)</li>
                        <li id="ref-7" data-index="7"><strong>Energy Solutions Intelligence:</strong> <a href="https://energy-solutions.co/articles/sub/carbon-capture-direct-air-dac-cost-analysis" target="_blank">Direct Air Capture in 2026: Cost, Scale, and Path to $200/tCO2</a> (January 2026)</li>
                        <li id="ref-8" data-index="8"><strong>World Economic Forum:</strong> <a href="https://www.weforum.org/stories/2026/01/scale-carbon-capture-storage-climate-action/" target="_blank">How to scale carbon capture and storage for climate action</a> (January 2026)</li>
                        <li id="ref-9" data-index="9"><strong>International Energy Agency (IEA):</strong> <a href="https://www.iea.org/policies/16255-inflation-reduction-act-2022-sec-13104-extension-and-modification-of-credit-for-carbon-oxide-sequestration" target="_blank">Inflation Reduction Act 2022: Sec. 13104 Extension and Modification of Credit for Carbon Oxide Sequestration</a> (February 2026)</li>
                    </ul>
                </div>
    
                <footer>
                    <p style="text-align: center; color: var(--text-muted); font-size: 0.875rem; margin: 0;">&copy; 2026 Carbon Capture Intelligence. Compiled June 2026.</p>
                </footer>
            </div>
        </main>
    
    </body>
    </html>
    ```
    

    Атрыбутаваныя адказы выглядаюць так.

    Два ID

    Як паказана ў табліцы, два ID выпаловаюць разныя функцыі.

    Адна падказка: environment_id можна перэдаць без previous_interaction_id. Чырвоны спосаб выкарыстоўвае вялікія файлы і установленыя пакеты, але пачынае новую розмову, што падходзіць для стварэння новай рабочай суперфісу для новага заведама.

    Зялленне файлоў

    Адна з можлівасцей — прабачыць агенту паклаць адказ з адметнай часткай файлу, але гэта зазвычай не ўзятае як найкрашчы варыянт. Часта файл павінен выйсці безпосерэдна з сэндбокса. У прыкладзе ніжэй павтараецца паказаная раней мнагатыя-разовая сесія, якая стварыла адказ у фармаце markdown і версію ў фармаце HTML, а таксама даданы код, які зяллеўвае весь фотакопію срэдавішча у фармаце tar і выкарыстоўвае яе ў локальной папцы. Гэта тое, што наразе падтрымвае срэдавішча Managed Agents.

    import os
    import requests
    import tarfile
    from google import genai
    client = genai.Client()
    
    # Turn 1: Research and create a report
    interaction_1 = client.interactions.create(
        agent="antigravity-preview-05-2026",
        input="Research the current state of carbon capture technology in 2026. "
              "Write a comprehensive 500-word report and save it as report.md",
        environment="remote"
    )
    print(f"Environment ID: {interaction_1.environment_id}")
    print(f"Interaction ID: {interaction_1.id}")
    print(interaction_1.output_text)
    
    # Turn 2: Build on the previous work - same sandbox, same files
    interaction_2 = client.interactions.create(
        agent="antigravity-preview-05-2026",
        environment=interaction_1.environment_id,       # ← Re-attaches to same Ubuntu sandbox
        previous_interaction_id=interaction_1.id,       # ← Preserves conversation memory
        input="Convert that report.md file into a clean index.html webpage "
              "with modern inline CSS styling and responsive design."
              " Please output the contents of the index.html file"
    )
    print(interaction_2.output_text)
    
    env_id = interaction_2.environment_id
    api_key = os.environ.get("GEMINI_API_KEY")
    
    response = requests.get(
        f"https://generativelanguage.googleapis.com/v1beta/files/environment-{env_id}:download",
        params={"alt": "media"},
        headers={"x-goog-api-key": api_key},
        allow_redirects=True,
    )
    
    with open("snapshot_env.tar", "wb") as f:
        f.write(response.content)
    
    os.makedirs("extracted_env_snapshot", exist_ok=True)
    with tarfile.open("snapshot_env.tar") as tar:
        tar.extractall(path="extracted_env_snapshot")
    

    У момент напісання не існуе метода SDK для гэтага, таму знімак стану аплікацыі отрымваецца праз прымую вызов REST. Пасля запуску программы выкарыстоўваныя файлы з’яўляюцца ў локальной папкі.

    Налагоджэнне агентаў за дапамогою навыкаў і персанажаў

    У зьвязку з тым, што Antigravity не выкарыстоўвае адну вялікую строчку заповедзі, ён выкарыстоўвае сістэму налашчэння, створаную на базе файловай сістэмы. Калі запускаецца сандбокс, ён шукае захаваную папку .agents/.

    📁 Your-Project-Directory/
    └── 📁 .agents/
        ├── 📄 AGENTS.md        ← Global system instructions (persona, rules, standards)
        └── 📁 skills/
            └── 📁 data-cleaner/
                └── 📄 SKILL.md ← Specific skill with step-by-step instructions
    

    AGENTS.md як апература

    У гэтым файле знаходзяцца базовыя правілы, меры поведэння і інформацыя пра праект для апературы; ён дзеяў як README, які чытаецца перад кожным заведаменнем.

    SKILL.md для модульных навыкаў

    Навыкі агрупуюць спецыялізаваныя знання ў воспрацоўваныя елементы, пры чым YAML frontmatter выкорыстоўваецца для метаданых, а Markdown — для інструкцый.

    ---
    name: data-cleaner
    description: Use when the user needs to clean, normalize, or validate tabular data files.
    ---
    # Data Cleaner
    ## When to Use
    - User provides CSV, Excel, or JSON files that need cleaning
    - Data has missing values, inconsistent formatting, or duplicate rows
    ## Steps
    1. Load the data file using pandas
    2. Profile the data: count nulls, duplicates, and type mismatches
    3. Apply cleaning rules (fill nulls, normalize strings, deduplicate)
    4. Save the cleaned output and generate a summary report
    

    Цэнтральная ідэя — парадоксальна адгукатыва. Агент завантажае весь тэкст файла SKILL.md толькі тады, калі вырашае, што гэты навык важны для тэкушчага заведамства. Пры запуске ён чытае толькі name і description з фронтматэру, што дапамагае захаваць чыстасцю вікна кантэксту.

    Калі навык не актываецца як планавалася, прычына па-большайшай частці крыўдзіцца ў яго фронтматэрскам description. Неабяжна зробіць яго болей конкрэтным ў паводзе з часам, калі навык павінен актывацца.

    Стварэнне стойкага агента

    Для прыменення ў рэальных умовах конфігурацыю стойкага агента можна зарэўструваць раз, юнак яе не трэба павтараць. API Agents стварае агента з іменем, у даным случае — з навыком чысткі дадзеных з паказванага раней раздзела.

    from google import genai
    
    client = genai.Client()
    
    # Register a reusable, named agent with the data-cleaner skill baked in
    agent = client.agents.create(
        id="my-csv-cleaner",
        base_agent="antigravity-preview-05-2026",
        system_instruction="You are a data quality engineer. Always use pandas for data manipulation. "
                           "Always generate a before/after summary showing what changed.",
        base_environment={
            "type": "remote",
            "sources": [
                {
                    "type": "inline",
                    "target": ".agents/AGENTS.md",
                    "content": (
                        "# Data Quality Agent\n\n"
                        "## Standards\n"
                        "- Never drop rows silently — log every removal with a reason\n"
                        "- Normalize all string columns to lowercase, stripped of whitespace\n"
                        "- Output cleaned files in UTF-8 CSV format\n"
                        "- Always print a summary table at the end\n"
                    )
                },
                {
                    "type": "inline",
                    "target": ".agents/skills/data-cleaner/SKILL.md",
                    "content": (
                        "---\n"
                        "name: data-cleaner\n"
                        "description: Use when the user needs to clean, normalize, or validate tabular data files.\n"
                        "---\n"
                        "# Data Cleaner\n\n"
                        "## When to Use\n"
                        "- User provides CSV, Excel, or JSON files that need cleaning\n"
                        "- Data has missing values, inconsistent formatting, or duplicate rows\n\n"
                        "## Steps\n"
                        "1. Load the data file using pandas\n"
                        "2. Profile the data: count nulls, duplicates, and type mismatches\n"
                        "3. Apply cleaning rules (fill nulls, normalize strings, deduplicate)\n"
                        "4. Save the cleaned output and generate a summary report\n"
                    )
                }
            ]
        }
    )
    
    print(f"Agent created with ID: {agent.id}")
    

    Калі запісаць гэты код як create_csv_cleaner_agent.py і запусціць яго, будзе створэны постаўны агент, які можна запрашваць па яго ID — my-csv-cleaner.

    Ён запрацюе, калі спачатку створыць файл CSV з навмысна заплямаванымі дакументамі кліяў пад назвай messy_customers.csv.

    name,email,phone,country
    John Smith,john@example.com,+14155551234,US
    jane doe, JANE@EXAMPLE.COM ,4155559999,
    John Smith,john@example.com,+14155551234,US
    Bob Wilson,bob@@invalid,+442071234567,
    María García,maria@test.com,+34612345678,Spain
      alice brown ,alice@example.com,,US
    Charlie Lee,charlie@test.com,+61412345678,AU
    jane doe,jane@example.com,+14155559999,
    

    Тады агента можна запускаць па ўпісе ID з любага месца ў прыёмніцы, выкарыстоўваючы скрыпт на кшталт run_csv_cleaner_agent.py.

    from google import genai
    
    client = genai.Client()
    
    # Read your local CSV file
    with open("messy_customers.csv", "r") as f:
        csv_content = f.read()
    
    # Inject the file into the sandbox and tell the agent to clean it
    interaction = client.interactions.create(
        agent="my-csv-cleaner",
        input="Clean the file at data/customers.csv. "
              "Remove duplicate rows by email (case-insensitive), "
              "standardize phone numbers to E.164 format, "
              "fill missing 'country' fields by looking up the phone country code, "
              "and flag any rows where the email format is invalid. "
              "Generate a before/after summary showing what changed.",
        environment={
            "type": "remote",
            "sources": [
                {
                    "type": "inline",
                    "target": "data/customers.csv",   # ← Path inside the sandbox
                    "content": csv_content             # ← Your local file contents
                }
            ]
        }
    )
    
    print(interaction.output_text)
    

    Масэв sources у тым скрыпце завантажвае файлы ў сандбокс яшчэ да пачатку працы агента. Для агента data/customers.csv — гэта проста звычайны файл у яго Linux-файлавойску, і ён не ведае, што файл быў перадан з локальнага камп’ютара. Можна вікорыстоўваць любы тып файла: CSV, JSON, XML, скрыпты на Python і канфігурацыйныя файлы.

    Заўважыце, што у інструкціях нічога не сказана пра pandas, UTF-8 чы правіла лагавання. Гэтыя дэталі ужо ў файлах AGENTS.md і SKILL.md, якія супроводзяюць агента, а канскрэйнер дадзеных запускаецца автаматычна, таму што тэкст задання падходзіць па своему description. Прыклад адработкі показаны ніжэй.

    I have successfully cleaned the customer dataset at `data/customers.csv` using Python and `pandas`.
    
    Below is a detailed report and before/after summary of the transformations applied.
    
    ---
    
    ### Summary of Transformations
    
    1. **whitespace Trimming:** Stripped all leading and trailing whitespace from both column names and text values (e.g., `  alice brown ` became `alice brown`).
    2. **Email Normalization & Validation:**
       - Converted all email addresses to lowercase and trimmed whitespace.
       - Added a new column `email_invalid` (boolean) to flag emails with an invalid format.
       - Identified `bob@@invalid` as an invalid format (due to a duplicate `@` symbol and lack of a top-level domain).
    3. **Phone Number Standardization:**
       - Standardized all valid phone numbers to the international **E.164** format using the `phonenumbers` library.
       - Converted `4155559999` (with a default US region fallback) to `+14155559999`.
       - Ignored the missing phone number for `alice brown` while leaving it empty.
    4. **Country Code Lookup:**
       - Looked up and populated missing `country` values based on the telephone country code prefix.
       - Filled `jane doe`'s country as `US` (derived from prefix `+1`).
       - Filled `Bob Wilson`'s country as `GB` (derived from prefix `+44`).
       - Kept existing valid country entries (e.g., `Spain`, `US`, `AU`) intact.
    5. **Deduplication:**
       - Removed duplicate rows by performing a case-insensitive match on the cleaned `email` column, keeping the first occurrence.
       - Safely removed the duplicate row for `john@example.com` (Row 3).
       - Safely removed the duplicate row for `jane@example.com` (Row 8).
    
    ---
    
    ### Before/After Summary
    
    #### 1. Data Quality Metrics
    
    | Metric | Before Clean | After Clean | Change Description |
    | :--- | :---: | :---: | :--- |
    | **Total Rows** | 8 | 6 | 2 duplicate rows were removed. |
    | **Duplicates Removed** | 0 | 2 | Dropped rows 3 (`john@example.com`) and 8 (`jane@example.com`). |
    | **Invalid Emails Flagged** | 0 | 1 | Flagged `bob@@invalid` as invalid (`email_invalid = True`). |
    | **Standardized Phone Numbers** | 1 | 5 | All numbers formatted to E.164 (e.g., `4155559999` -> `+14155559999`). |
    | **Filled Country Fields** | 5 | 6 | Filled 2 missing country values (`US` and `GB`) via phone prefix lookups. |
    
    #### 2. Row-by-Row Comparison
    
    Below is the row-by-row evolution from the raw file to the cleaned output:
    
    | Row # | Name (Before) | Name (After) | Email (Before) | Email (After) | Phone (Before) | Phone (After) | Country (Before) | Country (After) | Email Invalid Flag | Action Taken / Status |
    | :---: | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :--- | :---: | :--- |
    | **1** | `John Smith` | `John Smith` | `john@example.com` | `john@example.com` | `+14155551234` | `+14155551234` | `US` | `US` | `False` | Retained as first unique instance. |
    | **2** | `jane doe` | `jane doe` | ` JANE@EXAMPLE.COM ` | `jane@example.com` | `4155559999` | `+14155559999` | *Missing* | `US` | `False` | Email normalized; Phone formatted to E.164; Country populated from `+1` prefix. |
    | **3** | `John Smith` | — | `john@example.com` | — | `+14155551234` | — | `US` | — | — | **Removed** (Duplicate email). |
    | **4** | `Bob Wilson` | `Bob Wilson` | `bob@@invalid` | `bob@@invalid` | `+442071234567` | `+442071234567` | *Missing* | `GB` | `True` | Country populated from `+44` prefix; Email flagged as invalid. |
    | **5** | `María García` | `María García` | `maria@test.com` | `maria@test.com` | `+34612345678` | `+34612345678` | `Spain` | `Spain` | `False` | Retained; Email valid; Preserved existing country. |
    | **6** | `  alice brown ` | `alice brown` | `alice@example.com` | `alice@example.com` | *Missing* | *Missing* | `US` | `US` | `False` | Name whitespace stripped; Phone left empty; Preserved existing country. |
    | **7** | `Charlie Lee` | `Charlie Lee` | `charlie@test.com` | `charlie@test.com` | `+61412345678` | `+61412345678` | `AU` | `AU` | `False` | Retained; Email valid. |
    | **8** | `jane doe` | — | `jane@example.com` | — | `+14155559999` | — | *Missing* | — | — | **Removed** (Duplicate email). |
    
    ---
    
    ### Cleaned Dataset Output
    
    The cleaned data has been written back to `data/customers.csv` and contains the following records:
    
    ```csv
    name,email,phone,country,email_invalid
    John Smith,john@example.com,+14155551234,US,False
    jane doe,jane@example.com,+14155559999,US,False
    Bob Wilson,bob@@invalid,+442071234567,GB,True
    María García,maria@test.com,+34612345678,Spain,False
    alice brown,alice@example.com,,US,False
    Charlie Lee,charlie@test.com,+61412345678,AU,False
    ```
    

    Практычныя прыклады выкарыстання

    Калі база ужо створылася, калькольнікі паказвают, як усе гэта спрацоўвае разам, і кожны з яных дагаходзіць новых можлівасцей.

    Першы прыклад выкарыстання: рэфактораванне коду і практычэнне тэстаў

    Возьмім праект на Python з застарэлым кодам і тэстамі, якія не працуюць. Звычны LLM вяртае фрагменты коду, і распрацоўшчыку даводзіцца самому ўсё копіраваць, запускаць тэсты, налагоджваць і повторна працаваць. З Antigravity калькольнік клонуе код, запускае весь набор тэстаў, чытае памяткі пра адміністрацыю, выправляе код і знову запускае тэсты, паказваючы ці працавалі ўсе яны.

    У якосты цэлі выступае прыкладнай рэпазітарый з навмысна падмечанымі багамі. У яму ёсць тры бага, якія разам вызываюць шэсць невыпадков тэстаў:

    1. calculate_total() у файле utils.py вырабляе арыфметычныя вырахункі з роштам tax_rate, не ператвараючы яго ў чысло з паводлівае дзесяткавае раздзела.
  • normalize_name() у файлі utils.py выдаеўказы ўварабліваецьякадзе даданы None, таму ўжытаеў някіяя перавялікаецьякадзе зусеўныяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяя
  • from google import genai
    client = genai.Client()
    
    system_instructions = """
    You are an expert QA and Refactoring Engineer. Your workflow is:
    1. Clone the target repository into the workspace
    2. Install all dependencies from requirements.txt
    3. Run the full pytest suite and capture all output
    4. For each failing test:
       a. Read the error traceback carefully
       b. Open the source file causing the failure
       c. Diagnose the root cause
       d. Apply the minimal fix
    5. Re-run pytest after each fix to confirm resolution
    6. Continue until ALL tests pass (0 failures)
    7. Generate a summary of every change you made
    IMPORTANT: Make the minimal possible change to fix each test.
    Do not refactor working code unnecessarily.
    """
    interaction = client.interactions.create(
        agent="antigravity-preview-05-2026",
        system_instruction=system_instructions,
        input="""
        Clone this repository: https://github.com/rominirani/uc1-legacy-app
        Run the pytest suite to check for environment or code failures.
        Isolate the bugs causing test failures and fix them one by one.
        Keep running the tests until you achieve a 100% pass rate.
        When done, provide:
        1. A list of all files modified with a diff summary
        2. The final pytest output showing all tests passing
        3. Any dependency changes you had to make
        """,
        environment="remote"
    )
    print(interaction.output_text)
    

    Зберажыце яго як uc1_refactor.py і запусціце яго.

    python3 uc1_refactor.py
    

    Следуе прытаканы выхадны тэкст.

    I have successfully diagnosed and resolved all the issues causing test failures in the `uc1-legacy-app` repository. Below is a detailed summary of the findings, modifications, and the final test execution output.
    
    ---
    
    ### 1. Modified Files & Diff Summary
    
    #### File: `src/models.py`
    - **Issue**: In the `Invoice.summary()` method, the `self.total` method itself was passed to `format_currency()` as an object, instead of being invoked (`self.total()`). This led to a `TypeError` during format evaluation.
    - **Fix**: Changed `self.total` to `self.total()`.
    - **Diff Summary**:
    ```diff
    @@ -23,7 +23,7 @@ class Invoice:
    """Return a one-line summary of the invoice."""
    from src.utils import format_currency, normalize_name
    name = normalize_name(self.customer_name)
    -        return f"Invoice {self.invoice_id}: {name} - {format_currency(self.total)}"
    +        return f"Invoice {self.invoice_id}: {name} - {format_currency(self.total())}"
    ```
    
    #### File: `src/utils.py`
    - **Issues**:
    1. **`calculate_total()`**: When `tax_rate` is received as a string, Python fails to perform multiplication of float/string (`TypeError: can't multiply sequence by non-int of type 'float'`).
    2. **`normalize_name()`**: When passed a `None` value (common in CSV imports), the code raised `AttributeError: 'NoneType' object has no attribute 'strip'`.
    - **Fixes**:
    1. Explicitly cast `subtotal` and `tax_rate` to `float` prior to calculating the tax.
    2. Add a safeguard to return an empty string (`""`) when `name` is `None`.
    - **Diff Summary**:
    ```diff
    @@ -11,8 +11,10 @@ def calculate_total(subtotal, tax_rate):
    Returns:
    The total as a float rounded to 2 decimal places.
    """
    -    tax = subtotal * tax_rate / 100
    -    return round(subtotal + tax, 2)
    +    subtotal_val = float(subtotal)
    +    tax_rate_val = float(tax_rate)
    +    tax = subtotal_val * tax_rate_val / 100
    +    return round(subtotal_val + tax, 2)
    
    def format_currency(amount):
    @@ -36,6 +38,8 @@ def normalize_name(name):
    Returns:
    Cleaned, title-cased name.
    """
    +    if name is None:
    +        return ""
    return name.strip().title()
    ```
    
    ---
    
    ### 2. Dependency Changes
    No additional packages or dependency changes were made. All required libraries from `requirements.txt` (consisting of `pytest>=7.0.0`) were successfully installed and utilized without modification.
    
    ---
    
    ### 3. Final Pytest Output
    Running the full suite confirms that all 10 tests now pass:
    
    ```
    ============================= test session starts ==============================
    platform linux -- Python 3.12.3, pytest-9.0.3, pluggy-1.6.0
    rootdir: /uc1-legacy-app
    plugins: anyio-4.13.0
    collected 10 items
    
    tests/test_models.py ....                                                [ 40% ]
    tests/test_utils.py ......                                               [100% ]
    
    ============================== 10 passed in 0.02s ==============================
    ```
    

    Без жаднай падтрымкі агент:

    1. заўодзі git clone у тэрмінале сандбокса
    2. заўодзі pip install -r requirements.txt у Python сандбокса
    3. заўодзі pytest -v і чытае весь выход, укладаючы ў тое ж таксама трэйсбекі
    4. атварае файлы-выкананнікі і знаходзі несправную логіку
    5. пішае патчы, зберагае файлы і зноў заўодзі pytest
    6. павтарае практыку пакуль у выходзе не будзе ноль несправнасцей

    Гэта ўпрабоўваны цыкл план, дзеянне, абсервацыя. Агент не проста стварае код. Ён яго выкананяе, чытае рэальны выход з тэрмінала і сам сябе пасправляе.

    Другі варыянт прыменення: конкурэнцыйскі аналіз

    Калі кампанія выкарыстоўваець неабходна ўсесторонняй конкурэнтны аналіз продуктаў-канкурантав. Ручны збір інформацыі ёсць клопатны, а стацыярныя засобы для гэтага постаянна ламаюцца. У такім случыку агент выкарыстоўвае інструменты для перэгляду веб-сайтаў, ён праходзіць па сайтах канкурантав, справляецца з рознымі макетамі сторанак, пішае савой скрыпт на мове pandas для арганізацыі дадзэнняў і экспортуе готовую табылку.

    from google import genai
    client = genai.Client()
    
    system_instructions = """
    You are a precise Business Intelligence Analyst. Your workflow:
    1. Use web search to find current, real-time information
    2. Navigate to official product/pricing pages for each competitor
    3. Extract: pricing tiers, key features, target audience, notable limitations
    4. Structure ALL findings into a pandas DataFrame
    5. Export to both CSV and a formatted Markdown comparison table
    6. Include the date/time of research and source URLs for every data point
    Rules:
    - Only report data you can verify from official sources
    - If pricing isn't publicly available, note "Contact Sales" - don't guess
    - Use USD for all pricing normalization
    """
    interaction = client.interactions.create(
        agent="antigravity-preview-05-2026",
        system_instruction=system_instructions,
        input="""
        Research the pricing models and core feature matrices of the top 3 alternative
        platforms to Vercel for frontend deployment:
        1. Netlify
        2. Cloudflare Pages
        3. Cloud Run
        For each, extract:
        - Free tier limits (bandwidth, builds, sites)
        - Pro/paid tier pricing and what it unlocks
        - Key differentiating features
        - Notable limitations or complaints from developer communities
        Create:
        1. A competitive_matrix.csv spreadsheet with all data
        2. A competitive_analysis.md report with a formatted comparison table
           and a "Recommendation" section at the bottom
        """,
        environment="remote"
    )
    print(interaction.output_text)
    

    Ён стварае гэты апаведак.

    As a Business Intelligence Analyst, I have conducted a precise competitive analysis of the top three frontend deployment alternatives to Vercel: **Netlify**, **Cloudflare Pages**, and **Google Cloud Run**.
    
    All findings have been structured using `pandas` and exported to `/` (the current working directory) as:
    1. `competitive_matrix.csv` — The raw, structured dataset.
    2. `competitive_analysis.md` — A comprehensive, reader-ready report including a detailed markdown comparison matrix, architectural breakdowns, limitation analyses, and a tailored recommendation framework.
    
    All data has been verified against official vendor pricing, product, and developer documentation as of **June 9, 2026**. All currency values are normalized in **USD**.
    
    ---
    
    ### Core Finding Highlights
    
    #### 1. Netlify
    * **The Architectural Shift (April 2026):** Netlify made a massive strategic update to its Pro plans, moving from a seat-based model ($19/member/month) to a **flat $20/month per organization** [10]. This includes unlimited team members (Owners, Developers, Reviewers, and Git Contributors) [10], which is highly disruptive compared to Vercel's strict per-seat billing.
    * **The Credits Trap:** Usage is now managed entirely via a unified credit-based model (300 credits/mo free, 3,000 on Pro) [2, 10]. However, credits are consumed fast: bandwidth costs 20 credits per GB [2, 10] (meaning Free tier is only **~15 GB max** and Pro is only **~150 GB max** if solely used for traffic). If Free tier credits run out, **all site traffic pauses immediately** (no auto-recharge is supported on Free) [2, 11].
    * **Capabilities:** Highly integrated features like Netlify Database (managed Postgres via Neon) [4], Blob storage, Forms, and Auth [10]. Serverless timeout is 10s on Free/Personal [2] and 26s on Pro [2].
    
    #### 2. Cloudflare Pages
    * **Unmetered Freedom:** Genuinely **unlimited and unmetered static bandwidth and requests** across all tiers (including the $0 Free tier) [24, 25, 27].
    * **The Pro Tier ($20/mo billed annually / $25/mo monthly):** Tied directly to Cloudflare's Workers Paid plan [25, 27]. It increases build limits from 500/mo to 5,000/mo, concurrent builds from 1 to 5, and the file-count ceiling per project from 20,000 to 100,000 assets [31] (unlocked via the `PAGES_WRANGLER_MAJOR_VERSION=4` env variable) [31].
    * **Edge Isolates Constraints:** While running serverless code on Cloudflare's global network of 310+ cities is blazingly fast with zero cold starts [24, 33], it uses a **strict V8 edge runtime** [24]. Standard Node.js library modules (`fs`, `path`, native `crypto`) do not run natively [24], forcing developers to compile meta-frameworks like Next.js via edge adapters (e.g., `@cloudflare/next-on-pages` or OpenNext) [24] which restricts certain features like Incremental Static Regeneration (ISR).
    
    #### 3. Google Cloud Run
    * **Pure Container Portability:** Cloud Run runs any application, language, or compiled binary (Node.js, Python, Go, Rust) packaged in a standard Docker container [37, 39]. It runs full Node.js natively [39], ensuring 100% Next.js feature parity (ISR, Server Actions, dynamic image optimization) with zero edge-runtime workarounds [39].
    * **No Monthly Base Fee:** Operates on a pure pay-as-you-go serverless model (billed in granular vCPU-seconds and GiB-seconds) [41], backed by a generous Always Free tier (2 million requests/mo, 180,000 vCPU-seconds, 360,000 GiB-seconds, and 120 daily Cloud Build minutes free) [37, 38, 41].
    * **The Infrastructure Overhead:** Not a standard "push-to-deploy" platform. Developers must write Dockerfiles, configure Artifact Registry, and manage IAM and networking [37, 39]. It is regionally hosted; to get a global CDN with SSL mapping, you must set up Cloud CDN and a Global HTTP Load Balancer [37] (~$20-$30/mo base fee) and navigate container cold starts (2 to 10+ seconds) [37] and expensive internet egress rates ($0.085 - $0.12 per GB) [37].
    
    ---
    
    ### Structure of Generated Files
    
    #### 1. `competitive_matrix.csv`
    A raw, tabular CSV structured for business intelligence pipelines, featuring the following schema:
    - `Platform Name`
    - `Free Tier Pricing (USD)`
    - `Free Tier Bandwidth Limit`
    - `Free Tier Build Limit`
    - `Free Tier Sites/Projects Limit`
    - `Free Tier Key Specs & Features`
    - `Paid/Pro Tier Price (USD)`
    - `Paid/Pro Tier Features Unlocked`
    - `Key Differentiating Features`
    - `Notable Limitations & Developer Complaints`
    - `Date of Research`
    - `Source URLs`
    
    #### 2. `competitive_analysis.md`
    A professionally formatted report including:
    * **Executive Summary:** Contextualizing why frontend teams are exploring alternatives to Vercel in 2026.
    * **Structured Comparison Table:** Transposed for high-density reading and side-by-side comparison.
    * **Deep-Dive Section:** Dedicated analyses of the Free limits, paid features, unique differentiators, and community complaints for Netlify, Cloudflare Pages, and Google Cloud Run.
    * **Architectural Recommendation Flowchart & Matrix:** Tailored decision pathways based on project profile:
      * *Static / JAMstack / Zero-Budget* $\rightarrow$ **Cloudflare Pages**
      * *Collaborative Teams / Rapid Prototyping / Seat-Free DX* $\rightarrow$ **Netlify**
      * *Complex Server-Side Rendering / Backend Pipelines / Custom Docker* $\rightarrow$ **Google Cloud Run**
    
    ---
    
    ### Source Verification & Citations
    
    1. **Netlify:**
       - [Official Pricing & Plans](https://www.netlify.com/pricing/)
       - [Introducing Seat-Free Collaborative Billing (April 14, 2026)](https://www.netlify.com/blog/pricing-netlify-for-3-billion-builders/)
       - [Credit-Based Pricing Documentation](https://docs.netlify.com/manage/accounts-and-billing/billing/billing-for-credit-based-plans/credit-based-pricing-plans/)
       - [Netlify Free Tier Credit Analysis (Temps)](https://temps.sh/compare/vs-netlify)
    
    2. **Cloudflare Pages:**
       - [Workers & Pages Pricing Matrix](https://www.cloudflare.com/plans/developer-platform/)
       - [Official Pages Limits Documentation](https://developers.cloudflare.com/pages/platform/limits/)
       - [Cloudflare Pages Platform Features](https://pages.cloudflare.com/)
       - [Cloudflare Pages Edge Limitations (Temps)](https://temps.sh/compare/vs-cloudflare-pages)
    
    3. **Google Cloud Run:**
       - [Official Cloud Run Pricing Breakdown](https://cloud.google.com/run/pricing)
       - [Google Cloud Free Tier Inclusions](https://cloud.google.com/free)
       - [Cloud Run Quotas & Limits](https://docs.cloud.google.com/run/quotas)
       - [Cloud Run Cost Optimization & Egress Guide (Cloudchipr)](https://cloudchipr.com/blog/cloud-run-pricing)
    
    The generated files are saved directly in your working directory and are immediately available for download or integration into your reporting pipelines. Let me know if you would like me to modify the analysis parameters or explore a specific platform further!
    

    Далейшая праця можа выкарыстоўваць пярэднюе сераўака і абмен, беручы створаны файл competitive_matrix.csv і ператвараючы яго ў візуалізацыю. Код падаўна выявляе толькі тэкстовую адпаведзь, але метод завантажэння, паказаны раней, можа выявіць створаныя файлы з сандбокса.

    # Follow-up: generate a visual chart from the data we just collected
    interaction_2 = client.interactions.create(
        agent="antigravity-preview-05-2026",
        environment=interaction.environment_id,
        previous_interaction_id=interaction.id,
        input="""
        Using the competitive_matrix.csv you just created:
        1. Create a grouped bar chart comparing the free tier limits across all 3 platforms
        2. Create a pricing comparison chart for the paid tiers
        3. Save both charts as PNG files with clear labels and a professional color scheme
        4. Add the charts as embedded images in the competitive_analysis.md report
        """
    )
    print(interaction_2.output_text)
    

    Канцэпцыя тут — перэгляд веб-сторонак у сувязі з выкананнем коду у адной задачы. Агент шукае інфармацыю ў рэальнай інтэрнэт-сеткі, а пасля запісвае код на Python, каб структураваць і візуалізаваць знайдзеное, усё гэта в аднам потоку.

    Шаблоны, якія працуюць у практычных умовах

    Готавьцеся да перабудовы. Рэзультаты працы мадэляў шыбкаа падыгваюць, таму праектуйце агентывы, прыпускаючы, што іх скора будзе перабудаваць на новыя мадэлі. Храніце конфігурацыю у модульнай форме, адколькі файлы AGENTS.md і SKILL.md лёгкая заменіць, і не перэкладвайце слою оркестрацыі занадта складная структуру.

    Раздзяліце вялікія агентывы. Утрымвайцеся ад аднаг вялікаг агента з сістэмным запрошэнням дужо длігага — 2000 слоў. Разбівайце складныя задачы на спецыялізаваныя падагентывы.

    Спрытваецеяце бягі каля дадзеных, а не каля збоёў. У правільных дызайнах агента бягі ёсць даныя, якія агент выкарыстоўвае для аналізу і парадкавання. Агент чытае TypeError, аналізуе прычыну і яе парадкавае. Адмовіцеся ад універсальных блакоў try/except, якія маскуюць бягі, і дазвольце агенту іх бачыць.

    Вярніцеся да eval-аў заместо тэстаў на елементы. Паведанне агента не ёсць дэтэрміністычным, таму тэставанне павінна сфокусавацца на метрыках ацэнкі, а не на точным падабенстве выходных даных.

    # ❌ Don't: Assert exact output
    assert agent_output == "The answer is 42"
    
    # ✅ Do: Evaluate behavioral success rate
    results = [run_agent(task) for _ in range(20)]
    success_rate = sum(1 for r in results if r.meets_criteria) / len(results)
    assert success_rate >= 0.85  # Agent succeeds at least 85% of the time
    

    Склад косту токена. Усёлькі ўпрацоўнік працуе за прынцыпам автонамнага расумавання, адно запітванне можа запусціць многа внутраніяе аперацыі, таму косzt за заданне сутэльна разніцяецца. У гэтай таблыце даўаецца апрыксамная інфармацыя.

    Пад час разработкі выкарыстоўваюць строгія тайма-ауты і сочачы за дужынай логу, а таксама выкарыстоўваюць system_instruction, каб папросіць упрацоўнік быць канкрэтным, калі не патрабуецца дзялёнае расумаванне.

    Плануйце на выключэнне. Шаблоны адрабаткі памілак для частых сцэнарыяў выключэння падсумаваны тут.

    Як гэта працуе занутра

    Калькі механізмы адказваюць за вышэўшае паведанне:

    • Адна вызовка API, interactions.create(), запускае цыкл оркестрацыі на станцыі сервера. Модэль Gemini Flash продаважвае расумаванне, выбірае інструменты, запускае код і пераглядае рэзультаты, пакуль заданне не будзе завершанае.
  • Кожная взаімадзея працюе ў сваёй адскаляронай контэйнеры Ubuntu, настроеный з 4 vCPUs і 16 GB RAM, дзе модэль можа інсталаваць пакеты, запускаць скрыпты і карбаваць файлы.
  • Перадача вярнутага environment_id у пасляўныя вызовы дапамагае зберагчы файлы і стан праз разныя крокі, чым утрымліваеся стварэнне новай «песочніцы» ў кожны раз.
  • Калі настройкі агента стаюць стабільнымі, уключаючы яго сістэмныя інструкцыі і навыкі, базаваныя на файлах, яны можна застаўіць назаўсёды за дапамогою client.agents.create() і запускаць ў будзь-ям месцы па ID.
  • Ідэі для наступнага агента

    • Агент CI/CD, які сочыць за рэпазітарыем GitHub, запускае тэсты пасля кожнага аплікавання змян і стварае прыказы для выправлення бракоў
    • Генератор дакументацыі, які чытае кодавую базу і пішаў цяплую дакументацыю API
    • Оркестрайтар пайплайна дадзеных, які праеўваеся да хранілішча, выконвае трансфармацыі і пераканальвае выходныя даны
    • Агент для сортавання запытаў падтрымкі, які чытае запыты, ацэнюе ўжоўважнасць проблемы, прадаеяўае адпаведзі і перадае крытычныя запыты на вышэйшы ранг
    • Памагчык у даследжэннях, які берае тэму, шукае статыі і артыкулы, і прадаеяўае аптаку літаратуры з цітатамі

    Што зменшыцца

    Управляемыя агенты зменяюць спосаб стварэння ШЫ. Разрабоцкі прыпыняюць стварэнне інфраструктуры навакола мадэлі і проста задаюць ёй мету і сэрвіс для працы. Сэрвіс для працы ёсць абстракцыяю, цыкл дзеяння агента яго керуе, а API для взаімадзейства ёсць едынным пунктом входу. Розумны спосаб пачатку — з малага, з чысткімі мерамі ўжоўважнасці ў тым, што агент можа рабіць без нагляду, а пасля — расшырваць.