Add gRPC Streaming for Harness interface and integration#34
Open
anj-s wants to merge 18 commits into
Open
Conversation
…ntric design This PR implements the integration of the Antigravity agent as the first built-in harness in AX Controller V2, satisfying the first item on the AX roadmap. It also refactors the architecture to make `Registry` the Single Source of Truth (SSOT) and introduces robust fallback mechanisms. ### Goals 1. **Built-in Harness Integration**: Enable AX Controller V2 to execute Python-based Antigravity agents. 2. **Registry-Centric Architecture (SSOT)**: Centralize the management of both agents and harnesses in the `Registry`. 3. **Inverted Control (Dependency Injection)**: Decouple the `Controller` from harness creation by passing `Registry` as an input config. 4. **Resilient Fallbacks**: Implement build-time (script check) and runtime (registration check) fallbacks to a Test Harness to prevent failures in unconfigured environments. 5. **End-to-End Verification**: Provide a comprehensive E2E demonstration script. ### Key Changes - **Registry Updates (`internal/controller2/registry.go`)**: Added support for registering and retrieving Go `Harness` instances in `Registry`. - **Controller V2 Refactoring (`internal/controller2/controller.go`)**: - Received `Registry` as an input config in `New`. - Updated `Exec` to retrieve the harness from the registry using `AgentId` at runtime, falling back to the test harness if not found. - **Antigravity Go Harness (`internal/harness/antigravity.go`)**: - Implemented `AntigravityHarness` which executes the Python agent as a subprocess, passing the prompt as an argument. - Captured stdout and returned it as a streamed message. - Added a TODO to migrate to a gRPC server in the next step to avoid subprocess overhead. - **Python Agent Modification (`examples/antigravity_agent/agent.py`)**: Modified the script to accept dynamic prompt inputs from command line arguments. - **Verification (`internal/controller2/controller_test.go`, `fork_test.go`, `e2e.go`)**: - Updated unit tests to adapt to the new `Registry` injection. - Added unit tests for both build-time (implemented manually in test setup) and runtime fallbacks. - Created `e2e.go` in the root to demonstrate all 3 execution paths (Runtime Fallback, Build-time Fallback, and actual Antigravity Happy Path).
Move the Google Antigravity SDK integration from a one-off subprocess to an always-on, stateful WebSocket streaming harness protocol. - Python WebSocket Server (harness_server.py): Exposes a /ws endpoint wrapping google-antigravity SDK, hydrates event log history, and streams thought/text delta frames over WebSockets. - Go Harness Client (antigravity.go): Refactored client to connect over gorilla/websocket and stream output callbacks (OnMessage/OnComplete). - Unit Tests: Implemented robust unit test suites in both Go and Python. - Verification: Created hack/run-antigravity-streaming.sh for E2E verification. TAG=agy CONV=ae7297af-6274-4477-81b3-a5eb53abb0e1
…reaming to console
…lConnectionStrategy API
…imate agent.py example
…C AgentService protocol
…ingle-turn subprocess execution turn compatibility
…istry consolidation
rakyll
approved these changes
Jun 1, 2026
| fmt.Printf("WARNING: python3 not found, falling back to test harness: %v\n", err) | ||
| badHarness = harnesstest.New() | ||
| } else if _, err := os.Stat(scriptPath); err != nil { | ||
| if _, err := os.Stat(scriptPath); err != nil { |
|
|
||
| # 6. Stream semantic chunks (Thoughts, Text, and ToolCalls) in real-time | ||
| async for chunk in response.chunks: | ||
| if isinstance(chunk, Text): |
Member
There was a problem hiding this comment.
Feel free to use a more structured format like JSONL.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add stateful gRPC streaming input/output and streaming AGY example.
1. AX V2 Controller Integration (Registry-Centric Design)
internal/controller2containing the new single-writer orchestrator.harness.Harnessandharness.Executioninterfaces to abstract agent sandboxing and execution pipelines.2. Antigravity gRPC Streaming Harness (
internal/harness/antigravity.go)AgentRequest, and streams output callbacks directly to V2.3. Python gRPC Harness Server (
python/antigravity/harness_server.py)pb.AgentServiceand usinggrpc.aio.server().AgentResponseframes (thoughts, text, tool calls).NOTE ON ARCHITECTUREdocumenting the generic loader design whereharness_server.pydynamically imports agent files (defaulting toagent.py) using--agent_fileflags to provide clean L1/L2 SDK boundary decoupling.4. Python Agent Scaffolding (
examples/antigravity_agent/agent.py)get_weather), model identity, and persona configuration.NOTE ON ARCHITECTUREexplaining how this file acts as both a standalone L2 CLI debugging tool and a declarative config module imported byharness_server.py.5. E2E Setup & Running Instructions (
cmd/e2e/main.go)cmd/e2e/main.go).cmd/e2e/main.godocumenting how to start the Python server (with properPYTHONPATHto bypass python path collisions) and drive the Go client demonstration.6. Test Coverage & Verification
internal/harness/antigravity_test.go(Mock gRPC server, Passed).internal/controller2and other modules (All Passed).python/antigravity/harness_server_test.py(Mock async gRPC stub client, Passed).