-
Notifications
You must be signed in to change notification settings - Fork 32
Wire Antigravity CLI as a first-class agent type #1194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| FROM ubuntu:24.04 | ||
|
|
||
| ARG GO_VERSION=1.25.0 | ||
|
|
||
| RUN apt-get update && apt-get install -y \ | ||
| make \ | ||
| curl \ | ||
| ca-certificates \ | ||
| git \ | ||
| && curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \ | ||
| && apt-get install -y nodejs \ | ||
| && curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg \ | ||
| -o /usr/share/keyrings/githubcli-archive-keyring.gpg \ | ||
| && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" \ | ||
| > /etc/apt/sources.list.d/github-cli.list \ | ||
| && apt-get update \ | ||
| && apt-get install -y gh \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN ARCH=$(dpkg --print-architecture) \ | ||
| && TARBALL="go${GO_VERSION}.linux-${ARCH}.tar.gz" \ | ||
| && curl -fsSL -o "/tmp/${TARBALL}" "https://dl.google.com/go/${TARBALL}" \ | ||
| && curl -fsSL -o "/tmp/${TARBALL}.sha256" "https://dl.google.com/go/${TARBALL}.sha256" \ | ||
| && echo "$(cat /tmp/${TARBALL}.sha256) /tmp/${TARBALL}" | sha256sum -c - \ | ||
| && tar -C /usr/local -xzf "/tmp/${TARBALL}" \ | ||
| && rm "/tmp/${TARBALL}" "/tmp/${TARBALL}.sha256" | ||
|
|
||
| ENV PATH="/usr/local/go/bin:${PATH}" | ||
|
|
||
| COPY antigravity/kelos_entrypoint.sh /kelos_entrypoint.sh | ||
| RUN chmod +x /kelos_entrypoint.sh | ||
|
|
||
| ARG TARGETARCH | ||
| COPY bin/kelos-capture-linux-${TARGETARCH} /kelos/kelos-capture | ||
|
|
||
| RUN useradd -u 61100 -m -s /bin/bash agent | ||
| RUN mkdir -p /home/agent/.config/agy /home/agent/.local/bin && chown -R agent:agent /home/agent | ||
|
|
||
| USER agent | ||
|
|
||
| RUN curl -fsSL https://antigravity.google/cli/install.sh -o /tmp/install-agy.sh \ | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] |
||
| && bash /tmp/install-agy.sh \ | ||
| && rm /tmp/install-agy.sh | ||
|
|
||
| ENV GOPATH="/home/agent/go" | ||
| ENV PATH="/home/agent/.local/bin:${GOPATH}/bin:${PATH}" | ||
|
|
||
| WORKDIR /workspace | ||
|
|
||
| ENTRYPOINT ["agy"] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| #!/bin/bash | ||
| # kelos_entrypoint.sh — Kelos agent image interface implementation for | ||
| # Google Antigravity CLI (agy). | ||
| # | ||
| # Interface contract: | ||
| # - First argument ($1): the task prompt | ||
| # - KELOS_MODEL env var: model name (optional) | ||
| # - KELOS_AGENTS_MD env var: user-level instructions (optional) | ||
| # - UID 61100: shared between git-clone init container and agent | ||
| # - Working directory: /workspace/repo when a workspace is configured | ||
| # | ||
| # Credentials: the controller does not inject built-in credential env vars | ||
| # for this agent type (Task.spec.credentials.type must be "none"). Operators | ||
| # who need authenticated runs supply credentials via Task.spec.podOverrides.env | ||
| # using whatever variable the agy binary expects. | ||
|
|
||
| set -uo pipefail | ||
|
|
||
| PROMPT="${1:?Prompt argument is required}" | ||
|
|
||
| ARGS=( | ||
| "--print" | ||
| "--output-format" "stream-json" | ||
| ) | ||
|
|
||
| if [ -n "${KELOS_MODEL:-}" ]; then | ||
| ARGS+=("--model" "$KELOS_MODEL") | ||
| fi | ||
|
|
||
| ARGS+=("$PROMPT") | ||
|
|
||
| # Write user-level instructions (global scope read by Antigravity CLI). | ||
| if [ -n "${KELOS_AGENTS_MD:-}" ]; then | ||
| mkdir -p ~/.config/agy | ||
| printf '%s' "$KELOS_AGENTS_MD" >~/.config/agy/AGENTS.md | ||
| fi | ||
|
|
||
| # Run pre-agent setup command if configured. KELOS_SETUP_COMMAND is the | ||
| # JSON-encoded exec-form array from Workspace.spec.setupCommand. A non-zero | ||
| # exit aborts the task before the agent starts. | ||
| if [ -n "${KELOS_SETUP_COMMAND:-}" ]; then | ||
| printf '\n---KELOS_SETUP_COMMAND_START---\n' >&2 | ||
| node -e ' | ||
| const { spawnSync } = require("child_process"); | ||
| const cmd = JSON.parse(process.env.KELOS_SETUP_COMMAND); | ||
| if (!Array.isArray(cmd) || cmd.length === 0 || cmd.some(a => typeof a !== "string")) { | ||
| console.error("KELOS_SETUP_COMMAND must be a non-empty JSON array of strings"); | ||
| process.exit(2); | ||
| } | ||
| const r = spawnSync(cmd[0], cmd.slice(1), { stdio: "inherit" }); | ||
| if (r.error) { console.error(r.error.message); process.exit(127); } | ||
| process.exit(r.status ?? 1); | ||
| ' | ||
| SETUP_EXIT_CODE=$? | ||
| if [ "$SETUP_EXIT_CODE" -ne 0 ]; then | ||
| printf '\n---KELOS_SETUP_COMMAND_FAILED--- exit=%s\n' "$SETUP_EXIT_CODE" >&2 | ||
| exit "$SETUP_EXIT_CODE" | ||
| fi | ||
| printf '\n---KELOS_SETUP_COMMAND_DONE---\n' >&2 | ||
| fi | ||
|
|
||
| agy "${ARGS[@]}" | tee /tmp/agent-output.jsonl | ||
| AGENT_EXIT_CODE=${PIPESTATUS[0]} | ||
|
|
||
| /kelos/kelos-capture | ||
|
|
||
| exit $AGENT_EXIT_CODE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P2: The
agyinstall step is unpinned, so rebuilds can silently pick up new upstream versions and produce non-reproducible images.(Based on your team's feedback about avoiding silently changing external versions or licenses.)
View Feedback
Prompt for AI agents