Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Initial version of the harness service. (#69)

Junjie Wang8a7ae9e815b5
diff --git a/cmd/ax/harness.go b/cmd/ax/harness.go
index 71275dc..3faf6c9 100644
--- a/cmd/ax/harness.go
+++ b/cmd/ax/harness.go
@@ -12,15 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+// Package main implements a demo HarnessService.
+// It is intended for testing purposes only and should be replaced with a real
+// implementation in production.
+// TODO(wjjclaud): Replace this file with a real harness implementation.
package main
import (
"fmt"
- "io"
"log"
"net"
"os"
"os/signal"
+ "sync"
"syscall"
"github.com/google/ax/proto"
@@ -71,61 +75,116 @@ func runHarness(cmd *cobra.Command, args []string) error {
return nil
}
+// conversationState is the per-conversation state the stub keeps in process memory.
+// On substrate this state is preserved across turns by snapshot/suspend/resume.
+type conversationState struct {
+ turns int
+ history []string
+}
+
// HarnessServiceServer implements the gRPC proto.HarnessServiceServer interface.
type HarnessServiceServer struct {
proto.UnimplementedHarnessServiceServer
+
+ mu sync.Mutex
+ conversations map[string]*conversationState
}
// NewHarnessServiceServer creates a new HarnessServiceServer.
func NewHarnessServiceServer() *HarnessServiceServer {
- return &HarnessServiceServer{}
+ return &HarnessServiceServer{conversations: make(map[string]*conversationState)}
}
-// Connect implements the bidirectional gRPC streaming capability.
-// It receives client inputs and responds with "hello world" unless the input message text is "go_away".
-// TODO(params): Update the implementation to be a proper one.
+// Connect implements one HarnessService turn. It reads the initial
+// HarnessRequest{start} frame, then replies with a "hello world (turn N)"
+// frame, an echo of each input, and a recap of the inputs from prior turns,
+// terminating with HarnessEnd{STATE_COMPLETED}.
+//
+// The per-conversation turn count and input history are kept in process
+// memory and persist across turns.
func (s *HarnessServiceServer) Connect(stream proto.HarnessService_ConnectServer) error {
- for {
- req, err := stream.Recv()
- if err == io.EOF {
- return nil
+ req, err := stream.Recv()
+ if err != nil {
+ return err
+ }
+
+ convID := req.GetConversationId()
+ if req.GetStart() == nil {
+ return stream.Send(&proto.HarnessResponse{
+ ConversationId: convID,
+ Type: &proto.HarnessResponse_End{
+ End: &proto.HarnessEnd{
+ State: proto.State_STATE_FAILED,
+ ErrorMessage: "expected HarnessRequest{start} as the first frame",
+ },
+ },
+ })
+ }
+
+ // Collect this turn's input text(s).
+ var inputs []string
+ for _, m := range req.GetStart().GetMessages() {
+ if text := m.GetContent().GetText().GetText(); text != "" {
+ inputs = append(inputs, text)
}
- if err != nil {
+ }
+
+ // Update per-conversation state held in process memory.
+ s.mu.Lock()
+ st := s.conversations[convID]
+ if st == nil {
+ st = &conversationState{}
+ s.conversations[convID] = st
+ }
+ st.turns++
+ turn := st.turns
+ prior := ""
+ if len(st.history) > 0 {
+ prior = st.history[len(st.history)-1]
+ }
+ st.history = append(st.history, inputs...)
+ s.mu.Unlock()
+
+ // Reply: turn number, this turn's inputs, and the remembered prior inputs.
+ if err := stream.Send(textOutput(convID, fmt.Sprintf("hello world (turn %d)", turn))); err != nil {
+ return err
+ }
+ for _, in := range inputs {
+ if err := stream.Send(textOutput(convID, "received: "+in)); err != nil {
return err
}
-
- shouldGoAway := false
- for _, m := range req.Messages {
- if textBlock, ok := m.Content.Type.(*proto.Content_Text); ok {
- // TODO(params): Replace this with a proper protocol for go away.
- if textBlock.Text.Text == "go_away" {
- shouldGoAway = true
- break
- }
- }
+ }
+ if prior != "" {
+ if err := stream.Send(textOutput(convID, "previously you said: "+prior)); err != nil {
+ return err
}
+ }
- if shouldGoAway {
- log.Println("Received 'go_away' message, closing stream...")
- return nil
- }
+ return stream.Send(&proto.HarnessResponse{
+ ConversationId: convID,
+ Type: &proto.HarnessResponse_End{
+ End: &proto.HarnessEnd{State: proto.State_STATE_COMPLETED},
+ },
+ })
+}
- err = stream.Send(&proto.HarnessMessage{
- Messages: []*proto.Message{
- {
- Role: "assistant",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{
- Text: "hello world",
+// textOutput builds a HarnessResponse carrying a single assistant text Message.
+func textOutput(convID, text string) *proto.HarnessResponse {
+ return &proto.HarnessResponse{
+ ConversationId: convID,
+ Type: &proto.HarnessResponse_Outputs{
+ Outputs: &proto.HarnessOutputs{
+ Messages: []*proto.Message{
+ {
+ Role: "assistant",
+ Content: &proto.Content{
+ Type: &proto.Content_Text{
+ Text: &proto.TextContent{Text: text},
},
},
},
},
},
- })
- if err != nil {
- return err
- }
+ },
}
}
diff --git a/cmd/ax/harnessclient.go b/cmd/ax/harnessclient.go
index e02c361..09e3298 100644
--- a/cmd/ax/harnessclient.go
+++ b/cmd/ax/harnessclient.go
@@ -13,6 +13,9 @@
// limitations under the License.
// Package main implements a simple client for the fake HarnessService.
+// It is intended for testing purposes only and should be replaced with
+// the actual ax client implementation.
+// TODO(wjjclaud): Update or replace this file with ax client implementation.
package main
import (
@@ -24,6 +27,7 @@ import (
"os"
"github.com/google/ax/proto"
+ "github.com/google/uuid"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@@ -31,6 +35,7 @@ import (
var (
harnessServerAddr string
+ harnessClientID string
)
var harnessClientCmd = &cobra.Command{
@@ -42,6 +47,7 @@ var harnessClientCmd = &cobra.Command{
func init() {
harnessClientCmd.Flags().StringVar(&harnessServerAddr, "server", "localhost:50053", "The server address for the gRPC HarnessService.")
+ harnessClientCmd.Flags().StringVar(&harnessClientID, "harness", "testharness", "The harness id to send on the request envelope.")
rootCmd.AddCommand(harnessClientCmd)
}
@@ -57,72 +63,63 @@ func runHarnessClient(cmd *cobra.Command, args []string) error {
client := proto.NewHarnessServiceClient(conn)
+ fmt.Print("Client > ")
+ scanner := bufio.NewScanner(os.Stdin)
+ scanner.Scan()
+ input := scanner.Text()
+
stream, err := client.Connect(ctx)
if err != nil {
- return fmt.Errorf("Failed to open connection stream: %v", err)
+ return fmt.Errorf("failed to open connection stream: %v", err)
}
- scanner := bufio.NewScanner(os.Stdin)
- fmt.Println("Interactive client started. Type your messages below.")
- fmt.Println("Type 'go_away' to close the stream and exit.")
- for {
- fmt.Print("\nClient > ")
- if !scanner.Scan() {
- break
- }
- text := scanner.Text()
- if text == "" {
- continue
- }
-
- msg := &proto.HarnessMessage{
- Messages: []*proto.Message{
- {
- Role: "user",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{
- Text: text,
- },
+ // A single HarnessRequest{start} initiates the turn.
+ start := &proto.HarnessRequest{
+ ConversationId: uuid.NewString(),
+ HarnessId: harnessClientID,
+ Type: &proto.HarnessRequest_Start{
+ Start: &proto.HarnessStart{
+ Messages: []*proto.Message{
+ {
+ Role: "user",
+ Content: &proto.Content{
+ Type: &proto.Content_Text{Text: &proto.TextContent{Text: input}},
},
},
},
},
- }
+ },
+ }
+ if err := stream.Send(start); err != nil {
+ return fmt.Errorf("failed to send start: %v", err)
+ }
+ if err := stream.CloseSend(); err != nil {
+ return fmt.Errorf("failed to close send side: %v", err)
+ }
- if err := stream.Send(msg); err != nil {
- return fmt.Errorf("Failed to send message: %v", err)
- }
- // TODO(params): Replace this with a proper protocol for go away.
- if text == "go_away" {
- log.Println("Sending 'go_away' to close the stream...")
+ // Drain HarnessResponse frames until HarnessEnd / EOF.
+ for {
+ resp, err := stream.Recv()
+ if err == io.EOF {
break
}
-
- resp, err := stream.Recv()
if err != nil {
- return fmt.Errorf("Failed to receive response: %v", err)
+ return fmt.Errorf("failed to receive response: %v", err)
}
-
- for i, m := range resp.Messages {
- var textContent string
- if textBlock, ok := m.Content.Type.(*proto.Content_Text); ok {
- textContent = textBlock.Text.Text
+ switch payload := resp.Type.(type) {
+ case *proto.HarnessResponse_Outputs:
+ for i, m := range payload.Outputs.Messages {
+ var text string
+ if tb, ok := m.Content.Type.(*proto.Content_Text); ok {
+ text = tb.Text.Text
+ }
+ fmt.Printf("Server > message[%d] (%s): %s\n", i, m.Role, text)
}
- fmt.Printf("Server > message[%d] (%s): %s\n", i, m.Role, textContent)
+ case *proto.HarnessResponse_End:
+ fmt.Printf("Server > [end] state=%s %s\n", payload.End.GetState(), payload.End.GetErrorMessage())
}
}
- // Close send side to signal request completion
- if err := stream.CloseSend(); err != nil {
- return fmt.Errorf("Failed to close send side of stream: %v", err)
- }
-
- log.Println("Waiting for final stream EOF...")
- _, err = stream.Recv()
- if err != io.EOF {
- return fmt.Errorf("Expected EOF from server, got: %v", err)
- }
log.Println("Stream closed successfully by server.")
return nil
}
diff --git a/internal/config2/config.go b/internal/config2/config.go
index 2aa8436..cfaa9ed 100644
--- a/internal/config2/config.go
+++ b/internal/config2/config.go
@@ -85,7 +85,7 @@ type SubstrateHarnessConfig struct {
// as a substrate actor; otherwise it runs locally.
func (c AntigravityHarnessConfig) NewHarness(substrate bool, endpoint string) (harness.Harness, error) {
if substrate {
- return newSubstrateHarness(endpoint, defaultNamespace, antigravityTemplate, defaultPort)
+ return newSubstrateHarness(c.ID, endpoint, defaultNamespace, antigravityTemplate, defaultPort)
}
address := c.Address
if address == "" {
@@ -101,12 +101,12 @@ func (c SubstrateHarnessConfig) NewHarness(endpoint string) (harness.Harness, er
if port == 0 {
port = defaultPort
}
- return newSubstrateHarness(endpoint, c.Namespace, c.Template, port)
+ return newSubstrateHarness(c.ID, endpoint, c.Namespace, c.Template, port)
}
// newSubstrateHarness brings up a harness that is deployed as a substrate actor.
-func newSubstrateHarness(endpoint, namespace, template string, port int) (harness.Harness, error) {
- sh, err := harness.NewSubstrateHarness(endpoint, namespace, template, port)
+func newSubstrateHarness(harnessID, endpoint, namespace, template string, port int) (harness.Harness, error) {
+ sh, err := harness.NewSubstrateHarness(harnessID, endpoint, namespace, template, port)
if err != nil {
return nil, err
}
diff --git a/internal/harness/substrate.go b/internal/harness/substrate.go
index 9126ea4..a320915 100644
--- a/internal/harness/substrate.go
+++ b/internal/harness/substrate.go
@@ -37,13 +37,14 @@ import (
// SubstrateHarness manages execution in a SubstrATE sandboxed actor over gRPC HarnessService.
type SubstrateHarness struct {
+ harnessID string
ateClient *ate.Client
port int
dialOpts []grpc.DialOption
}
// NewSubstrateHarness creates a new SubstrateHarness.
-func NewSubstrateHarness(endpoint string, namespace string, template string, port int, opts ...grpc.DialOption) (*SubstrateHarness, error) {
+func NewSubstrateHarness(harnessID string, endpoint string, namespace string, template string, port int, opts ...grpc.DialOption) (*SubstrateHarness, error) {
if port == 0 {
port = 50053 // Default HarnessService port
}
@@ -62,6 +63,7 @@ func NewSubstrateHarness(endpoint string, namespace string, template string, por
opts = append(opts, grpc.WithTransportCredentials(insecure.NewCredentials()))
}
return &SubstrateHarness{
+ harnessID: harnessID,
ateClient: client,
port: port,
dialOpts: opts,
@@ -142,20 +144,26 @@ func (e *substrateExecution) Run(ctx context.Context, handler Handler) error {
return fmt.Errorf("failed to open harness service stream: %w", err)
}
- // Send inputs
- err = stream.Send(&proto.HarnessMessage{
- Messages: inputs,
- })
- if err != nil {
- return fmt.Errorf("failed to send harness inputs: %w", err)
+ // Send a HarnessRequest to initiate the turn.
+ start := &proto.HarnessRequest{
+ ConversationId: e.conversationID,
+ HarnessId: e.harness.harnessID,
+ Type: &proto.HarnessRequest_Start{
+ Start: &proto.HarnessStart{
+ Messages: inputs,
+ },
+ },
+ }
+ if err := stream.Send(start); err != nil {
+ return fmt.Errorf("failed to send harness start: %w", err)
}
- // Close send direction to trigger server processing
+ // Close send direction to trigger server processing.
if err := stream.CloseSend(); err != nil {
return fmt.Errorf("failed to close stream send direction: %w", err)
}
- // Receive response stream
+ // Drain HarnessResponse frames until the terminal HarnessEnd.
for {
resp, err := stream.Recv()
if err == io.EOF {
@@ -164,10 +172,18 @@ func (e *substrateExecution) Run(ctx context.Context, handler Handler) error {
if err != nil {
return fmt.Errorf("error receiving from harness stream: %w", err)
}
- for _, m := range resp.Messages {
- if err := handler.OnMessage(ctx, e.execID, m); err != nil {
- return err
+ switch payload := resp.Type.(type) {
+ case *proto.HarnessResponse_Outputs:
+ for _, m := range payload.Outputs.Messages {
+ if err := handler.OnMessage(ctx, e.execID, m); err != nil {
+ return err
+ }
+ }
+ case *proto.HarnessResponse_End:
+ if payload.End.GetState() == proto.State_STATE_FAILED {
+ return fmt.Errorf("harness failed: %s", payload.End.GetErrorMessage())
}
+ return handler.OnComplete(ctx, e.execID)
}
}
diff --git a/proto/ax.pb.go b/proto/ax.pb.go
index d0eb689..e02fe5d 100644
--- a/proto/ax.pb.go
+++ b/proto/ax.pb.go
@@ -44,6 +44,7 @@ const (
State_STATE_PENDING State = 1
State_STATE_FAILED State = 2
State_STATE_COMPLETED State = 3
+ State_STATE_CANCELED State = 4
)
// Enum value maps for State.
@@ -53,12 +54,14 @@ var (
1: "STATE_PENDING",
2: "STATE_FAILED",
3: "STATE_COMPLETED",
+ 4: "STATE_CANCELED",
}
State_value = map[string]int32{
"STATE_UNSPECIFIED": 0,
"STATE_PENDING": 1,
"STATE_FAILED": 2,
"STATE_COMPLETED": 3,
+ "STATE_CANCELED": 4,
}
)
@@ -89,6 +92,59 @@ func (State) EnumDescriptor() ([]byte, []int) {
return file_proto_ax_proto_rawDescGZIP(), []int{0}
}
+// CancelReason explains why an in-flight execution is canceled.
+type CancelReason int32
+
+const (
+ CancelReason_CANCEL_REASON_UNSPECIFIED CancelReason = 0
+ CancelReason_CANCEL_REASON_USER_REQUESTED CancelReason = 1
+ CancelReason_CANCEL_REASON_TIMEOUT CancelReason = 2
+ CancelReason_CANCEL_REASON_INTERNAL_ERROR CancelReason = 3
+)
+
+// Enum value maps for CancelReason.
+var (
+ CancelReason_name = map[int32]string{
+ 0: "CANCEL_REASON_UNSPECIFIED",
+ 1: "CANCEL_REASON_USER_REQUESTED",
+ 2: "CANCEL_REASON_TIMEOUT",
+ 3: "CANCEL_REASON_INTERNAL_ERROR",
+ }
+ CancelReason_value = map[string]int32{
+ "CANCEL_REASON_UNSPECIFIED": 0,
+ "CANCEL_REASON_USER_REQUESTED": 1,
+ "CANCEL_REASON_TIMEOUT": 2,
+ "CANCEL_REASON_INTERNAL_ERROR": 3,
+ }
+)
+
+func (x CancelReason) Enum() *CancelReason {
+ p := new(CancelReason)
+ *p = x
+ return p
+}
+
+func (x CancelReason) String() string {
+ return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
+}
+
+func (CancelReason) Descriptor() protoreflect.EnumDescriptor {
+ return file_proto_ax_proto_enumTypes[1].Descriptor()
+}
+
+func (CancelReason) Type() protoreflect.EnumType {
+ return &file_proto_ax_proto_enumTypes[1]
+}
+
+func (x CancelReason) Number() protoreflect.EnumNumber {
+ return protoreflect.EnumNumber(x)
+}
+
+// Deprecated: Use CancelReason.Descriptor instead.
+func (CancelReason) EnumDescriptor() ([]byte, []int) {
+ return file_proto_ax_proto_rawDescGZIP(), []int{1}
+}
+
type AgentStart struct {
state protoimpl.MessageState `protogen:"open.v1"`
AgentId string `protobuf:"bytes,1,opt,name=agent_id,json=agentId,proto3" json:"agent_id,omitempty"`
@@ -715,31 +771,29 @@ func (x *HealthCheckResponse) GetMessage() string {
return ""
}
-type HarnessMessage struct {
+type HarnessStart struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // TODO(jbd): This is a placeholder message
- // and will be replaced with the actual protocol.
- HarnessId string `protobuf:"bytes,1,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"` // The unique identifier of the harness.
- HarnessConfig []byte `protobuf:"bytes,2,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"` // The configuration for the harness.
- Messages []*Message `protobuf:"bytes,3,rep,name=messages,proto3" json:"messages,omitempty"` // The messages associated with the call.
+ // Per-execution harness configuration.
+ HarnessConfig []byte `protobuf:"bytes,1,opt,name=harness_config,json=harnessConfig,proto3" json:"harness_config,omitempty"`
+ Messages []*Message `protobuf:"bytes,2,rep,name=messages,proto3" json:"messages,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
-func (x *HarnessMessage) Reset() {
- *x = HarnessMessage{}
+func (x *HarnessStart) Reset() {
+ *x = HarnessStart{}
mi := &file_proto_ax_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *HarnessMessage) String() string {
+func (x *HarnessStart) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*HarnessMessage) ProtoMessage() {}
+func (*HarnessStart) ProtoMessage() {}
-func (x *HarnessMessage) ProtoReflect() protoreflect.Message {
+func (x *HarnessStart) ProtoReflect() protoreflect.Message {
mi := &file_proto_ax_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -751,32 +805,356 @@ func (x *HarnessMessage) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use HarnessMessage.ProtoReflect.Descriptor instead.
-func (*HarnessMessage) Descriptor() ([]byte, []int) {
+// Deprecated: Use HarnessStart.ProtoReflect.Descriptor instead.
+func (*HarnessStart) Descriptor() ([]byte, []int) {
return file_proto_ax_proto_rawDescGZIP(), []int{10}
}
-func (x *HarnessMessage) GetHarnessId() string {
+func (x *HarnessStart) GetHarnessConfig() []byte {
+ if x != nil {
+ return x.HarnessConfig
+ }
+ return nil
+}
+
+func (x *HarnessStart) GetMessages() []*Message {
+ if x != nil {
+ return x.Messages
+ }
+ return nil
+}
+
+// HarnessCancel aborts the in-flight harness execution.
+type HarnessCancel struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Reason CancelReason `protobuf:"varint,1,opt,name=reason,proto3,enum=ax.CancelReason" json:"reason,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *HarnessCancel) Reset() {
+ *x = HarnessCancel{}
+ mi := &file_proto_ax_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *HarnessCancel) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HarnessCancel) ProtoMessage() {}
+
+func (x *HarnessCancel) ProtoReflect() protoreflect.Message {
+ mi := &file_proto_ax_proto_msgTypes[11]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HarnessCancel.ProtoReflect.Descriptor instead.
+func (*HarnessCancel) Descriptor() ([]byte, []int) {
+ return file_proto_ax_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *HarnessCancel) GetReason() CancelReason {
+ if x != nil {
+ return x.Reason
+ }
+ return CancelReason_CANCEL_REASON_UNSPECIFIED
+}
+
+type HarnessRequest struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"`
+ HarnessId string `protobuf:"bytes,2,opt,name=harness_id,json=harnessId,proto3" json:"harness_id,omitempty"`
+ // Types that are valid to be assigned to Type:
+ //
+ // *HarnessRequest_Start
+ // *HarnessRequest_Cancel
+ Type isHarnessRequest_Type `protobuf_oneof:"type"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *HarnessRequest) Reset() {
+ *x = HarnessRequest{}
+ mi := &file_proto_ax_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *HarnessRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HarnessRequest) ProtoMessage() {}
+
+func (x *HarnessRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_proto_ax_proto_msgTypes[12]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HarnessRequest.ProtoReflect.Descriptor instead.
+func (*HarnessRequest) Descriptor() ([]byte, []int) {
+ return file_proto_ax_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *HarnessRequest) GetConversationId() string {
+ if x != nil {
+ return x.ConversationId
+ }
+ return ""
+}
+
+func (x *HarnessRequest) GetHarnessId() string {
if x != nil {
return x.HarnessId
}
return ""
}
-func (x *HarnessMessage) GetHarnessConfig() []byte {
+func (x *HarnessRequest) GetType() isHarnessRequest_Type {
if x != nil {
- return x.HarnessConfig
+ return x.Type
}
return nil
}
-func (x *HarnessMessage) GetMessages() []*Message {
+func (x *HarnessRequest) GetStart() *HarnessStart {
+ if x != nil {
+ if x, ok := x.Type.(*HarnessRequest_Start); ok {
+ return x.Start
+ }
+ }
+ return nil
+}
+
+func (x *HarnessRequest) GetCancel() *HarnessCancel {
+ if x != nil {
+ if x, ok := x.Type.(*HarnessRequest_Cancel); ok {
+ return x.Cancel
+ }
+ }
+ return nil
+}
+
+type isHarnessRequest_Type interface {
+ isHarnessRequest_Type()
+}
+
+type HarnessRequest_Start struct {
+ Start *HarnessStart `protobuf:"bytes,3,opt,name=start,proto3,oneof"`
+}
+
+type HarnessRequest_Cancel struct {
+ Cancel *HarnessCancel `protobuf:"bytes,4,opt,name=cancel,proto3,oneof"`
+}
+
+func (*HarnessRequest_Start) isHarnessRequest_Type() {}
+
+func (*HarnessRequest_Cancel) isHarnessRequest_Type() {}
+
+type HarnessOutputs struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Messages []*Message `protobuf:"bytes,1,rep,name=messages,proto3" json:"messages,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *HarnessOutputs) Reset() {
+ *x = HarnessOutputs{}
+ mi := &file_proto_ax_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *HarnessOutputs) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HarnessOutputs) ProtoMessage() {}
+
+func (x *HarnessOutputs) ProtoReflect() protoreflect.Message {
+ mi := &file_proto_ax_proto_msgTypes[13]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HarnessOutputs.ProtoReflect.Descriptor instead.
+func (*HarnessOutputs) Descriptor() ([]byte, []int) {
+ return file_proto_ax_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *HarnessOutputs) GetMessages() []*Message {
if x != nil {
return x.Messages
}
return nil
}
+type HarnessEnd struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // Terminal state for the harness execution.
+ State State `protobuf:"varint,1,opt,name=state,proto3,enum=ax.State" json:"state,omitempty"`
+ // Optional error message.
+ ErrorMessage string `protobuf:"bytes,2,opt,name=error_message,json=errorMessage,proto3" json:"error_message,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *HarnessEnd) Reset() {
+ *x = HarnessEnd{}
+ mi := &file_proto_ax_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *HarnessEnd) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HarnessEnd) ProtoMessage() {}
+
+func (x *HarnessEnd) ProtoReflect() protoreflect.Message {
+ mi := &file_proto_ax_proto_msgTypes[14]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HarnessEnd.ProtoReflect.Descriptor instead.
+func (*HarnessEnd) Descriptor() ([]byte, []int) {
+ return file_proto_ax_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *HarnessEnd) GetState() State {
+ if x != nil {
+ return x.State
+ }
+ return State_STATE_UNSPECIFIED
+}
+
+func (x *HarnessEnd) GetErrorMessage() string {
+ if x != nil {
+ return x.ErrorMessage
+ }
+ return ""
+}
+
+type HarnessResponse struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"`
+ // Types that are valid to be assigned to Type:
+ //
+ // *HarnessResponse_Outputs
+ // *HarnessResponse_End
+ Type isHarnessResponse_Type `protobuf_oneof:"type"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *HarnessResponse) Reset() {
+ *x = HarnessResponse{}
+ mi := &file_proto_ax_proto_msgTypes[15]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *HarnessResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HarnessResponse) ProtoMessage() {}
+
+func (x *HarnessResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_proto_ax_proto_msgTypes[15]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HarnessResponse.ProtoReflect.Descriptor instead.
+func (*HarnessResponse) Descriptor() ([]byte, []int) {
+ return file_proto_ax_proto_rawDescGZIP(), []int{15}
+}
+
+func (x *HarnessResponse) GetConversationId() string {
+ if x != nil {
+ return x.ConversationId
+ }
+ return ""
+}
+
+func (x *HarnessResponse) GetType() isHarnessResponse_Type {
+ if x != nil {
+ return x.Type
+ }
+ return nil
+}
+
+func (x *HarnessResponse) GetOutputs() *HarnessOutputs {
+ if x != nil {
+ if x, ok := x.Type.(*HarnessResponse_Outputs); ok {
+ return x.Outputs
+ }
+ }
+ return nil
+}
+
+func (x *HarnessResponse) GetEnd() *HarnessEnd {
+ if x != nil {
+ if x, ok := x.Type.(*HarnessResponse_End); ok {
+ return x.End
+ }
+ }
+ return nil
+}
+
+type isHarnessResponse_Type interface {
+ isHarnessResponse_Type()
+}
+
+type HarnessResponse_Outputs struct {
+ Outputs *HarnessOutputs `protobuf:"bytes,2,opt,name=outputs,proto3,oneof"`
+}
+
+type HarnessResponse_End struct {
+ End *HarnessEnd `protobuf:"bytes,3,opt,name=end,proto3,oneof"`
+}
+
+func (*HarnessResponse_Outputs) isHarnessResponse_Type() {}
+
+func (*HarnessResponse_End) isHarnessResponse_Type() {}
+
// ExecRequest for executing.
type ExecRequest struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -791,7 +1169,7 @@ type ExecRequest struct {
func (x *ExecRequest) Reset() {
*x = ExecRequest{}
- mi := &file_proto_ax_proto_msgTypes[11]
+ mi := &file_proto_ax_proto_msgTypes[16]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -803,7 +1181,7 @@ func (x *ExecRequest) String() string {
func (*ExecRequest) ProtoMessage() {}
func (x *ExecRequest) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[11]
+ mi := &file_proto_ax_proto_msgTypes[16]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -816,7 +1194,7 @@ func (x *ExecRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ExecRequest.ProtoReflect.Descriptor instead.
func (*ExecRequest) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{11}
+ return file_proto_ax_proto_rawDescGZIP(), []int{16}
}
func (x *ExecRequest) GetConversationId() string {
@@ -865,7 +1243,7 @@ type ExecResponse struct {
func (x *ExecResponse) Reset() {
*x = ExecResponse{}
- mi := &file_proto_ax_proto_msgTypes[12]
+ mi := &file_proto_ax_proto_msgTypes[17]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -877,7 +1255,7 @@ func (x *ExecResponse) String() string {
func (*ExecResponse) ProtoMessage() {}
func (x *ExecResponse) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[12]
+ mi := &file_proto_ax_proto_msgTypes[17]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -890,7 +1268,7 @@ func (x *ExecResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ExecResponse.ProtoReflect.Descriptor instead.
func (*ExecResponse) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{12}
+ return file_proto_ax_proto_rawDescGZIP(), []int{17}
}
func (x *ExecResponse) GetOutputs() []*Message {
@@ -916,7 +1294,7 @@ type DeleteConversationRequest struct {
func (x *DeleteConversationRequest) Reset() {
*x = DeleteConversationRequest{}
- mi := &file_proto_ax_proto_msgTypes[13]
+ mi := &file_proto_ax_proto_msgTypes[18]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -928,7 +1306,7 @@ func (x *DeleteConversationRequest) String() string {
func (*DeleteConversationRequest) ProtoMessage() {}
func (x *DeleteConversationRequest) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[13]
+ mi := &file_proto_ax_proto_msgTypes[18]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -941,7 +1319,7 @@ func (x *DeleteConversationRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteConversationRequest.ProtoReflect.Descriptor instead.
func (*DeleteConversationRequest) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{13}
+ return file_proto_ax_proto_rawDescGZIP(), []int{18}
}
func (x *DeleteConversationRequest) GetConversationId() string {
@@ -959,7 +1337,7 @@ type DeleteConversationResponse struct {
func (x *DeleteConversationResponse) Reset() {
*x = DeleteConversationResponse{}
- mi := &file_proto_ax_proto_msgTypes[14]
+ mi := &file_proto_ax_proto_msgTypes[19]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -971,7 +1349,7 @@ func (x *DeleteConversationResponse) String() string {
func (*DeleteConversationResponse) ProtoMessage() {}
func (x *DeleteConversationResponse) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[14]
+ mi := &file_proto_ax_proto_msgTypes[19]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -984,7 +1362,7 @@ func (x *DeleteConversationResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteConversationResponse.ProtoReflect.Descriptor instead.
func (*DeleteConversationResponse) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{14}
+ return file_proto_ax_proto_rawDescGZIP(), []int{19}
}
type ForkConversationRequest struct {
@@ -1003,7 +1381,7 @@ type ForkConversationRequest struct {
func (x *ForkConversationRequest) Reset() {
*x = ForkConversationRequest{}
- mi := &file_proto_ax_proto_msgTypes[15]
+ mi := &file_proto_ax_proto_msgTypes[20]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1015,7 +1393,7 @@ func (x *ForkConversationRequest) String() string {
func (*ForkConversationRequest) ProtoMessage() {}
func (x *ForkConversationRequest) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[15]
+ mi := &file_proto_ax_proto_msgTypes[20]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1028,7 +1406,7 @@ func (x *ForkConversationRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use ForkConversationRequest.ProtoReflect.Descriptor instead.
func (*ForkConversationRequest) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{15}
+ return file_proto_ax_proto_rawDescGZIP(), []int{20}
}
func (x *ForkConversationRequest) GetSrcConversationId() string {
@@ -1061,7 +1439,7 @@ type ForkConversationResponse struct {
func (x *ForkConversationResponse) Reset() {
*x = ForkConversationResponse{}
- mi := &file_proto_ax_proto_msgTypes[16]
+ mi := &file_proto_ax_proto_msgTypes[21]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1073,7 +1451,7 @@ func (x *ForkConversationResponse) String() string {
func (*ForkConversationResponse) ProtoMessage() {}
func (x *ForkConversationResponse) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[16]
+ mi := &file_proto_ax_proto_msgTypes[21]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1086,7 +1464,7 @@ func (x *ForkConversationResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use ForkConversationResponse.ProtoReflect.Descriptor instead.
func (*ForkConversationResponse) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{16}
+ return file_proto_ax_proto_rawDescGZIP(), []int{21}
}
func (x *ForkConversationResponse) GetConversationId() string {
@@ -1141,12 +1519,30 @@ const file_proto_ax_proto_rawDesc = "" +
"\x12HealthCheckRequest\"I\n" +
"\x13HealthCheckResponse\x12\x18\n" +
"\ahealthy\x18\x01 \x01(\bR\ahealthy\x12\x18\n" +
- "\amessage\x18\x02 \x01(\tR\amessage\"\x7f\n" +
- "\x0eHarnessMessage\x12\x1d\n" +
+ "\amessage\x18\x02 \x01(\tR\amessage\"^\n" +
+ "\fHarnessStart\x12%\n" +
+ "\x0eharness_config\x18\x01 \x01(\fR\rharnessConfig\x12'\n" +
+ "\bmessages\x18\x02 \x03(\v2\v.ax.MessageR\bmessages\"9\n" +
+ "\rHarnessCancel\x12(\n" +
+ "\x06reason\x18\x01 \x01(\x0e2\x10.ax.CancelReasonR\x06reason\"\xb7\x01\n" +
+ "\x0eHarnessRequest\x12'\n" +
+ "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12\x1d\n" +
+ "\n" +
+ "harness_id\x18\x02 \x01(\tR\tharnessId\x12(\n" +
+ "\x05start\x18\x03 \x01(\v2\x10.ax.HarnessStartH\x00R\x05start\x12+\n" +
+ "\x06cancel\x18\x04 \x01(\v2\x11.ax.HarnessCancelH\x00R\x06cancelB\x06\n" +
+ "\x04type\"9\n" +
+ "\x0eHarnessOutputs\x12'\n" +
+ "\bmessages\x18\x01 \x03(\v2\v.ax.MessageR\bmessages\"R\n" +
"\n" +
- "harness_id\x18\x01 \x01(\tR\tharnessId\x12%\n" +
- "\x0eharness_config\x18\x02 \x01(\fR\rharnessConfig\x12'\n" +
- "\bmessages\x18\x03 \x03(\v2\v.ax.MessageR\bmessages\"\xb4\x01\n" +
+ "HarnessEnd\x12\x1f\n" +
+ "\x05state\x18\x01 \x01(\x0e2\t.ax.StateR\x05state\x12#\n" +
+ "\rerror_message\x18\x02 \x01(\tR\ferrorMessage\"\x96\x01\n" +
+ "\x0fHarnessResponse\x12'\n" +
+ "\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" +
"\vExecRequest\x12'\n" +
"\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12#\n" +
"\x06inputs\x18\x02 \x03(\v2\v.ax.MessageR\x06inputs\x12\x19\n" +
@@ -1164,17 +1560,23 @@ const file_proto_ax_proto_rawDesc = "" +
"\asrc_seq\x18\x02 \x01(\x05R\x06srcSeq\x120\n" +
"\x14dest_conversation_id\x18\x03 \x01(\tR\x12destConversationId\"C\n" +
"\x18ForkConversationResponse\x12'\n" +
- "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId*X\n" +
+ "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId*l\n" +
"\x05State\x12\x15\n" +
"\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n" +
"\rSTATE_PENDING\x10\x01\x12\x10\n" +
"\fSTATE_FAILED\x10\x02\x12\x13\n" +
- "\x0fSTATE_COMPLETED\x10\x032\x80\x01\n" +
+ "\x0fSTATE_COMPLETED\x10\x03\x12\x12\n" +
+ "\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n" +
+ "\fCancelReason\x12\x1d\n" +
+ "\x19CANCEL_REASON_UNSPECIFIED\x10\x00\x12 \n" +
+ "\x1cCANCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n" +
+ "\x15CANCEL_REASON_TIMEOUT\x10\x02\x12 \n" +
+ "\x1cCANCEL_REASON_INTERNAL_ERROR\x10\x032\x80\x01\n" +
"\fAgentService\x120\n" +
"\aConnect\x12\x10.ax.AgentRequest\x1a\x11.ax.AgentResponse0\x01\x12>\n" +
- "\vHealthCheck\x12\x16.ax.HealthCheckRequest\x1a\x17.ax.HealthCheckResponse2G\n" +
- "\x0eHarnessService\x125\n" +
- "\aConnect\x12\x12.ax.HarnessMessage\x1a\x12.ax.HarnessMessage(\x010\x012@\n" +
+ "\vHealthCheck\x12\x16.ax.HealthCheckRequest\x1a\x17.ax.HealthCheckResponse2H\n" +
+ "\x0eHarnessService\x126\n" +
+ "\aConnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x010\x012@\n" +
"\x11ControllerService\x12+\n" +
"\x04Exec\x12\x0f.ax.ExecRequest\x1a\x10.ax.ExecResponse0\x012\xb9\x01\n" +
"\x13ConversationService\x12S\n" +
@@ -1193,63 +1595,76 @@ func file_proto_ax_proto_rawDescGZIP() []byte {
return file_proto_ax_proto_rawDescData
}
-var file_proto_ax_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
-var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 17)
+var file_proto_ax_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
+var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 22)
var file_proto_ax_proto_goTypes = []any{
(State)(0), // 0: ax.State
- (*AgentStart)(nil), // 1: ax.AgentStart
- (*AgentOutputs)(nil), // 2: ax.AgentOutputs
- (*AgentEnd)(nil), // 3: ax.AgentEnd
- (*AgentRequest)(nil), // 4: ax.AgentRequest
- (*AgentResponse)(nil), // 5: ax.AgentResponse
- (*Message)(nil), // 6: ax.Message
- (*ConversationEvent)(nil), // 7: ax.ConversationEvent
- (*ExecutionEvent)(nil), // 8: ax.ExecutionEvent
- (*HealthCheckRequest)(nil), // 9: ax.HealthCheckRequest
- (*HealthCheckResponse)(nil), // 10: ax.HealthCheckResponse
- (*HarnessMessage)(nil), // 11: ax.HarnessMessage
- (*ExecRequest)(nil), // 12: ax.ExecRequest
- (*ExecResponse)(nil), // 13: ax.ExecResponse
- (*DeleteConversationRequest)(nil), // 14: ax.DeleteConversationRequest
- (*DeleteConversationResponse)(nil), // 15: ax.DeleteConversationResponse
- (*ForkConversationRequest)(nil), // 16: ax.ForkConversationRequest
- (*ForkConversationResponse)(nil), // 17: ax.ForkConversationResponse
- (*Content)(nil), // 18: ax.Content
- (*timestamppb.Timestamp)(nil), // 19: google.protobuf.Timestamp
+ (CancelReason)(0), // 1: ax.CancelReason
+ (*AgentStart)(nil), // 2: ax.AgentStart
+ (*AgentOutputs)(nil), // 3: ax.AgentOutputs
+ (*AgentEnd)(nil), // 4: ax.AgentEnd
+ (*AgentRequest)(nil), // 5: ax.AgentRequest
+ (*AgentResponse)(nil), // 6: ax.AgentResponse
+ (*Message)(nil), // 7: ax.Message
+ (*ConversationEvent)(nil), // 8: ax.ConversationEvent
+ (*ExecutionEvent)(nil), // 9: ax.ExecutionEvent
+ (*HealthCheckRequest)(nil), // 10: ax.HealthCheckRequest
+ (*HealthCheckResponse)(nil), // 11: ax.HealthCheckResponse
+ (*HarnessStart)(nil), // 12: ax.HarnessStart
+ (*HarnessCancel)(nil), // 13: ax.HarnessCancel
+ (*HarnessRequest)(nil), // 14: ax.HarnessRequest
+ (*HarnessOutputs)(nil), // 15: ax.HarnessOutputs
+ (*HarnessEnd)(nil), // 16: ax.HarnessEnd
+ (*HarnessResponse)(nil), // 17: ax.HarnessResponse
+ (*ExecRequest)(nil), // 18: ax.ExecRequest
+ (*ExecResponse)(nil), // 19: ax.ExecResponse
+ (*DeleteConversationRequest)(nil), // 20: ax.DeleteConversationRequest
+ (*DeleteConversationResponse)(nil), // 21: ax.DeleteConversationResponse
+ (*ForkConversationRequest)(nil), // 22: ax.ForkConversationRequest
+ (*ForkConversationResponse)(nil), // 23: ax.ForkConversationResponse
+ (*Content)(nil), // 24: ax.Content
+ (*timestamppb.Timestamp)(nil), // 25: google.protobuf.Timestamp
}
var file_proto_ax_proto_depIdxs = []int32{
- 6, // 0: ax.AgentStart.messages:type_name -> ax.Message
- 6, // 1: ax.AgentOutputs.messages:type_name -> ax.Message
- 1, // 2: ax.AgentRequest.start:type_name -> ax.AgentStart
- 2, // 3: ax.AgentResponse.outputs:type_name -> ax.AgentOutputs
- 3, // 4: ax.AgentResponse.end:type_name -> ax.AgentEnd
- 18, // 5: ax.Message.content:type_name -> ax.Content
- 6, // 6: ax.ConversationEvent.messages:type_name -> ax.Message
+ 7, // 0: ax.AgentStart.messages:type_name -> ax.Message
+ 7, // 1: ax.AgentOutputs.messages:type_name -> ax.Message
+ 2, // 2: ax.AgentRequest.start:type_name -> ax.AgentStart
+ 3, // 3: ax.AgentResponse.outputs:type_name -> ax.AgentOutputs
+ 4, // 4: ax.AgentResponse.end:type_name -> ax.AgentEnd
+ 24, // 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
- 6, // 8: ax.ExecutionEvent.inputs:type_name -> ax.Message
- 6, // 9: ax.ExecutionEvent.outputs:type_name -> ax.Message
+ 7, // 8: ax.ExecutionEvent.inputs:type_name -> ax.Message
+ 7, // 9: ax.ExecutionEvent.outputs:type_name -> ax.Message
0, // 10: ax.ExecutionEvent.state:type_name -> ax.State
- 19, // 11: ax.ExecutionEvent.timestamp:type_name -> google.protobuf.Timestamp
- 6, // 12: ax.HarnessMessage.messages:type_name -> ax.Message
- 6, // 13: ax.ExecRequest.inputs:type_name -> ax.Message
- 6, // 14: ax.ExecResponse.outputs:type_name -> ax.Message
- 4, // 15: ax.AgentService.Connect:input_type -> ax.AgentRequest
- 9, // 16: ax.AgentService.HealthCheck:input_type -> ax.HealthCheckRequest
- 11, // 17: ax.HarnessService.Connect:input_type -> ax.HarnessMessage
- 12, // 18: ax.ControllerService.Exec:input_type -> ax.ExecRequest
- 14, // 19: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest
- 16, // 20: ax.ConversationService.ForkConversation:input_type -> ax.ForkConversationRequest
- 5, // 21: ax.AgentService.Connect:output_type -> ax.AgentResponse
- 10, // 22: ax.AgentService.HealthCheck:output_type -> ax.HealthCheckResponse
- 11, // 23: ax.HarnessService.Connect:output_type -> ax.HarnessMessage
- 13, // 24: ax.ControllerService.Exec:output_type -> ax.ExecResponse
- 15, // 25: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse
- 17, // 26: ax.ConversationService.ForkConversation:output_type -> ax.ForkConversationResponse
- 21, // [21:27] is the sub-list for method output_type
- 15, // [15:21] is the sub-list for method input_type
- 15, // [15:15] is the sub-list for extension type_name
- 15, // [15:15] is the sub-list for extension extendee
- 0, // [0:15] is the sub-list for field type_name
+ 25, // 11: ax.ExecutionEvent.timestamp:type_name -> google.protobuf.Timestamp
+ 7, // 12: ax.HarnessStart.messages:type_name -> ax.Message
+ 1, // 13: ax.HarnessCancel.reason:type_name -> ax.CancelReason
+ 12, // 14: ax.HarnessRequest.start:type_name -> ax.HarnessStart
+ 13, // 15: ax.HarnessRequest.cancel:type_name -> ax.HarnessCancel
+ 7, // 16: ax.HarnessOutputs.messages:type_name -> ax.Message
+ 0, // 17: ax.HarnessEnd.state:type_name -> ax.State
+ 15, // 18: ax.HarnessResponse.outputs:type_name -> ax.HarnessOutputs
+ 16, // 19: ax.HarnessResponse.end:type_name -> ax.HarnessEnd
+ 7, // 20: ax.ExecRequest.inputs:type_name -> ax.Message
+ 7, // 21: ax.ExecResponse.outputs:type_name -> ax.Message
+ 5, // 22: ax.AgentService.Connect:input_type -> ax.AgentRequest
+ 10, // 23: ax.AgentService.HealthCheck:input_type -> ax.HealthCheckRequest
+ 14, // 24: ax.HarnessService.Connect:input_type -> ax.HarnessRequest
+ 18, // 25: ax.ControllerService.Exec:input_type -> ax.ExecRequest
+ 20, // 26: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest
+ 22, // 27: ax.ConversationService.ForkConversation:input_type -> ax.ForkConversationRequest
+ 6, // 28: ax.AgentService.Connect:output_type -> ax.AgentResponse
+ 11, // 29: ax.AgentService.HealthCheck:output_type -> ax.HealthCheckResponse
+ 17, // 30: ax.HarnessService.Connect:output_type -> ax.HarnessResponse
+ 19, // 31: ax.ControllerService.Exec:output_type -> ax.ExecResponse
+ 21, // 32: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse
+ 23, // 33: ax.ConversationService.ForkConversation:output_type -> ax.ForkConversationResponse
+ 28, // [28:34] is the sub-list for method output_type
+ 22, // [22:28] is the sub-list for method input_type
+ 22, // [22:22] is the sub-list for extension type_name
+ 22, // [22:22] is the sub-list for extension extendee
+ 0, // [0:22] is the sub-list for field type_name
}
func init() { file_proto_ax_proto_init() }
@@ -1262,13 +1677,21 @@ func file_proto_ax_proto_init() {
(*AgentResponse_Outputs)(nil),
(*AgentResponse_End)(nil),
}
+ file_proto_ax_proto_msgTypes[12].OneofWrappers = []any{
+ (*HarnessRequest_Start)(nil),
+ (*HarnessRequest_Cancel)(nil),
+ }
+ file_proto_ax_proto_msgTypes[15].OneofWrappers = []any{
+ (*HarnessResponse_Outputs)(nil),
+ (*HarnessResponse_End)(nil),
+ }
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_ax_proto_rawDesc), len(file_proto_ax_proto_rawDesc)),
- NumEnums: 1,
- NumMessages: 17,
+ NumEnums: 2,
+ NumMessages: 22,
NumExtensions: 0,
NumServices: 4,
},
diff --git a/proto/ax.proto b/proto/ax.proto
index 62d68e9..a875d6b 100644
--- a/proto/ax.proto
+++ b/proto/ax.proto
@@ -109,16 +109,51 @@ service AgentService {
rpc HealthCheck(HealthCheckRequest) returns (HealthCheckResponse);
}
-message HarnessMessage {
- // TODO(jbd): This is a placeholder message
- // and will be replaced with the actual protocol.
- string harness_id = 1; // The unique identifier of the harness.
- bytes harness_config = 2; // The configuration for the harness.
- repeated Message messages = 3; // The input/output messages.
+message HarnessStart {
+ // Per-execution harness configuration.
+ bytes harness_config = 1;
+ repeated Message messages = 2;
+}
+
+// HarnessCancel aborts the in-flight harness execution.
+message HarnessCancel {
+ CancelReason reason = 1;
+}
+
+message HarnessRequest {
+ string conversation_id = 1;
+ string harness_id = 2;
+ oneof type {
+ HarnessStart start = 3;
+ HarnessCancel cancel = 4;
+ }
+}
+
+message HarnessOutputs {
+ repeated Message messages = 1;
+}
+
+message HarnessEnd {
+ // Terminal state for the harness execution.
+ State state = 1;
+ // Optional error message.
+ string error_message = 2;
+}
+
+message HarnessResponse {
+ string conversation_id = 1;
+ oneof type {
+ HarnessOutputs outputs = 2;
+ HarnessEnd end = 3;
+ }
}
service HarnessService {
- rpc Connect(stream HarnessMessage) returns (stream HarnessMessage);
+ // Connect drives one harness execution. The client sends
+ // HarnessRequest{start} (and may send one HarnessRequest{cancel}
+ // mid-stream), and the server streams zero or more HarnessResponse{outputs}
+ // frames terminated by exactly one HarnessResponse{end}.
+ rpc Connect(stream HarnessRequest) returns (stream HarnessResponse);
}
// State represents the state of an execution
@@ -127,6 +162,15 @@ enum State {
STATE_PENDING = 1;
STATE_FAILED = 2;
STATE_COMPLETED = 3;
+ STATE_CANCELED = 4;
+}
+
+// CancelReason explains why an in-flight execution is canceled.
+enum CancelReason {
+ CANCEL_REASON_UNSPECIFIED = 0;
+ CANCEL_REASON_USER_REQUESTED = 1;
+ CANCEL_REASON_TIMEOUT = 2;
+ CANCEL_REASON_INTERNAL_ERROR = 3;
}
// ExecRequest for executing.
diff --git a/proto/ax_grpc.pb.go b/proto/ax_grpc.pb.go
index d2786db..42fad49 100644
--- a/proto/ax_grpc.pb.go
+++ b/proto/ax_grpc.pb.go
@@ -14,7 +14,7 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.6.0
+// - protoc-gen-go-grpc v1.6.1
// - protoc v7.34.1
// source: proto/ax.proto
@@ -204,7 +204,11 @@ const (
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type HarnessServiceClient interface {
- Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[HarnessMessage, HarnessMessage], error)
+ // Connect drives one harness execution. The client sends
+ // HarnessRequest{start} (and may send one HarnessRequest{cancel}
+ // mid-stream), and the server streams zero or more HarnessResponse{outputs}
+ // frames terminated by exactly one HarnessResponse{end}.
+ Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[HarnessRequest, HarnessResponse], error)
}
type harnessServiceClient struct {
@@ -215,24 +219,28 @@ func NewHarnessServiceClient(cc grpc.ClientConnInterface) HarnessServiceClient {
return &harnessServiceClient{cc}
}
-func (c *harnessServiceClient) Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[HarnessMessage, HarnessMessage], error) {
+func (c *harnessServiceClient) Connect(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[HarnessRequest, HarnessResponse], error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &HarnessService_ServiceDesc.Streams[0], HarnessService_Connect_FullMethodName, cOpts...)
if err != nil {
return nil, err
}
- x := &grpc.GenericClientStream[HarnessMessage, HarnessMessage]{ClientStream: stream}
+ x := &grpc.GenericClientStream[HarnessRequest, HarnessResponse]{ClientStream: stream}
return x, nil
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
-type HarnessService_ConnectClient = grpc.BidiStreamingClient[HarnessMessage, HarnessMessage]
+type HarnessService_ConnectClient = grpc.BidiStreamingClient[HarnessRequest, HarnessResponse]
// HarnessServiceServer is the server API for HarnessService service.
// All implementations must embed UnimplementedHarnessServiceServer
// for forward compatibility.
type HarnessServiceServer interface {
- Connect(grpc.BidiStreamingServer[HarnessMessage, HarnessMessage]) error
+ // Connect drives one harness execution. The client sends
+ // HarnessRequest{start} (and may send one HarnessRequest{cancel}
+ // mid-stream), and the server streams zero or more HarnessResponse{outputs}
+ // frames terminated by exactly one HarnessResponse{end}.
+ Connect(grpc.BidiStreamingServer[HarnessRequest, HarnessResponse]) error
mustEmbedUnimplementedHarnessServiceServer()
}
@@ -243,7 +251,7 @@ type HarnessServiceServer interface {
// pointer dereference when methods are called.
type UnimplementedHarnessServiceServer struct{}
-func (UnimplementedHarnessServiceServer) Connect(grpc.BidiStreamingServer[HarnessMessage, HarnessMessage]) error {
+func (UnimplementedHarnessServiceServer) Connect(grpc.BidiStreamingServer[HarnessRequest, HarnessResponse]) error {
return status.Error(codes.Unimplemented, "method Connect not implemented")
}
func (UnimplementedHarnessServiceServer) mustEmbedUnimplementedHarnessServiceServer() {}
@@ -268,11 +276,11 @@ func RegisterHarnessServiceServer(s grpc.ServiceRegistrar, srv HarnessServiceSer
}
func _HarnessService_Connect_Handler(srv interface{}, stream grpc.ServerStream) error {
- return srv.(HarnessServiceServer).Connect(&grpc.GenericServerStream[HarnessMessage, HarnessMessage]{ServerStream: stream})
+ return srv.(HarnessServiceServer).Connect(&grpc.GenericServerStream[HarnessRequest, HarnessResponse]{ServerStream: stream})
}
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
-type HarnessService_ConnectServer = grpc.BidiStreamingServer[HarnessMessage, HarnessMessage]
+type HarnessService_ConnectServer = grpc.BidiStreamingServer[HarnessRequest, HarnessResponse]
// HarnessService_ServiceDesc is the grpc.ServiceDesc for HarnessService service.
// It's only intended for direct use with grpc.RegisterService,