Skip to content

armgit / ax

Public Imported from GitHub
0

Agent Executor (AX) is Google's open agentic orchestration runtime

Go

Pass harness config through the incoming request (#193)

Junjie Wangfa2a34588eb1
diff --git a/cmd/ax/exec.go b/cmd/ax/exec.go
index 4725ca6..67878d2 100644
--- a/cmd/ax/exec.go
+++ b/cmd/ax/exec.go
@@ -34,13 +34,15 @@ import (
)
var (
- execConversationID string
- execAgentID string
- execInput string
- execServerAddr string
- execConfigFile string
- execResume bool // allow resuming an execution without inputs
- execLastSeq int32
+ execConversationID string
+ execHarnessID string
+ execHarnessConfig string
+ execHarnessConfigJSON string
+ execInput string
+ execServerAddr string
+ execConfigFile string
+ execResume bool // allow resuming an execution without inputs
+ execLastSeq int32
)
var execCmd = &cobra.Command{
@@ -54,13 +56,16 @@ If no conversation ID is provided, a new UUID will be generated.`,
func init() {
execCmd.Flags().StringVar(&execConversationID, "conversation", "", "Conversation ID (optional, generates UUID if not provided)")
- execCmd.Flags().StringVar(&execAgentID, "agent", "", "Agent ID (optional, planner is used if not specified)")
+ execCmd.Flags().StringVar(&execHarnessID, "harness", "", "Harness ID (optional, default harness is used if not specified)")
+ execCmd.Flags().StringVar(&execHarnessConfig, "harness-config", "", "Path to a JSON file with per-request harness configuration")
+ execCmd.Flags().StringVar(&execHarnessConfigJSON, "harness-config-json", "", "Per-request harness configuration as an inline JSON string (mutually exclusive with --harness-config)")
execCmd.Flags().StringVar(&execInput, "input", "", "Input message to send (optional)")
execCmd.Flags().StringVar(&execServerAddr, "server", "", "gRPC controller server address (if specified, connects to remote server; otherwise runs with a local built-in AX server)")
execCmd.Flags().StringVar(&execConfigFile, "config", "ax.yaml", "Path to YAML configuration file (only used with a local built-in AX server)")
execCmd.Flags().BoolVar(&execResume, "resume", false, "Resume a conversation without inputs")
execCmd.Flags().Int32Var(&execLastSeq, "last-seq", 0, "Last sequence number seen by the client")
execCmd.MarkFlagsMutuallyExclusive("input", "resume")
+ execCmd.MarkFlagsMutuallyExclusive("harness-config", "harness-config-json")
}
// TODO(jbd): Add multimodal input flags, e.g. --input-image.
@@ -118,10 +123,21 @@ func runExec(cmd *cobra.Command, args []string) error {
execController = c
}
- return execLoop(ctx, execConversationID, execAgentID, execInput, execLastSeq)
+ var harnessConfig []byte
+ if execHarnessConfig != "" {
+ b, err := os.ReadFile(execHarnessConfig)
+ if err != nil {
+ return fmt.Errorf("failed to read harness config %q: %w", execHarnessConfig, err)
+ }
+ harnessConfig = b
+ } else if execHarnessConfigJSON != "" {
+ harnessConfig = []byte(execHarnessConfigJSON)
+ }
+
+ return execLoop(ctx, execConversationID, execHarnessID, harnessConfig, execInput, execLastSeq)
}
-func execLoop(ctx context.Context, id string, agentID string, input string, lastSeq int32) error {
+func execLoop(ctx context.Context, id string, harnessID string, harnessConfig []byte, input string, lastSeq int32) error {
d := internal.NewDisplay(id, os.Stdout)
d.DisplayHeader()
@@ -156,7 +172,8 @@ func execLoop(ctx context.Context, id string, agentID string, input string, last
conf, err := runAutoExec(reqCtx, d, &proto.ExecRequest{
ConversationId: id,
- AgentId: agentID,
+ HarnessId: harnessID,
+ HarnessConfig: harnessConfig,
Inputs: inputs,
LastSeq: lastSeq,
})
@@ -169,7 +186,6 @@ func execLoop(ctx context.Context, id string, agentID string, input string, last
if errors.Is(err, context.Canceled) {
fmt.Println("Request canceled.")
inputs = nil
- agentID = ""
continue
}
return err
@@ -223,7 +239,8 @@ func execLoop(ctx context.Context, id string, agentID string, input string, last
conf, err = runAutoExec(reqCtx, d, &proto.ExecRequest{
ConversationId: id,
- AgentId: agentID,
+ HarnessId: harnessID,
+ HarnessConfig: harnessConfig,
Inputs: decision,
})
diff --git a/cmd/e2e/main.go b/cmd/e2e/main.go
index 9ea5da3..1a09330 100644
--- a/cmd/e2e/main.go
+++ b/cmd/e2e/main.go
@@ -18,13 +18,14 @@
// TO RUN THIS E2E DEMONSTRATION:
//
// Step 1: Start the Python gRPC Harness Server (in a separate terminal or background):
-// PYTHONPATH=python:. /Users/anjalisridhar/.gemini/jetski/worktrees/harness-interface-3/implement-agy-sdk-streaming-20260528/.venv/bin/python python/antigravity/harness_server.py --port 50053
+//
+// PYTHONPATH=python:. /Users/anjalisridhar/.gemini/jetski/worktrees/harness-interface-3/implement-agy-sdk-streaming-20260528/.venv/bin/python python/antigravity/harness_server.py --port 50053
//
// Step 2: Run this Go E2E client:
-// go run cmd/e2e/main.go
+//
+// go run cmd/e2e/main.go
package main
-
import (
"context"
"fmt"
@@ -78,7 +79,7 @@ func main() {
})
}
-func runDemo(ctx context.Context, agentID string, setupRegistry func(reg *controller.Registry)) {
+func runDemo(ctx context.Context, harnessID string, setupRegistry func(reg *controller.Registry)) {
reg := controller.NewRegistry()
setupRegistry(reg)
@@ -120,7 +121,7 @@ func runDemo(ctx context.Context, agentID string, setupRegistry func(reg *contro
err = c.Exec(ctx, &proto.ExecRequest{
ConversationId: "e2e-conv",
Inputs: inputs,
- AgentId: agentID,
+ HarnessId: harnessID,
}, handler)
if err != nil {
diff --git a/internal/controller/controller.go b/internal/controller/controller.go
index 3614f32..1537ce4 100644
--- a/internal/controller/controller.go
+++ b/internal/controller/controller.go
@@ -23,6 +23,8 @@ import (
"github.com/google/ax/internal/controller/eventlog"
"github.com/google/ax/proto"
+ "google.golang.org/protobuf/encoding/protojson"
+ "google.golang.org/protobuf/types/known/structpb"
)
type ExecHandler func(resp *proto.ExecResponse) error
@@ -71,12 +73,12 @@ func (d *Controller) Exec(ctx context.Context, req *proto.ExecRequest, handler E
// TODO(jbd): Enable bringing a remote harness that implements HarnessService.
// TODO(anj): We need to consolidate agents and harness registration.
// Adding harness registration support temporarily.
- h, err := d.registry.Harness(req.AgentId)
+ h, err := d.registry.Harness(req.HarnessId)
if err != nil {
- return fmt.Errorf("failed to get harness for agent %q: %w", req.AgentId, err)
+ return fmt.Errorf("failed to get harness %q: %w", req.HarnessId, err)
}
- l := newLogger(d.eventLog, req.ConversationId, req.AgentId)
+ l := newLogger(d.eventLog, req.ConversationId, req.HarnessId)
state, err := l.ResumptionState(ctx)
if err != nil {
return fmt.Errorf("failed to check resumption state: %w", err)
@@ -91,7 +93,7 @@ func (d *Controller) Exec(ctx context.Context, req *proto.ExecRequest, handler E
// If the state is pending, first try to resume the
// pending execution. If the state is COMPLETED or FAILED, start
// a new execution.
- exec, err := h.Start(ctx, req.ConversationId)
+ exec, err := h.Start(ctx, req.ConversationId, req.HarnessConfig)
if err != nil {
return fmt.Errorf("failed to start harness session: %w", err)
}
@@ -107,7 +109,7 @@ func (d *Controller) Exec(ctx context.Context, req *proto.ExecRequest, handler E
return nil
}
- exec, err := h.Start(ctx, req.ConversationId)
+ exec, err := h.Start(ctx, req.ConversationId, req.HarnessConfig)
if err != nil {
return fmt.Errorf("failed to start harness session: %w", err)
}
@@ -117,7 +119,7 @@ func (d *Controller) Exec(ctx context.Context, req *proto.ExecRequest, handler E
return fmt.Errorf("failed to queue inputs: %w", err)
}
// Log inputs before running harness
- if _, err := l.LogInputs(ctx, req.Inputs, req.AgentConfig); err != nil {
+ if _, err := l.LogInputs(ctx, req.Inputs, req.HarnessConfig); err != nil {
return fmt.Errorf("failed to log inputs: %w", err)
}
if err := exec.Run(ctx, hhandler); err != nil {
@@ -226,11 +228,23 @@ func (l *logger) ResumptionState(ctx context.Context) (proto.State, error) {
}
func (l *logger) LogInputs(ctx context.Context, inputs []*proto.Message, harnessConfig []byte) (int32, error) {
+ // Parse the harness config into a human-readable struct for logging.
+ var cfg *structpb.Struct
+ if len(harnessConfig) > 0 {
+ cfg = &structpb.Struct{}
+ if err := protojson.Unmarshal(harnessConfig, cfg); err != nil {
+ slog.WarnContext(ctx, "Failed to parse harness config for logging",
+ slog.String("conversation_id", l.conversationID),
+ slog.Any("error", err),
+ )
+ cfg = nil
+ }
+ }
ev := &proto.ConversationEvent{
ConversationId: l.conversationID,
ExecId: l.execID,
HarnessId: l.harnessID,
- HarnessConfig: harnessConfig,
+ HarnessConfig: cfg,
Messages: inputs,
State: proto.State_STATE_PENDING,
}
diff --git a/internal/controller/controller_test.go b/internal/controller/controller_test.go
index c5aad94..d70382f 100644
--- a/internal/controller/controller_test.go
+++ b/internal/controller/controller_test.go
@@ -27,7 +27,7 @@ import (
type fakeHarness struct{}
-func (f *fakeHarness) Start(ctx context.Context, conversationID string) (harness.Execution, error) {
+func (f *fakeHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (harness.Execution, error) {
return &fakeExecution{id: "fake-exec-id"}, nil
}
@@ -207,7 +207,7 @@ func TestController2_ExecWithAgentID(t *testing.T) {
err = c.Exec(ctx, &proto.ExecRequest{
ConversationId: cid,
- AgentId: "my-agent",
+ HarnessId: "my-agent",
Inputs: inputs,
}, handler)
if err != nil {
@@ -260,7 +260,7 @@ func TestController2_ExecHarnessNotFound(t *testing.T) {
err = c.Exec(ctx, &proto.ExecRequest{
ConversationId: cid,
Inputs: inputs,
- AgentId: "antigravity",
+ HarnessId: "antigravity",
}, handler)
if err == nil {
t.Fatal("expected error requesting unregistered agent, got nil")
@@ -272,7 +272,7 @@ type testHarness struct {
startFunc func(ctx context.Context, conversationID string) (harness.Execution, error)
}
-func (c *testHarness) Start(ctx context.Context, conversationID string) (harness.Execution, error) {
+func (c *testHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (harness.Execution, error) {
c.startCalls++
return c.startFunc(ctx, conversationID)
}
@@ -345,7 +345,7 @@ func TestController2_ExecResumptionFlow(t *testing.T) {
err = c.Exec(ctx, &proto.ExecRequest{
ConversationId: cid,
- AgentId: "test-agent",
+ HarnessId: "test-agent",
Inputs: []*proto.Message{
{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "Hello"}}}},
},
@@ -413,7 +413,7 @@ func TestController2_ExecResumptionFlow(t *testing.T) {
err = c.Exec(ctx, &proto.ExecRequest{
ConversationId: cid,
- AgentId: "test-agent",
+ HarnessId: "test-agent",
Inputs: nil, // NO new inputs
}, func(resp *proto.ExecResponse) error { return nil })
if err != nil {
@@ -480,7 +480,7 @@ func TestController2_ExecResumptionFlow(t *testing.T) {
err = c.Exec(ctx, &proto.ExecRequest{
ConversationId: cid,
- AgentId: "test-agent",
+ HarnessId: "test-agent",
Inputs: []*proto.Message{
{Role: "user", Content: &proto.Content{Type: &proto.Content_Text{Text: &proto.TextContent{Text: "New input"}}}},
},
diff --git a/internal/controller/registry_test.go b/internal/controller/registry_test.go
index d3d5d27..5fda937 100644
--- a/internal/controller/registry_test.go
+++ b/internal/controller/registry_test.go
@@ -23,7 +23,7 @@ import (
type dummyHarness struct{}
-func (d *dummyHarness) Start(ctx context.Context, conversationID string) (harness.Execution, error) {
+func (d *dummyHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (harness.Execution, error) {
return nil, nil
}
diff --git a/internal/harness/antigravity.go b/internal/harness/antigravity.go
index f1d03a8..7de9ec6 100644
--- a/internal/harness/antigravity.go
+++ b/internal/harness/antigravity.go
@@ -49,11 +49,12 @@ func NewAntigravityHarness(address string) *AntigravityHarness {
}
// Start implements Harness.Start.
-func (h *AntigravityHarness) Start(ctx context.Context, conversationID string) (Execution, error) {
+func (h *AntigravityHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (Execution, error) {
return &antigravityExecution{
harness: h,
conversationID: conversationID,
id: uuid.NewString(),
+ harnessConfig: harnessConfig,
}, nil
}
@@ -62,6 +63,7 @@ type antigravityExecution struct {
harness *AntigravityHarness
conversationID string
id string
+ harnessConfig []byte
mu sync.Mutex
queued []*proto.Message
@@ -116,7 +118,8 @@ func (e *antigravityExecution) Run(ctx context.Context, handler Handler) error {
HarnessId: "antigravity",
Type: &proto.HarnessRequest_Start{
Start: &proto.HarnessStart{
- Messages: inputs,
+ HarnessConfig: e.harnessConfig,
+ Messages: inputs,
},
},
}
diff --git a/internal/harness/antigravity_test.go b/internal/harness/antigravity_test.go
index 4d2f02a..d28cbe8 100644
--- a/internal/harness/antigravity_test.go
+++ b/internal/harness/antigravity_test.go
@@ -15,6 +15,7 @@
package harness
import (
+ "bytes"
"context"
"strings"
"testing"
@@ -22,13 +23,15 @@ import (
"github.com/google/ax/proto"
)
+var antigravityHarnessConfig = []byte(`{"system_instructions":"be terse"}`)
+
func TestAntigravityHarness_Run_Success(t *testing.T) {
srv := &mockHarnessServer{
outputs: []*proto.Message{thoughtText("Analyzing"), assistantText("Hello world")},
}
harnessClient := NewAntigravityHarness(startHarnessServer(t, srv))
- exec, err := harnessClient.Start(context.Background(), "conv-test")
+ exec, err := harnessClient.Start(context.Background(), "conv-test", antigravityHarnessConfig)
if err != nil {
t.Fatalf("failed to start execution: %v", err)
}
@@ -56,17 +59,21 @@ func TestAntigravityHarness_Run_Success(t *testing.T) {
if got := msgs[1].GetContent().GetText().GetText(); got != "Hello world" {
t.Errorf("expected 'Hello world', got %q", got)
}
- // The harness propagated the conversation id to the server.
- if convID, _, _ := srv.received(); convID != "conv-test" {
+ // The harness propagated the conversation id and config to the server.
+ convID, _, harnessConfig, _ := srv.received()
+ if convID != "conv-test" {
t.Errorf("server got convID=%q, want conv-test", convID)
}
+ if !bytes.Equal(harnessConfig, antigravityHarnessConfig) {
+ t.Errorf("server got harnessConfig=%q, want %q", harnessConfig, antigravityHarnessConfig)
+ }
}
func TestAntigravityHarness_Run_ErrorFrame(t *testing.T) {
srv := &mockHarnessServer{failConnect: true, errMessage: "internal mock server crash"}
harnessClient := NewAntigravityHarness(startHarnessServer(t, srv))
- exec, _ := harnessClient.Start(context.Background(), "conv-test")
+ exec, _ := harnessClient.Start(context.Background(), "conv-test", antigravityHarnessConfig)
defer exec.Close(context.Background())
if err := exec.Queue(context.Background(), userText("Hi")); err != nil {
diff --git a/internal/harness/antigravityinteractions.go b/internal/harness/antigravityinteractions.go
index 746dc4f..a15231f 100644
--- a/internal/harness/antigravityinteractions.go
+++ b/internal/harness/antigravityinteractions.go
@@ -163,11 +163,12 @@ func NewAntigravityInteractionsHarness(cfg AntigravityInteractionsConfig) *Antig
}
// Start implements Harness.Start.
-func (h *AntigravityInteractionsHarness) Start(ctx context.Context, conversationID string) (Execution, error) {
+func (h *AntigravityInteractionsHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (Execution, error) {
return &antigravityInteractionsExecution{
harness: h,
conversationID: conversationID,
id: uuid.NewString(),
+ harnessConfig: harnessConfig,
}, nil
}
@@ -179,6 +180,7 @@ type antigravityInteractionsExecution struct {
harness *AntigravityInteractionsHarness
conversationID string
id string
+ harnessConfig []byte
mu sync.Mutex
queued []*proto.Message
diff --git a/internal/harness/harness.go b/internal/harness/harness.go
index 587365b..6296271 100644
--- a/internal/harness/harness.go
+++ b/internal/harness/harness.go
@@ -33,8 +33,10 @@ type Handler interface {
// Harness represents a service capable of starting execution sessions.
type Harness interface {
- // Start initializes a new Execution session for a conversation.
- Start(ctx context.Context, conversationID string) (Execution, error)
+ // Start initializes a new Execution session for a conversation. harnessConfig
+ // carries optional per-request harness configuration; it is opaque to the
+ // controller and interpreted by the harness implementation.
+ Start(ctx context.Context, conversationID string, harnessConfig []byte) (Execution, error)
}
// Execution represents an active interactive session with an agent or planner.
diff --git a/internal/harness/mocks_test.go b/internal/harness/mocks_test.go
index 68bf2e4..5cdb3d7 100644
--- a/internal/harness/mocks_test.go
+++ b/internal/harness/mocks_test.go
@@ -103,10 +103,11 @@ type mockHarnessServer struct {
// errMessage is the error text used by failConnect/failFrame.
errMessage string
- mu sync.Mutex
- gotConvID string
- gotHarnessID string
- gotInputs []string
+ mu sync.Mutex
+ gotConvID string
+ gotHarnessID string
+ gotHarnessConfig []byte
+ gotInputs []string
}
func (s *mockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) error {
@@ -128,6 +129,7 @@ func (s *mockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) e
s.mu.Lock()
s.gotConvID = req.GetConversationId()
s.gotHarnessID = req.GetHarnessId()
+ s.gotHarnessConfig = req.GetStart().GetHarnessConfig()
s.gotInputs = inputs
s.mu.Unlock()
@@ -164,10 +166,10 @@ func (s *mockHarnessServer) Connect(stream proto.HarnessService_ConnectServer) e
}
// received returns a copy of the start frame the server received.
-func (s *mockHarnessServer) received() (convID, harnessID string, inputs []string) {
+func (s *mockHarnessServer) received() (convID, harnessID string, harnessConfig []byte, inputs []string) {
s.mu.Lock()
defer s.mu.Unlock()
- return s.gotConvID, s.gotHarnessID, append([]string(nil), s.gotInputs...)
+ return s.gotConvID, s.gotHarnessID, append([]byte(nil), s.gotHarnessConfig...), append([]string(nil), s.gotInputs...)
}
// mockHandler records the messages and completion streamed during a turn.
diff --git a/internal/harness/substrate.go b/internal/harness/substrate.go
index 6ca7bee..f8b2211 100644
--- a/internal/harness/substrate.go
+++ b/internal/harness/substrate.go
@@ -76,7 +76,7 @@ func NewSubstrateHarness(harnessID string, endpoint string, namespace string, te
}
// Start implements Harness interface. It creates/resumes the target actor.
-func (h *SubstrateHarness) Start(ctx context.Context, conversationID string) (Execution, error) {
+func (h *SubstrateHarness) Start(ctx context.Context, conversationID string, harnessConfig []byte) (Execution, error) {
if conversationID == "" {
return nil, errors.New("SubstrateHarness needs valid conversationID")
}
@@ -120,6 +120,7 @@ func (h *SubstrateHarness) Start(ctx context.Context, conversationID string) (Ex
execID: uuid.NewString(),
conn: conn,
client: proto.NewHarnessServiceClient(conn),
+ harnessConfig: harnessConfig,
}, nil
}
@@ -165,6 +166,7 @@ type substrateExecution struct {
execID string
conn *grpc.ClientConn
client proto.HarnessServiceClient
+ harnessConfig []byte
mu sync.Mutex
pending []*proto.Message
@@ -198,7 +200,8 @@ func (e *substrateExecution) Run(ctx context.Context, handler Handler) error {
HarnessId: e.harness.harnessID,
Type: &proto.HarnessRequest_Start{
Start: &proto.HarnessStart{
- Messages: inputs,
+ HarnessConfig: e.harnessConfig,
+ Messages: inputs,
},
},
}
diff --git a/internal/harness/substrate_test.go b/internal/harness/substrate_test.go
index ee7ada5..c019b64 100644
--- a/internal/harness/substrate_test.go
+++ b/internal/harness/substrate_test.go
@@ -15,6 +15,7 @@
package harness
import (
+ "bytes"
"context"
"net"
"slices"
@@ -32,6 +33,8 @@ import (
"google.golang.org/grpc/status"
)
+var substrateHarnessConfig = []byte(`{"model":"gemini-2.5-pro"}`)
+
// startHealthTestServer starts a gRPC server on a random local port. If hs is
// non-nil the standard health service is registered. Returns the listen address.
func startHealthTestServer(t *testing.T, hs *health.Server) string {
@@ -158,7 +161,7 @@ func TestSubstrateHarness_EndToEnd(t *testing.T) {
h := newTestSubstrateHarness(t, startControlServer(t, ctrl), startHarnessServer(t, srv))
ctx := context.Background()
- exec, err := h.Start(ctx, "conv-1")
+ exec, err := h.Start(ctx, "conv-1", substrateHarnessConfig)
if err != nil {
t.Fatalf("Start: %v", err)
}
@@ -171,10 +174,13 @@ func TestSubstrateHarness_EndToEnd(t *testing.T) {
}
// The harness server received the start frame with the right identifiers.
- convID, harnessID, inputs := srv.received()
+ convID, harnessID, harnessConfig, inputs := srv.received()
if convID != "conv-1" || harnessID != "antigravity" {
t.Errorf("server got convID=%q harnessID=%q, want conv-1/antigravity", convID, harnessID)
}
+ if !bytes.Equal(harnessConfig, substrateHarnessConfig) {
+ t.Errorf("server got harnessConfig=%q, want %q", harnessConfig, substrateHarnessConfig)
+ }
if !slices.Equal(inputs, []string{"hi"}) {
t.Errorf("server got inputs=%v, want [hi]", inputs)
}
@@ -214,7 +220,7 @@ func TestSubstrateHarness_CreateAlreadyExistsTolerated(t *testing.T) {
h := newTestSubstrateHarness(t, startControlServer(t, ctrl), startHarnessServer(t, &mockHarnessServer{}))
ctx := context.Background()
- exec, err := h.Start(ctx, "conv-1")
+ exec, err := h.Start(ctx, "conv-1", substrateHarnessConfig)
if err != nil {
t.Fatalf("Start should tolerate AlreadyExists: %v", err)
}
@@ -239,7 +245,7 @@ func TestSubstrateHarness_ResumeNoWorkerIP(t *testing.T) {
ctrl := &mockControlServer{resumeIP: ""} // empty AteomPodIp
h := newTestSubstrateHarness(t, startControlServer(t, ctrl), startHarnessServer(t, &mockHarnessServer{}))
- _, err := h.Start(context.Background(), "conv-1")
+ _, err := h.Start(context.Background(), "conv-1", substrateHarnessConfig)
if err == nil {
t.Fatal("expected error for empty worker IP, got nil")
}
@@ -252,7 +258,7 @@ func TestSubstrateHarness_ResumeNilActor(t *testing.T) {
ctrl := &mockControlServer{resumeNilActor: true}
h := newTestSubstrateHarness(t, startControlServer(t, ctrl), startHarnessServer(t, &mockHarnessServer{}))
- _, err := h.Start(context.Background(), "conv-1")
+ _, err := h.Start(context.Background(), "conv-1", substrateHarnessConfig)
if err == nil {
t.Fatal("expected error for nil actor, got nil")
}
@@ -267,7 +273,7 @@ func TestSubstrateHarness_HarnessFailedFrame(t *testing.T) {
h := newTestSubstrateHarness(t, startControlServer(t, ctrl), startHarnessServer(t, srv))
ctx := context.Background()
- exec, err := h.Start(ctx, "conv-1")
+ exec, err := h.Start(ctx, "conv-1", substrateHarnessConfig)
if err != nil {
t.Fatalf("Start: %v", err)
}
diff --git a/proto/ax.pb.go b/proto/ax.pb.go
index 4819b1b..5e8dfa2 100644
--- a/proto/ax.pb.go
+++ b/proto/ax.pb.go
@@ -23,6 +23,7 @@ package proto
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ structpb "google.golang.org/protobuf/types/known/structpb"
_ "google.golang.org/protobuf/types/known/timestamppb"
reflect "reflect"
sync "sync"
@@ -516,7 +517,7 @@ type ConversationEvent struct {
Seq int32 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"`
ExecId string `protobuf:"bytes,3,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"`
HarnessId string `protobuf:"bytes,4,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"`
- HarnessConfig []byte `protobuf:"bytes,5,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"`
+ HarnessConfig *structpb.Struct `protobuf:"bytes,5,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"`
Messages []*Message `protobuf:"bytes,6,rep,name=messages,proto3" json:"messages,omitempty"`
State State `protobuf:"varint,7,opt,name=state,proto3,enum=ax.State" json:"state,omitempty"`
unknownFields protoimpl.UnknownFields
@@ -581,7 +582,7 @@ func (x *ConversationEvent) GetHarnessId() string {
return ""
}
-func (x *ConversationEvent) GetHarnessConfig() []byte {
+func (x *ConversationEvent) GetHarnessConfig() *structpb.Struct {
if x != nil {
return x.HarnessConfig
}
@@ -1082,8 +1083,8 @@ type ExecRequest struct {
ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"` // Unique conversation identifier
Inputs []*Message `protobuf:"bytes,2,rep,name=inputs,proto3" json:"inputs,omitempty"` // New inputs
LastSeq int32 `protobuf:"varint,3,opt,name=last_seq,json=lastSeq,proto3" json:"last_seq,omitempty"` // Last sequence number seen by the client
- AgentId string `protobuf:"bytes,4,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"` // Agent ID, if empty planner is used
- AgentConfig []byte `protobuf:"bytes,5,opt,name=agent_config,json=agentConfig,proto3" json:"agent_config,omitempty"` // Agent configuration if any
+ HarnessId string `protobuf:"bytes,4,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"` // Harness ID, empty selects the default harness
+ HarnessConfig []byte `protobuf:"bytes,5,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` // Per-request harness configuration (opaque JSON), if any
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
@@ -1139,16 +1140,16 @@ func (x *ExecRequest) GetLastSeq() int32 {
return 0
}
-func (x *ExecRequest) GetAgentId() string {
+func (x *ExecRequest) GetHarnessId() string {
if x != nil {
- return x.AgentId
+ return x.HarnessId
}
return ""
}
-func (x *ExecRequest) GetAgentConfig() []byte {
+func (x *ExecRequest) GetHarnessConfig() []byte {
if x != nil {
- return x.AgentConfig
+ return x.HarnessConfig
}
return nil
}
@@ -1290,7 +1291,7 @@ var File_proto_ax_proto protoreflect.FileDescriptor
const file_proto_ax_proto_rawDesc = "" +
"\n" +
- "\x0eproto/ax.proto\x12\x02ax\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13proto/content.proto\"s\n" +
+ "\x0eproto/ax.proto\x12\x02ax\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13proto/content.proto\"s\n" +
"\n" +
"AgentStart\x12\x19\n" +
"\bagent_id\x18\x01 \x01(\tR\aagentId\x12!\n" +
@@ -1313,14 +1314,14 @@ const file_proto_ax_proto_rawDesc = "" +
"\aMessage\x12\x12\n" +
"\x04role\x18\x01 \x01(\tR\x04role\x12%\n" +
"\acontent\x18\x02 \x01(\v2\v.ax.ContentR\acontent\x12#\n" +
- "\rinternal_only\x18\x03 \x01(\bR\finternalOnly\"\xf7\x01\n" +
+ "\rinternal_only\x18\x03 \x01(\bR\finternalOnly\"\x90\x02\n" +
"\x11ConversationEvent\x12'\n" +
"\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12\x10\n" +
"\x03seq\x18\x02 \x01(\x05R\x03seq\x12\x17\n" +
"\aexec_id\x18\x03 \x01(\tR\x06execId\x12\x1d\n" +
"\n" +
- "harness_id\x18\x04 \x01(\tR\tharnessId\x12%\n" +
- "\x0eharness_config\x18\x05 \x01(\fR\rharnessConfig\x12'\n" +
+ "harness_id\x18\x04 \x01(\tR\tharnessId\x12>\n" +
+ "\x0eharness_config\x18\x05 \x01(\v2\x17.google.protobuf.StructR\rharnessConfig\x12'\n" +
"\bmessages\x18\x06 \x03(\v2\v.ax.MessageR\bmessages\x12\x1f\n" +
"\x05state\x18\a \x01(\x0e2\t.ax.StateR\x05state\"\x14\n" +
"\x12HealthCheckRequest\"I\n" +
@@ -1349,13 +1350,14 @@ const file_proto_ax_proto_rawDesc = "" +
"\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12.\n" +
"\aoutputs\x18\x02 \x01(\v2\x12.ax.HarnessOutputsH\x00R\aoutputs\x12\"\n" +
"\x03end\x18\x03 \x01(\v2\x0e.ax.HarnessEndH\x00R\x03endB\x06\n" +
- "\x04type\"\xb4\x01\n" +
+ "\x04type\"\xbc\x01\n" +
"\vExecRequest\x12'\n" +
"\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12#\n" +
"\x06inputs\x18\x02 \x03(\v2\v.ax.MessageR\x06inputs\x12\x19\n" +
- "\blast_seq\x18\x03 \x01(\x05R\alastSeq\x12\x19\n" +
- "\bagent_id\x18\x04 \x01(\tR\aagentId\x12!\n" +
- "\fagent_config\x18\x05 \x01(\fR\vagentConfig\"G\n" +
+ "\blast_seq\x18\x03 \x01(\x05R\alastSeq\x12\x1d\n" +
+ "\n" +
+ "harness_id\x18\x04 \x01(\tR\tharnessId\x12%\n" +
+ "\x0eharness_config\x18\x05 \x01(\fR\rharnessConfig\"G\n" +
"\fExecResponse\x12%\n" +
"\aoutputs\x18\x01 \x03(\v2\v.ax.MessageR\aoutputs\x12\x10\n" +
"\x03seq\x18\x02 \x01(\x05R\x03seq\"D\n" +
@@ -1417,6 +1419,7 @@ var file_proto_ax_proto_goTypes = []any{
(*DeleteConversationRequest)(nil), // 19: ax.DeleteConversationRequest
(*DeleteConversationResponse)(nil), // 20: ax.DeleteConversationResponse
(*Content)(nil), // 21: ax.Content
+ (*structpb.Struct)(nil), // 22: google.protobuf.Struct
}
var file_proto_ax_proto_depIdxs = []int32{
7, // 0: ax.AgentStart.messages:type_name -> ax.Message
@@ -1425,29 +1428,30 @@ var file_proto_ax_proto_depIdxs = []int32{
3, // 3: ax.AgentResponse.outputs:type_name -> ax.AgentOutputs
4, // 4: ax.AgentResponse.end:type_name -> ax.AgentEnd
21, // 5: ax.Message.content:type_name -> ax.Content
- 7, // 6: ax.ConversationEvent.messages:type_name -> ax.Message
- 0, // 7: ax.ConversationEvent.state:type_name -> ax.State
- 7, // 8: ax.HarnessStart.messages:type_name -> ax.Message
- 1, // 9: ax.HarnessCancel.reason:type_name -> ax.CancelReason
- 11, // 10: ax.HarnessRequest.start:type_name -> ax.HarnessStart
- 12, // 11: ax.HarnessRequest.cancel:type_name -> ax.HarnessCancel
- 7, // 12: ax.HarnessOutputs.messages:type_name -> ax.Message
- 0, // 13: ax.HarnessEnd.state:type_name -> ax.State
- 14, // 14: ax.HarnessResponse.outputs:type_name -> ax.HarnessOutputs
- 15, // 15: ax.HarnessResponse.end:type_name -> ax.HarnessEnd
- 7, // 16: ax.ExecRequest.inputs:type_name -> ax.Message
- 7, // 17: ax.ExecResponse.outputs:type_name -> ax.Message
- 13, // 18: ax.HarnessService.Connect:input_type -> ax.HarnessRequest
- 17, // 19: ax.ControllerService.Exec:input_type -> ax.ExecRequest
- 19, // 20: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest
- 16, // 21: ax.HarnessService.Connect:output_type -> ax.HarnessResponse
- 18, // 22: ax.ControllerService.Exec:output_type -> ax.ExecResponse
- 20, // 23: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse
- 21, // [21:24] is the sub-list for method output_type
- 18, // [18:21] is the sub-list for method input_type
- 18, // [18:18] is the sub-list for extension type_name
- 18, // [18:18] is the sub-list for extension extendee
- 0, // [0:18] is the sub-list for field type_name
+ 22, // 6: ax.ConversationEvent.harness_config:type_name -> google.protobuf.Struct
+ 7, // 7: ax.ConversationEvent.messages:type_name -> ax.Message
+ 0, // 8: ax.ConversationEvent.state:type_name -> ax.State
+ 7, // 9: ax.HarnessStart.messages:type_name -> ax.Message
+ 1, // 10: ax.HarnessCancel.reason:type_name -> ax.CancelReason
+ 11, // 11: ax.HarnessRequest.start:type_name -> ax.HarnessStart
+ 12, // 12: ax.HarnessRequest.cancel:type_name -> ax.HarnessCancel
+ 7, // 13: ax.HarnessOutputs.messages:type_name -> ax.Message
+ 0, // 14: ax.HarnessEnd.state:type_name -> ax.State
+ 14, // 15: ax.HarnessResponse.outputs:type_name -> ax.HarnessOutputs
+ 15, // 16: ax.HarnessResponse.end:type_name -> ax.HarnessEnd
+ 7, // 17: ax.ExecRequest.inputs:type_name -> ax.Message
+ 7, // 18: ax.ExecResponse.outputs:type_name -> ax.Message
+ 13, // 19: ax.HarnessService.Connect:input_type -> ax.HarnessRequest
+ 17, // 20: ax.ControllerService.Exec:input_type -> ax.ExecRequest
+ 19, // 21: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest
+ 16, // 22: ax.HarnessService.Connect:output_type -> ax.HarnessResponse
+ 18, // 23: ax.ControllerService.Exec:output_type -> ax.ExecResponse
+ 20, // 24: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse
+ 22, // [22:25] is the sub-list for method output_type
+ 19, // [19:22] is the sub-list for method input_type
+ 19, // [19:19] is the sub-list for extension type_name
+ 19, // [19:19] is the sub-list for extension extendee
+ 0, // [0:19] is the sub-list for field type_name
}
func init() { file_proto_ax_proto_init() }
diff --git a/proto/ax.proto b/proto/ax.proto
index 4e40893..abbe501 100644
--- a/proto/ax.proto
+++ b/proto/ax.proto
@@ -16,6 +16,7 @@ syntax = "proto3";
package ax;
+import "google/protobuf/struct.proto";
import "google/protobuf/timestamp.proto";
import "proto/content.proto";
@@ -69,7 +70,7 @@ message ConversationEvent {
int32 seq = 2;
string exec_id = 3;
string harness_id = 4;
- bytes harness_config = 5;
+ google.protobuf.Struct harness_config = 5;
repeated Message messages = 6;
State state = 7;
}
@@ -154,8 +155,8 @@ message ExecRequest {
repeated Message inputs = 2; // New inputs
int32 last_seq = 3; // Last sequence number seen by the client
- string agent_id = 4; // Agent ID, if empty planner is used
- bytes agent_config = 5; // Agent configuration if any
+ string harness_id = 4; // Harness ID, empty selects the default harness
+ bytes harness_config = 5; // Per-request harness configuration (opaque JSON), if any
}
// ExecResponse contains the result of an execution.
diff --git a/python/antigravity/config.json b/python/antigravity/config.json
new file mode 100644
index 0000000..2d97165
--- /dev/null
+++ b/python/antigravity/config.json
@@ -0,0 +1,4 @@
+{
+ "system_instructions": "You are a friendly weather assistant. Use the get_weather tool and reply in one upbeat sentence. If possible, include emojis in your response.",
+ "model": "gemini-3.1-pro-preview"
+}
\ No newline at end of file