Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Remove dead code from the earlier controller (#196)

Jaana Dogan2abfec209d6c
diff --git a/internal/agent/agent.go b/internal/agent/agent.go
deleted file mode 100644
index 335f991..0000000
--- a/internal/agent/agent.go
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2026 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Package agent provides interfaces and implementations for local and remote agents.
-// Agents process content through callback handlers and can be registered with the controller.
-package agent
-
-import (
- "context"
-
- "github.com/google/ax/proto"
-)
-
-// OutputHandler is a callback function that handles output content from an agent.
-// It is called for each piece of content the agent generates.
-type OutputHandler func(outgoing *proto.AgentOutputs) error
-
-type Executor interface {
- Exec(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, o OutputHandler) (proto.State, error)
-}
-
-// Agent defines the common interface for both local and remote agents.
-// Agents process content using callback handlers.
-type Agent interface {
- // Connect handles processing of input content.
- // It calls the output handler for each piece of content generated.
- // The handler may be called multiple times during processing.
- Connect(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e Executor, o OutputHandler) error
-
- // Close gracefully shuts down the agent and releases resources.
- Close() error
-}
-
-// AgentInfo contains metadata about a registered agent.
-type AgentInfo struct {
- ID string
- Name string
- Description string
- Metadata map[string]string
-}
diff --git a/internal/agent/local.go b/internal/agent/local.go
deleted file mode 100644
index a7ec027..0000000
--- a/internal/agent/local.go
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2026 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package agent
-
-import (
- "context"
-
- "fmt"
-
- "github.com/google/ax/proto"
-)
-
-// LocalAgent wraps a local (in-process) agent implementation.
-// It implements the Agent interface for agents running in the same process as the controller.
-type LocalAgent struct {
- processFunc func(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e Executor, o OutputHandler) error
-}
-
-// LocalAgentConfig configures a local agent.
-type LocalAgentConfig struct {
- ProcessFunc func(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e Executor, o OutputHandler) error
-}
-
-// NewLocalAgent creates a new local agent with the provided configuration.
-func NewLocalAgent(config LocalAgentConfig) (*LocalAgent, error) {
- if config.ProcessFunc == nil {
- return nil, fmt.Errorf("ProcessFunc cannot be nil")
- }
-
- return &LocalAgent{
- processFunc: config.ProcessFunc,
- }, nil
-}
-
-// Connect handles processing of input content with callback handler.
-func (a *LocalAgent) Connect(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e Executor, o OutputHandler) error {
- return a.processFunc(ctx, conversationID, execID, start, e, o)
-}
-
-// Close gracefully shuts down the agent.
-func (a *LocalAgent) Close() error {
- // Local agents don't typically need cleanup, but this can be extended
- return nil
-}
diff --git a/internal/gemini/config.go b/internal/gemini/config.go
deleted file mode 100644
index 9ccf9d8..0000000
--- a/internal/gemini/config.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2026 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package gemini
-
-import "time"
-
-// GeminiConfig is the configuration for a Gemini agent execution.
-type GeminiConfig struct {
- Model string `json:"model,omitempty" yaml:"model,omitempty"`
- SystemPrompt string `json:"system_prompt,omitempty" yaml:"system_prompt,omitempty"`
- MaxTokens int32 `json:"max_tokens,omitempty" yaml:"max_tokens,omitempty"`
- Temperature float32 `json:"temperature,omitempty" yaml:"temperature,omitempty"` // 0 means use model default
- Timeout time.Duration `json:"timeout,omitempty" yaml:"timeout,omitempty"`
- Tools []string `json:"tools,omitempty" yaml:"tools,omitempty"`
-}
diff --git a/internal/gemini/gemini.go b/internal/gemini/gemini.go
deleted file mode 100644
index bdd2c68..0000000
--- a/internal/gemini/gemini.go
+++ /dev/null
@@ -1,593 +0,0 @@
-// Copyright 2026 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package gemini
-
-import (
- "context"
- "encoding/json"
- "errors"
- "fmt"
- "os"
- "os/exec"
- "runtime"
- "strings"
- "time"
-
- "github.com/google/ax/internal/agent"
- "github.com/google/ax/internal/skills"
- "github.com/google/ax/proto"
- "google.golang.org/genai"
- "google.golang.org/protobuf/types/known/structpb"
-)
-
-// GeminiAgent implements task.Agent using Gemini.
-type GeminiAgent struct {
-}
-
-// NewGeminiAgent creates a new Gemini agent.
-func NewGeminiAgent() *GeminiAgent {
- return &GeminiAgent{}
-}
-
-func (a *GeminiAgent) config(start *proto.AgentStart) (*GeminiConfig, error) {
- if len(start.AgentConfig) == 0 {
- return &GeminiConfig{
- Model: "gemini-3.5-flash",
- Timeout: 30 * time.Second,
- }, nil
- }
-
- var cfg GeminiConfig
- if err := json.Unmarshal(start.AgentConfig, &cfg); err != nil {
- return nil, fmt.Errorf("failed to unmarshal Gemini config: %w", err)
- }
- return &cfg, nil
-}
-
-func (a *GeminiAgent) Connect(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e agent.Executor, handler agent.OutputHandler) error {
- cfg, err := a.config(start)
- if err != nil {
- return err
- }
-
- client, err := genai.NewClient(ctx, &genai.ClientConfig{})
- if err != nil {
- return fmt.Errorf("failed to create Gemini client: %w", err)
- }
-
- inputs := start.Messages
- contents := protoToContents(inputs)
- timeout := 30 * time.Second
- if cfg.Timeout != 0 {
- timeout = cfg.Timeout
- }
- ctx, cancel := context.WithTimeout(ctx, timeout)
- defer cancel()
-
- var systemPrompt *genai.Content
- if cfg.SystemPrompt != "" {
- systemPrompt = genai.Text(cfg.SystemPrompt)[0]
- }
- var tools []*genai.Tool
- for _, t := range cfg.Tools {
- switch t {
- case "google_search":
- tools = append(tools, &genai.Tool{GoogleSearch: &genai.GoogleSearch{}})
- case "url_context":
- tools = append(tools, &genai.Tool{URLContext: &genai.URLContext{}})
- case "code_execution":
- tools = append(tools, &genai.Tool{CodeExecution: &genai.ToolCodeExecution{}})
- case "google_maps":
- tools = append(tools, &genai.Tool{GoogleMaps: &genai.GoogleMaps{}})
- default:
- return fmt.Errorf("unsupported tool: %q", t)
- }
- }
-
- resp, err := client.Models.GenerateContent(ctx, cfg.Model, contents, &genai.GenerateContentConfig{
- SystemInstruction: systemPrompt,
- MaxOutputTokens: cfg.MaxTokens,
- CandidateCount: 1,
- Tools: tools,
- })
- if err != nil {
- return fmt.Errorf("failed to generate: %w", err)
- }
-
- if len(resp.Candidates) == 0 {
- return fmt.Errorf("no candidates from Gemini in planner")
- }
- candidate := resp.Candidates[0]
- if candidate.Content == nil || candidate.Content.Parts == nil {
- return fmt.Errorf("no content in candidates from Gemini")
- }
-
- respCount := 0
- for _, part := range candidate.Content.Parts {
- if part == nil {
- continue
- }
- if part.Text != "" {
- respCount++
- if err := handler(&proto.AgentOutputs{
- Messages: []*proto.Message{{
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{Text: part.Text},
- },
- },
- }},
- }); err != nil {
- return err
- }
- }
- }
- if respCount == 0 {
- return errors.New("no responses from Gemini")
- }
- return nil
-}
-
-func (a *GeminiAgent) Close() error {
- return nil
-}
-
-type Tool interface {
- Name() string
- FuncDecl() []*genai.Tool
- SystemPrompt() string
- HandleCall(ctx context.Context, fc *genai.FunctionCall, o agent.OutputHandler) error
- HandleExecute(ctx context.Context, fc *genai.FunctionCall, approved bool, o agent.OutputHandler) error
-}
-
-type BashTool struct{}
-
-func (t *BashTool) Name() string {
- return "bash"
-}
-
-func (t *BashTool) SystemPrompt() string {
- return ""
-}
-
-func (t *BashTool) FuncDecl() []*genai.Tool {
- osInfo := fmt.Sprintf("User's Operating System: %s (%s)", runtime.GOOS, runtime.GOARCH)
- description := fmt.Sprintf("OS specific bash execution tool. %s. Generate commands appropriate for this OS. Never produce code, only use existing command line programs available in the system.", osInfo)
-
- return []*genai.Tool{{
- FunctionDeclarations: []*genai.FunctionDeclaration{
- {
- Name: t.Name(),
- Description: description,
- Parameters: &genai.Schema{
- Type: genai.TypeObject,
- Properties: map[string]*genai.Schema{
- "command": {
- Type: genai.TypeString,
- Description: "The shell command to execute (e.g., 'ls -la' for Unix/macOS, 'dir' for Windows, 'cat file.txt', etc.)",
- },
- },
- Required: []string{"command"},
- },
- },
- },
- }}
-}
-
-func (t *BashTool) HandleCall(ctx context.Context, fc *genai.FunctionCall, o agent.OutputHandler) error {
- if disallow, _ := ctx.Value(disallowConfirmationsKey).(bool); disallow {
- return t.HandleExecute(ctx, fc, true, o)
- }
- command, _ := fc.Args["command"].(string)
- argsStruct, err := structpb.NewStruct(fc.Args)
- if err != nil {
- return err
- }
- return o(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolCall{
- ToolCall: &proto.ToolCallContent{
- Id: fc.ID,
- Type: &proto.ToolCallContent_FunctionCall{
- FunctionCall: &proto.FunctionCallContent{
- Name: fc.Name,
- Arguments: argsStruct,
- },
- },
- },
- },
- },
- },
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_Confirmation{
- Confirmation: &proto.ConfirmationContent{
- Id: fc.ID,
- Question: fmt.Sprintf("Can I run %q?", command),
- },
- },
- },
- }},
- })
-}
-
-func (t *BashTool) HandleExecute(ctx context.Context, fc *genai.FunctionCall, approved bool, o agent.OutputHandler) error {
- if !approved {
- // Declined, nothing to do in terms of executing any commands.
- // But we still have to finish with a function response,
- // not to keep the previously log function call hanging forever.
- return o(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolResult{
- ToolResult: &proto.ToolResultContent{
- CallId: fc.ID,
- Type: &proto.ToolResultContent_FunctionResult{
- FunctionResult: &proto.FunctionResultContent{
- Name: fc.Name,
- },
- },
- },
- },
- },
- },
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{
- Text: "Okay.",
- },
- },
- },
- },
- },
- })
- }
-
- output, err := execute(ctx, fc.Args)
- if err != nil {
- return err
- }
- respStruct, err := structpb.NewStruct(map[string]any{"result": output})
- if err != nil {
- return fmt.Errorf("failed to convert function response to structpb: %w", err)
- }
- return o(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolResult{
- ToolResult: &proto.ToolResultContent{
- CallId: fc.ID,
- Type: &proto.ToolResultContent_FunctionResult{
- FunctionResult: &proto.FunctionResultContent{
- Name: fc.Name,
- Result: &proto.FunctionResultContent_Response{
- Response: respStruct,
- },
- },
- },
- },
- },
- },
- },
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{
- Text: output,
- },
- },
- },
- },
- },
- })
-}
-
-type SkillsTool struct {
- executor *skills.Executor
-}
-
-func NewSkillsTool(dir string) (Tool, error) {
- resolvedDir := dir
- if resolvedDir == "" {
- resolvedDir = os.Getenv("SKILLS_DIR")
- }
- if resolvedDir == "" {
- // No skills directory explicitly configured; disable skills completely.
- return &NoopTool{}, nil
- }
- if _, err := os.Stat(resolvedDir); os.IsNotExist(err) {
- return &NoopTool{}, nil
- }
-
- executor, err := skills.NewExecutor(resolvedDir)
- if err != nil {
- // If no skills are found or the directory does not exist, fallback to a no-op tool
- // to avoid hard errors when skills are not configured or available.
- if errors.Is(err, skills.ErrNoSkills) || errors.Is(err, os.ErrNotExist) {
- return &NoopTool{}, nil
- }
- return nil, err
- }
- return &SkillsTool{executor: executor}, nil
-}
-
-func (t *SkillsTool) Name() string {
- return ""
-}
-
-func (t *SkillsTool) SystemPrompt() string {
- return t.executor.SystemPrompt()
-}
-
-func (t *SkillsTool) FuncDecl() []*genai.Tool {
- if !t.executor.HasSkills() {
- return []*genai.Tool{}
- }
- return []*genai.Tool{skills.BuildTool(t.executor.SkillNames())}
-}
-
-func (t *SkillsTool) HandleCall(ctx context.Context, fc *genai.FunctionCall, o agent.OutputHandler) error {
- if disallow, _ := ctx.Value(disallowConfirmationsKey).(bool); disallow {
- return t.HandleExecute(ctx, fc, true, o)
- }
- argsStruct, err := structpb.NewStruct(fc.Args)
- if err != nil {
- return err
- }
-
- if fc.Name == "activate_skill" {
- // Skill activation is always approved.
- return t.HandleExecute(ctx, fc, true, o)
- }
-
- if fc.Name == "run_skill_script" {
- skill, _ := fc.Args["skill"].(string)
- script, _ := fc.Args["script"].(string)
- question := fmt.Sprintf("Can I run script %q from skill %q?", script, skill)
-
- return o(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolCall{
- ToolCall: &proto.ToolCallContent{
- Id: fc.ID,
- Type: &proto.ToolCallContent_FunctionCall{
- FunctionCall: &proto.FunctionCallContent{
- Name: fc.Name,
- Arguments: argsStruct,
- },
- },
- },
- },
- },
- },
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_Confirmation{
- Confirmation: &proto.ConfirmationContent{
- Id: fc.ID,
- Question: question,
- },
- },
- },
- }},
- })
- }
- return nil
-}
-
-func (t *SkillsTool) HandleExecute(ctx context.Context, fc *genai.FunctionCall, approved bool, o agent.OutputHandler) error {
- if fc.Name == "activate_skill" {
- var output string
- result, err := t.executor.HandleCall(ctx, fc)
- if err != nil {
- output = "Error: " + err.Error()
- } else {
- var parts []string
- if result.Stdout != "" {
- parts = append(parts, result.Stdout)
- }
- if result.Stderr != "" {
- parts = append(parts, "Stderr: "+result.Stderr)
- }
- output = strings.Join(parts, "\n")
- }
-
- respStruct, err := structpb.NewStruct(map[string]any{"result": output})
- if err != nil {
- return fmt.Errorf("failed to convert function response to structpb: %w", err)
- }
-
- return o(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolResult{
- ToolResult: &proto.ToolResultContent{
- CallId: fc.ID,
- Type: &proto.ToolResultContent_FunctionResult{
- FunctionResult: &proto.FunctionResultContent{
- Name: fc.Name,
- Result: &proto.FunctionResultContent_Response{
- Response: respStruct,
- },
- },
- },
- },
- },
- },
- },
- },
- })
- }
-
- if !approved {
- // Declined, nothing to do in terms of executing any commands.
- // But we still have to finish with a function response,
- // not to keep the previously log function call hanging forever.
- return o(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolResult{
- ToolResult: &proto.ToolResultContent{
- CallId: fc.ID,
- Type: &proto.ToolResultContent_FunctionResult{
- FunctionResult: &proto.FunctionResultContent{
- Name: fc.Name,
- },
- },
- },
- },
- },
- },
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{
- Text: "Okay.",
- },
- },
- },
- },
- },
- })
- }
-
- var output string
- if fc.Name == "run_skill_script" || fc.Name == "activate_skill" {
- result, err := t.executor.HandleCall(ctx, fc)
- if err != nil {
- output = "Error: " + err.Error()
- } else {
- var parts []string
- if result.Stdout != "" {
- parts = append(parts, result.Stdout)
- }
- if result.Stderr != "" {
- parts = append(parts, "Stderr: "+result.Stderr)
- }
- output = strings.Join(parts, "\n")
- }
- }
-
- respStruct, err := structpb.NewStruct(map[string]any{"result": output})
- if err != nil {
- return fmt.Errorf("failed to convert function response to structpb: %w", err)
- }
- return o(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolResult{
- ToolResult: &proto.ToolResultContent{
- CallId: fc.ID,
- Type: &proto.ToolResultContent_FunctionResult{
- FunctionResult: &proto.FunctionResultContent{
- Name: fc.Name,
- Result: &proto.FunctionResultContent_Response{
- Response: respStruct,
- },
- },
- },
- },
- },
- },
- },
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{
- Text: output,
- },
- },
- },
- },
- },
- })
-}
-
-type NoopTool struct {
-}
-
-func (t *NoopTool) Name() string {
- return ""
-}
-
-func (t *NoopTool) SystemPrompt() string {
- return ""
-}
-
-func (t *NoopTool) FuncDecl() []*genai.Tool {
- return []*genai.Tool{}
-}
-
-func (t *NoopTool) HandleCall(ctx context.Context, fc *genai.FunctionCall, o agent.OutputHandler) error {
- return errors.New("cannot call noop tool")
-}
-
-func (t *NoopTool) HandleExecute(ctx context.Context, fc *genai.FunctionCall, approved bool, o agent.OutputHandler) error {
- return errors.New("cannot execute noop tool")
-}
-
-func execute(ctx context.Context, args map[string]any) (string, error) {
- command, ok := args["command"].(string)
- if !ok {
- return "", fmt.Errorf("command parameter missing or invalid")
- }
-
- // Execute the command. exec.CommandContext kills the process if ctx
- // is cancelled (e.g. the planner loop is shutting down or the gRPC
- // Exec stream is cancelled), so a long-running command like
- // `find / -name ...` doesn't outlive the controller.
- var cmd *exec.Cmd
- if runtime.GOOS == "windows" {
- cmd = exec.CommandContext(ctx, "cmd", "/C", command)
- } else {
- cmd = exec.CommandContext(ctx, "sh", "-c", command)
- }
-
- output, err := cmd.CombinedOutput()
- if err != nil {
- // Return both the error and any output that was produced
- return fmt.Sprintf("Error: %v\nOutput: %s\n\n", err, output), nil
- }
-
- result := strings.TrimSpace(string(output))
- if result == "" {
- return "Command executed successfully (no output)", nil
- }
- return result, nil
-}
diff --git a/internal/gemini/gemini_planner.go b/internal/gemini/gemini_planner.go
deleted file mode 100644
index e2ead13..0000000
--- a/internal/gemini/gemini_planner.go
+++ /dev/null
@@ -1,637 +0,0 @@
-// Copyright 2026 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package gemini
-
-import (
- "context"
- "fmt"
- "os"
- "runtime/debug"
- "strings"
- "time"
-
- "github.com/google/ax/internal/agent"
- "github.com/google/ax/proto"
- "github.com/google/uuid"
- "google.golang.org/genai"
- "google.golang.org/protobuf/types/known/structpb"
-)
-
-type contextKey string
-
-const disallowConfirmationsKey contextKey = "disallowConfirmations"
-
-// AgentRegistry defines the interface needed by the planner to discover agents.
-type AgentRegistry interface {
- List() []string
- AgentInfo(id string) (*agent.AgentInfo, error)
-}
-
-// ContentGenerator abstracts Gemini content generation for testing.
-type ContentGenerator interface {
- GenerateContent(ctx context.Context, model string, contents []*genai.Content, config *genai.GenerateContentConfig) (*genai.GenerateContentResponse, error)
-}
-
-// realContentGenerator implements ContentGenerator using the real genai.Client.
-type realContentGenerator struct {
- client *genai.Client
-}
-
-func (g *realContentGenerator) GenerateContent(ctx context.Context, model string, contents []*genai.Content, config *genai.GenerateContentConfig) (*genai.GenerateContentResponse, error) {
- return g.client.Models.GenerateContent(ctx, model, contents, config)
-}
-
-// GeminiPlannerConfig configures the Gemini-based planner.
-type GeminiPlannerConfig struct {
- GeminiConfig *GeminiConfig
- SkillsDir string // Directory for discovering skills (optional)
-}
-
-// geminiPlannerAgent implements task.Agent using Gemini.
-type geminiPlannerAgent struct {
- config GeminiPlannerConfig
- client ContentGenerator
- bashTool Tool
- skillsTool Tool
- registry AgentRegistry
-}
-
-// NewGeminiPlannerAgent creates a new Gemini-based agent.
-func NewGeminiPlannerAgent(ctx context.Context, registry AgentRegistry, cfg GeminiPlannerConfig) (agent.Agent, error) {
- if cfg.GeminiConfig == nil {
- cfg.GeminiConfig = &GeminiConfig{}
- }
- if cfg.GeminiConfig.Timeout == 0 {
- cfg.GeminiConfig.Timeout = 30 * time.Second
- }
- if cfg.GeminiConfig.Model == "" {
- cfg.GeminiConfig.Model = os.Getenv("AX_GEMINI_MODEL")
- if cfg.GeminiConfig.Model == "" {
- cfg.GeminiConfig.Model = "gemini-3.5-flash"
- }
- }
-
- // Default system prompt
- if cfg.GeminiConfig.SystemPrompt == "" {
- cfg.GeminiConfig.SystemPrompt = `You are AX. You are the Primary Architect and Executor Agent in the system. Your goal is to solve the user's request as thoroughly and efficiently as possible.
-You can answer your questions if there is no tool or function call you need to make.
-
-All specialized subagents available to you are registered and provided directly as standard callable function tools.
-You don't have access to shell, don't use the bash tool.
-
-Rules for Operation:
-- **DELEGATE FIRST**: Review all of your active function tool descriptions! If a tool is specialized for a delegated action (like building Docker images or deploying to Kubernetes), immediately execute that tool function. Do NOT try to perform specialized tasks yourself via shell commands if a custom agent tool exists.
-- **Clarification**: If the user's request is highly ambiguous, ask for clarification. Keep all communication crisp, direct, and focused exclusively on action.
-
-Be concise, don't come up with extra steps unless the user asks for it.
-When introducing yourself, simply reply: "I am AX, how can I help you?"
-`
- }
-
- // Fail fast if no Gemini credentials are configured. We check the three
- // env vars the underlying genai SDK recognizes (see
- // google.golang.org/genai/client.go NewClient docs):
- // - GEMINI_API_KEY: AI Studio API key.
- // - GOOGLE_API_KEY: alternate name for the AI Studio API key; the SDK
- // accepts both and gives this one precedence when both are set.
- // - GOOGLE_GENAI_USE_VERTEXAI: switches the SDK to the Vertex AI
- // backend, which uses Application Default Credentials instead of an
- // API key.
- if os.Getenv("GEMINI_API_KEY") == "" && os.Getenv("GOOGLE_API_KEY") == "" && os.Getenv("GOOGLE_GENAI_USE_VERTEXAI") == "" {
- return nil, fmt.Errorf("no Gemini credentials configured: set either GEMINI_API_KEY (AI Studio) " +
- "or GOOGLE_GENAI_USE_VERTEXAI=True with GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION (Vertex AI) " +
- "on the ax serve process and restart it; " +
- "see https://github.com/google/ax#authentication")
- }
-
- client, err := genai.NewClient(ctx, &genai.ClientConfig{})
- if err != nil {
- return nil, fmt.Errorf("failed to create Gemini client: %w", err)
- }
-
- // NewSkillsTool already converts skills.ErrNoSkills (empty dir)
- // into a NoopTool with a nil error, so any error here is real.
- skillsTool, err := NewSkillsTool(cfg.SkillsDir)
- if err != nil {
- return nil, fmt.Errorf("failed to initialize skills tool: %w", err)
- }
-
- p := &geminiPlannerAgent{
- client: &realContentGenerator{client: client},
- bashTool: &BashTool{},
- skillsTool: skillsTool,
- registry: registry,
- config: cfg,
- }
-
- if sp := skillsTool.SystemPrompt(); sp != "" {
- p.config.GeminiConfig.SystemPrompt += "\n\n" + sp
- }
- return p, nil
-}
-
-func (p *geminiPlannerAgent) Connect(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, e agent.Executor, handler agent.OutputHandler) error {
- return p.loop(ctx, conversationID, start, e, handler)
-}
-
-func (p *geminiPlannerAgent) Close() error {
- return nil
-}
-
-func (p *geminiPlannerAgent) loop(ctx context.Context, conversationID string, start *proto.AgentStart, e agent.Executor, handler agent.OutputHandler) (err error) {
- var outputs []*proto.Message
- var outputCapturer = func(resp *proto.AgentOutputs) error {
- outputs = append(outputs, resp.Messages...)
- return handler(resp)
- }
-
- for {
- nextAgentID, keepLooping, err := p.process(ctx, conversationID, start, e, outputCapturer)
- if err != nil {
- return err
- }
- if keepLooping {
- // Some function calls require multiple turns to complete,
- // e.g. the skill activation and running.
- // Allow the loop to continue without switching agents or user input.
- start.Messages = append(start.Messages, outputs...)
- outputs = nil
- continue
- }
-
- if nextAgentID == "" {
- // No agent to delegate, we are done.
- return nil
- }
- start = &proto.AgentStart{
- AgentId: nextAgentID,
- Messages: append(start.Messages, outputs...),
- }
- outputs = nil
- state, err := e.Exec(ctx, conversationID, nextAgentID, start, outputCapturer)
- if err != nil {
- return err
- }
- start.Messages = append(start.Messages, outputs...)
- outputs = nil
- if state == proto.State_STATE_PENDING {
- return nil
- }
-
- }
-}
-
-func (p *geminiPlannerAgent) process(ctx context.Context, conversationID string, start *proto.AgentStart, e agent.Executor, handler agent.OutputHandler) (agentID string, keepLooping bool, err error) {
- tools, err := agentsToTools(p.registry)
- if err != nil {
- return "", false, fmt.Errorf("failed to convert agents to tools: %w", err)
- }
-
- inputs := start.Messages
- if fc, approved := p.handleConfirmationAnswer(inputs); fc != nil {
- if fc.Name == p.bashTool.Name() {
- return "", false, p.bashTool.HandleExecute(ctx, fc, approved, handler)
- }
- if fc.Name == "run_skill_script" {
- return "", false, p.skillsTool.HandleExecute(ctx, fc, approved, handler)
- }
- }
-
- contents := protoToContents(inputs)
- ctx, cancel := context.WithTimeout(ctx, p.config.GeminiConfig.Timeout)
- defer cancel()
-
- genCfg := &genai.GenerateContentConfig{
- Tools: tools,
- ToolConfig: &genai.ToolConfig{
- FunctionCallingConfig: &genai.FunctionCallingConfig{
- Mode: genai.FunctionCallingConfigModeAuto,
- },
- },
- SystemInstruction: genai.Text(p.config.GeminiConfig.SystemPrompt)[0],
- MaxOutputTokens: p.config.GeminiConfig.MaxTokens,
- CandidateCount: 1,
- }
- // Temperature is *float32 in genai: leave nil to inherit the model's
- // default. We treat the zero value in our config the same way.
- if t := p.config.GeminiConfig.Temperature; t > 0 {
- genCfg.Temperature = &t
- }
-
- resp, err := p.client.GenerateContent(ctx, p.config.GeminiConfig.Model, contents, genCfg)
-
- if err != nil {
- return "", false, fmt.Errorf("failed to generate in planner: %w", err)
- }
- if len(resp.Candidates) == 0 {
- return "", false, fmt.Errorf("no candidates from Gemini in planner")
- }
- candidate := resp.Candidates[0]
- if candidate.Content == nil || candidate.Content.Parts == nil {
- if candidate.FinishReason == genai.FinishReasonStop {
- return "", false, nil // No more tasks
- }
- return "", false, fmt.Errorf("no content in candidates from Gemini (reason: %v)", candidate.FinishReason)
- }
-
- // Look for function calls in the response
- for _, part := range candidate.Content.Parts {
- if part == nil {
- continue
- }
-
- trimmed := strings.TrimSpace(part.Text)
- if trimmed != "" {
- if err := handler(&proto.AgentOutputs{
- Messages: []*proto.Message{{
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{Text: trimmed},
- },
- },
- }},
- }); err != nil {
- return "", false, err
- }
- }
-
- if fc := part.FunctionCall; fc != nil {
- // Preserve Gemini's function-call ID when the model assigns
- // one so it round-trips correctly in subsequent turns. Only
- // mint a UUID when the model leaves it empty.
- if fc.ID == "" {
- fc.ID = uuid.NewString()
- }
- switch fc.Name {
- case p.bashTool.Name():
- return "", false, p.bashTool.HandleCall(ctx, fc, handler)
- case "run_skill_script":
- return "", false, p.skillsTool.HandleCall(ctx, fc, handler)
- case "activate_skill":
- return "", true, p.skillsTool.HandleCall(ctx, fc, handler)
- default:
- if p.isAgent(fc.Name) {
- return "", true, p.handleSubagentCall(ctx, conversationID, fc, part.ThoughtSignature, start.Messages, e, handler)
- }
- return strings.ReplaceAll(fc.Name, "_", "-"), false, nil
- }
- }
- }
- return "", false, nil
-}
-
-func (p *geminiPlannerAgent) isAgent(name string) bool {
- mappedName := strings.ReplaceAll(name, "_", "-")
- for _, a := range p.registry.List() {
- if a == mappedName {
- return true
- }
- }
- return false
-}
-
-func (p *geminiPlannerAgent) handleSubagentCall(ctx context.Context, conversationID string, fc *genai.FunctionCall, signature []byte, history []*proto.Message, e agent.Executor, handler agent.OutputHandler) error {
-
- prompt, ok := fc.Args["prompt"].(string)
- if !ok {
- return fmt.Errorf("missing or invalid 'prompt' argument")
- }
-
- // Record the function call in the history.
- argsStruct, err := structpb.NewStruct(fc.Args)
- if err != nil {
- return err
- }
- if err := handler(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolCall{
- ToolCall: &proto.ToolCallContent{
- Id: fc.ID,
- Signature: signature,
- Type: &proto.ToolCallContent_FunctionCall{
- FunctionCall: &proto.FunctionCallContent{
- Name: fc.Name,
- Arguments: argsStruct,
- },
- },
- },
- },
- },
- },
- },
- }); err != nil {
- return err
- }
-
- mappedName := strings.ReplaceAll(fc.Name, "_", "-")
- var historyStr strings.Builder
- for _, msg := range history {
- historyStr.WriteString(fmt.Sprintf("%s: ", msg.Role))
- if msg.Content != nil {
- if txt := msg.Content.GetText(); txt != nil {
- historyStr.WriteString(txt.Text)
- }
- }
- historyStr.WriteString("\n")
- }
-
- subagentStart := &proto.AgentStart{
- AgentId: mappedName,
- Messages: []*proto.Message{
- {
- Role: "user",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{Text: fmt.Sprintf("History Summary:\n%s\n\nPrompt:\n%s", historyStr.String(), prompt)},
- },
- },
- },
- },
- }
-
- var subagentOutputs []*proto.Message
- capturer := func(outgoing *proto.AgentOutputs) error {
- subagentOutputs = append(subagentOutputs, outgoing.Messages...)
- return nil
- }
-
- var execErr error
- func() {
- defer func() {
- if r := recover(); r != nil {
- execErr = fmt.Errorf("panic: %v\n%s", r, string(debug.Stack()))
- }
- }()
- // Disallow tool confirmations for subagents.
- // NOTE: We use context here for simplicity, but for robust resumption support
- // across process restarts, this might need to be persisted in AgentConfig
- // in the future if the controller does not preserve context on resume.
- subCtx := context.WithValue(ctx, disallowConfirmationsKey, true)
- _, execErr = e.Exec(subCtx, conversationID, mappedName, subagentStart, capturer)
- }()
-
- if execErr != nil {
- respStruct, _ := structpb.NewStruct(map[string]any{
- "result": "sub agent failed",
- "error": execErr.Error(),
- })
- return handler(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "user",
- Content: &proto.Content{
- Type: &proto.Content_ToolResult{
- ToolResult: &proto.ToolResultContent{
- CallId: fc.ID,
- Type: &proto.ToolResultContent_FunctionResult{
- FunctionResult: &proto.FunctionResultContent{
- Name: fc.Name,
- Result: &proto.FunctionResultContent_Response{
- Response: respStruct,
- },
- },
- },
- },
- },
- },
- },
- },
- })
- }
-
- var resultText strings.Builder
- for _, msg := range subagentOutputs {
- if msg.Content != nil {
- if txt := msg.Content.GetText(); txt != nil {
- resultText.WriteString(txt.Text)
- resultText.WriteString("\n")
- }
- }
- }
-
- respStruct, err := structpb.NewStruct(map[string]any{"result": resultText.String()})
- if err != nil {
- return err
- }
-
- return handler(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "user",
- Content: &proto.Content{
- Type: &proto.Content_ToolResult{
- ToolResult: &proto.ToolResultContent{
- CallId: fc.ID,
- Type: &proto.ToolResultContent_FunctionResult{
- FunctionResult: &proto.FunctionResultContent{
- Name: fc.Name,
- Result: &proto.FunctionResultContent_Response{
- Response: respStruct,
- },
- },
- },
- },
- },
- },
- },
- },
- })
-}
-
-func (p *geminiPlannerAgent) handleConfirmationAnswer(inputs []*proto.Message) (*genai.FunctionCall, bool) {
- var conf *proto.ConfirmationContent
- var approved bool
- for _, input := range inputs {
- content := input.GetContent()
- if content.GetConfirmation() != nil && content.GetConfirmation().GetApproval() != nil {
- conf = content.GetConfirmation()
- approved = true
- }
- if content.GetConfirmation() != nil && content.GetConfirmation().GetDecline() != nil {
- conf = content.GetConfirmation()
- approved = false
- }
- }
- if conf == nil {
- return nil, false
- }
-
- var fc *genai.FunctionCall
- for _, input := range inputs {
- content := input.GetContent()
- tc := content.GetToolCall()
- if tc == nil || tc.GetFunctionCall() == nil {
- continue
- }
- if tc.Id == conf.Id {
- fn := tc.GetFunctionCall()
- fc = &genai.FunctionCall{
- ID: conf.Id,
- Name: fn.Name,
- Args: fn.Arguments.AsMap(),
- }
- break
- }
- }
-
- if fc == nil {
- return nil, false
- }
-
- // Ensure that we don't have a response for the function call.
- // Otherwise, we will execute the function call forever.
- for _, input := range inputs {
- content := input.GetContent()
- tr := content.GetToolResult()
- if tr == nil || tr.GetFunctionResult() == nil {
- continue
- }
- if tr.CallId == fc.ID {
- // We executed this previously.
- // There is nothing more to execute.
- return nil, false
- }
- }
- return fc, approved
-}
-
-// agentsToTools converts registry agents to Gemini function declarations.
-func agentsToTools(registry AgentRegistry, nativeTools ...Tool) ([]*genai.Tool, error) {
- agents := registry.List()
-
- var tools []*genai.Tool
- // TODO(lhuan): Check if agentsToTools returns an error or empty list and return a friendly "no agent available, try later" error.
- for _, id := range agents {
- info, err := registry.AgentInfo(id)
- if err != nil {
- continue // Skip agents we can't get info for
- }
-
- // Set safe Gemini tool identifier logic alongside proper schema parameters
- funcDecl := &genai.FunctionDeclaration{
- Name: strings.ReplaceAll(id, "-", "_"),
- Description: fmt.Sprintf("%s, %s", info.Name, info.Description),
- Parameters: &genai.Schema{
- Type: genai.TypeObject,
- Properties: map[string]*genai.Schema{
- "history": {
- Type: genai.TypeString,
- Description: "Summary of the conversation history so far.",
- },
- "prompt": {
- Type: genai.TypeString,
- Description: "The last user prompt verbatim.",
- },
- },
- Required: []string{"history", "prompt"},
- },
- }
- tools = append(tools, &genai.Tool{
- FunctionDeclarations: []*genai.FunctionDeclaration{funcDecl},
- })
- }
- for _, nativeTool := range nativeTools {
- if nativeTool == nil {
- continue
- }
- tools = append(tools, nativeTool.FuncDecl()...)
- }
- return tools, nil
-}
-
-// protoToContents converts history to Gemini conversation format.
-func protoToContents(inputs []*proto.Message) []*genai.Content {
- var contents []*genai.Content
-
- // Convert each message to Gemini format
- for _, msg := range inputs {
- // Skip internal messages.
- if msg.GetInternalOnly() {
- continue
- }
- role := msg.Role
- if role != "user" {
- role = "model"
- }
-
- content := msg.GetContent()
- if content == nil {
- continue
- }
-
- switch m := content.Type.(type) {
- case *proto.Content_Text:
- contents = append(contents, &genai.Content{
- Role: role,
- Parts: []*genai.Part{
- {
- Text: m.Text.Text,
- },
- },
- })
- case *proto.Content_Confirmation:
- // shouldn't be sent to Gemini
- switch m.Confirmation.Decision.(type) {
- case *proto.ConfirmationContent_Decline:
- // shouldn't be sent to Gemini
- case *proto.ConfirmationContent_Approval:
- // shouldn't be sent to Gemini
- }
- case *proto.Content_ToolCall:
- tc := m.ToolCall
- if fc := tc.GetFunctionCall(); fc != nil {
- contents = append(contents, &genai.Content{
- Role: "model",
- Parts: []*genai.Part{
- {
- ThoughtSignature: tc.Signature,
- FunctionCall: &genai.FunctionCall{
- ID: tc.Id,
- Name: fc.Name,
- Args: fc.Arguments.AsMap(),
- },
- },
- },
- })
- }
- case *proto.Content_ToolResult:
- tr := m.ToolResult
- if fr := tr.GetFunctionResult(); fr != nil {
- var respMap map[string]any
- if fr.GetResponse() != nil {
- respMap = fr.GetResponse().AsMap()
- }
- contents = append(contents, &genai.Content{
- Role: "user",
- Parts: []*genai.Part{
- {
- FunctionResponse: &genai.FunctionResponse{
- ID: tr.CallId,
- Name: fr.Name,
- Response: respMap,
- },
- },
- },
- })
- }
- }
- // TODO(jbd): Handle other content types (e.g., images, files)
- }
- return contents
-}
diff --git a/internal/gemini/gemini_planner_integration_test.go b/internal/gemini/gemini_planner_integration_test.go
deleted file mode 100644
index 6705a38..0000000
--- a/internal/gemini/gemini_planner_integration_test.go
+++ /dev/null
@@ -1,98 +0,0 @@
-//go:build integration
-
-// Copyright 2026 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package gemini_test
-
-import (
- "context"
- "os"
- "strings"
- "testing"
-
- "github.com/google/ax/internal/agent"
- "github.com/google/ax/internal/gemini"
- "github.com/google/ax/proto"
-)
-
-func TestIntegrationGeminiPlanner(t *testing.T) {
- apiKey := os.Getenv("GEMINI_API_KEY")
- if apiKey == "" {
- t.Skip("GEMINI_API_KEY not set, skipping integration test")
- }
-
- ctx := context.Background()
- registry := &dummyAgentRegistry{}
-
- cfg := gemini.GeminiPlannerConfig{}
-
- planner, err := gemini.NewGeminiPlannerAgent(ctx, registry, cfg)
- if err != nil {
- t.Fatal(err)
- }
-
- start := &proto.AgentStart{
- AgentId: "__planner",
- Messages: []*proto.Message{
- {
- Role: "user",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{Text: "Hello, who are you?"},
- },
- },
- },
- },
- }
-
- var outputs []*proto.Message
- handler := func(resp *proto.AgentOutputs) error {
- outputs = append(outputs, resp.Messages...)
- return nil
- }
-
- err = planner.Connect(ctx, "test-conv", "test-exec", start, &dummyExecutor{}, handler)
- if err != nil {
- t.Fatal(err)
- }
-
- if len(outputs) == 0 {
- t.Fatal("expected outputs from Gemini")
- }
-
- // Wait, the agent will say "I am Antigravity..." or similar, or "I am AX..." depending on the system prompt.
- response := outputs[0].GetContent().GetText().GetText()
- t.Logf("Gemini response: %v", response)
- expectedPart := "AX"
- if !strings.Contains(response, expectedPart) {
- t.Errorf("Expected response to contain %q, got %q", expectedPart, response)
- }
-}
-
-type dummyExecutor struct{}
-
-func (e *dummyExecutor) Exec(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, o agent.OutputHandler) (proto.State, error) {
- return proto.State_STATE_COMPLETED, nil
-}
-
-type dummyAgentRegistry struct{}
-
-func (r *dummyAgentRegistry) List() []string {
- return nil
-}
-
-func (r *dummyAgentRegistry) AgentInfo(id string) (*agent.AgentInfo, error) {
- return nil, fmt.Errorf("agent not found: %s", id)
-}
diff --git a/internal/gemini/gemini_planner_test.go b/internal/gemini/gemini_planner_test.go
deleted file mode 100644
index 85f28aa..0000000
--- a/internal/gemini/gemini_planner_test.go
+++ /dev/null
@@ -1,467 +0,0 @@
-// Copyright 2026 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package gemini
-
-import (
- "context"
- "fmt"
- "strings"
- "testing"
-
- "github.com/google/ax/internal/agent"
- "github.com/google/ax/proto"
- "google.golang.org/genai"
- "google.golang.org/protobuf/types/known/structpb"
-)
-
-func TestProtoToContents(t *testing.T) {
- inputs := []*proto.Message{
- {
- Role: "user",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{Text: "hello"},
- },
- },
- },
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolCall{
- ToolCall: &proto.ToolCallContent{
- Id: "call-123",
- Type: &proto.ToolCallContent_FunctionCall{
- FunctionCall: &proto.FunctionCallContent{
- Name: "test_tool",
- Arguments: &structpb.Struct{
- Fields: map[string]*structpb.Value{
- "arg1": structpb.NewStringValue("val1"),
- },
- },
- },
- },
- },
- },
- },
- },
- }
-
- contents := protoToContents(inputs)
-
- if len(contents) != 2 {
- t.Fatalf("expected 2 contents, got %d", len(contents))
- }
-
- if contents[0].Role != "user" {
- t.Errorf("expected role user, got %s", contents[0].Role)
- }
- if contents[0].Parts[0].Text != "hello" {
- t.Errorf("expected text hello, got %s", contents[0].Parts[0].Text)
- }
-
- if contents[1].Role != "model" {
- t.Errorf("expected role model, got %s", contents[1].Role)
- }
- fc := contents[1].Parts[0].FunctionCall
- if fc == nil {
- t.Fatal("expected function call")
- }
- if fc.Name != "test_tool" {
- t.Errorf("expected function name test_tool, got %s", fc.Name)
- }
-}
-
-func TestHandleConfirmationAnswer(t *testing.T) {
- inputs := []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_ToolCall{
- ToolCall: &proto.ToolCallContent{
- Id: "call-123",
- Type: &proto.ToolCallContent_FunctionCall{
- FunctionCall: &proto.FunctionCallContent{
- Name: "bash",
- Arguments: &structpb.Struct{
- Fields: map[string]*structpb.Value{
- "command": structpb.NewStringValue("ls"),
- },
- },
- },
- },
- },
- },
- },
- },
- {
- Role: "user",
- Content: &proto.Content{
- Type: &proto.Content_Confirmation{
- Confirmation: &proto.ConfirmationContent{
- Id: "call-123",
- Decision: &proto.ConfirmationContent_Approval{Approval: &proto.ApprovalDecision{Approved: true}},
- },
- },
- },
- },
- }
-
- p := &geminiPlannerAgent{
- bashTool: &BashTool{},
- }
-
- fc, approved := p.handleConfirmationAnswer(inputs)
-
- if fc == nil {
- t.Fatal("expected function call")
- }
- if fc.ID != "call-123" {
- t.Errorf("expected ID call-123, got %s", fc.ID)
- }
- if !approved {
- t.Error("expected approved to be true")
- }
-}
-
-type mockContentGenerator struct {
- generateContentFunc func(ctx context.Context, model string, contents []*genai.Content, config *genai.GenerateContentConfig) (*genai.GenerateContentResponse, error)
-}
-
-func (m *mockContentGenerator) GenerateContent(ctx context.Context, model string, contents []*genai.Content, config *genai.GenerateContentConfig) (*genai.GenerateContentResponse, error) {
- if m.generateContentFunc != nil {
- return m.generateContentFunc(ctx, model, contents, config)
- }
- return nil, nil
-}
-
-type mockExecutor struct {
- execFunc func(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, o agent.OutputHandler) (proto.State, error)
-}
-
-func (m *mockExecutor) Exec(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, o agent.OutputHandler) (proto.State, error) {
- if m.execFunc != nil {
- return m.execFunc(ctx, conversationID, execID, start, o)
- }
- return proto.State_STATE_COMPLETED, nil
-}
-
-type mockAgentRegistry struct {
- listFunc func() []string
- getInfoFunc func(id string) (*agent.AgentInfo, error)
-}
-
-func (m *mockAgentRegistry) List() []string {
- if m.listFunc != nil {
- return m.listFunc()
- }
- return nil
-}
-
-func (m *mockAgentRegistry) AgentInfo(id string) (*agent.AgentInfo, error) {
- if m.getInfoFunc != nil {
- return m.getInfoFunc(id)
- }
- return nil, nil
-}
-
-func TestAgentsToTools_Parameters(t *testing.T) {
- registry := &mockAgentRegistry{
- listFunc: func() []string {
- return []string{"test-agent"}
- },
- getInfoFunc: func(id string) (*agent.AgentInfo, error) {
- return &agent.AgentInfo{
- ID: "test-agent",
- Name: "Test Agent",
- Description: "A test agent",
- }, nil
- },
- }
-
- tools, err := agentsToTools(registry)
- if err != nil {
- t.Fatalf("agentsToTools failed: %v", err)
- }
-
- if len(tools) != 1 {
- t.Fatalf("expected 1 tool, got %d", len(tools))
- }
-
- decl := tools[0].FunctionDeclarations[0]
- if decl.Name != "test_agent" {
- t.Errorf("expected name test_agent, got %s", decl.Name)
- }
-
- params := decl.Parameters
- if params == nil {
- t.Fatal("expected parameters")
- }
-
- if params.Type != genai.TypeObject {
- t.Errorf("expected type object, got %v", params.Type)
- }
-
- if _, ok := params.Properties["history"]; !ok {
- t.Error("expected 'history' property")
- }
- if _, ok := params.Properties["prompt"]; !ok {
- t.Error("expected 'prompt' property")
- }
-
- required := params.Required
- if len(required) != 2 {
- t.Errorf("expected 2 required properties, got %d", len(required))
- }
-
- foundHistory := false
- foundPrompt := false
- for _, r := range required {
- if r == "history" {
- foundHistory = true
- }
- if r == "prompt" {
- foundPrompt = true
- }
- }
- if !foundHistory {
- t.Error("expected 'history' to be required")
- }
- if !foundPrompt {
- t.Error("expected 'prompt' to be required")
- }
-}
-
-func TestHandleSubagentCall_Success(t *testing.T) {
- mockGen := &mockContentGenerator{
- generateContentFunc: func(ctx context.Context, model string, contents []*genai.Content, config *genai.GenerateContentConfig) (*genai.GenerateContentResponse, error) {
- return &genai.GenerateContentResponse{
- Candidates: []*genai.Candidate{
- {
- Content: &genai.Content{
- Parts: []*genai.Part{
- {Text: "Subagent work summary."},
- },
- },
- },
- },
- }, nil
- },
- }
-
- mockExec := &mockExecutor{
- execFunc: func(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, o agent.OutputHandler) (proto.State, error) {
- o(&proto.AgentOutputs{
- Messages: []*proto.Message{
- {
- Role: "model",
- Content: &proto.Content{
- Type: &proto.Content_Text{
- Text: &proto.TextContent{Text: "Subagent output step 1"},
- },
- },
- },
- },
- })
- return proto.State_STATE_COMPLETED, nil
- },
- }
-
- p := &geminiPlannerAgent{
- client: mockGen,
- config: GeminiPlannerConfig{
- GeminiConfig: &GeminiConfig{Model: "test-model"},
- },
- }
-
- fc := &genai.FunctionCall{
- Name: "test-subagent",
- Args: map[string]any{
- "history": "Previous history summary",
- "prompt": "Current user prompt",
- },
- }
-
- var handlerCalled bool
- var handlerOutput *proto.AgentOutputs
- handler := func(outgoing *proto.AgentOutputs) error {
- handlerCalled = true
- handlerOutput = outgoing
- return nil
- }
-
- err := p.handleSubagentCall(context.Background(), "test-conv", fc, nil, nil, mockExec, handler)
- if err != nil {
- t.Fatalf("handleSubagentCall failed: %v", err)
- }
-
- if !handlerCalled {
- t.Fatal("expected handler to be called")
- }
-
- if len(handlerOutput.Messages) != 1 {
- t.Fatalf("expected 1 message, got %d", len(handlerOutput.Messages))
- }
- msg := handlerOutput.Messages[0]
- tr := msg.Content.GetToolResult()
- if tr == nil {
- t.Fatal("expected tool result")
- }
- fr := tr.GetFunctionResult()
- if fr == nil {
- t.Fatal("expected function result")
- }
- if fr.Name != "test-subagent" {
- t.Errorf("expected name test-subagent, got %s", fr.Name)
- }
- resp := fr.GetResponse()
- if resp == nil {
- t.Fatal("expected response")
- }
- resultVal := resp.Fields["result"].GetStringValue()
- if resultVal != "Subagent output step 1\n" {
- t.Errorf("expected 'Subagent output step 1\\n', got %s", resultVal)
- }
-}
-
-func TestHandleSubagentCall_MissingArgs(t *testing.T) {
- p := &geminiPlannerAgent{}
- fc := &genai.FunctionCall{
- Name: "test-subagent",
- Args: map[string]any{},
- }
-
- err := p.handleSubagentCall(context.Background(), "test-conv", fc, nil, nil, nil, nil)
- if err == nil {
- t.Fatal("expected error due to missing arguments")
- }
- if !strings.Contains(err.Error(), "missing or invalid 'prompt' argument") {
- t.Errorf("unexpected error: %v", err)
- }
-}
-
-func TestHandleSubagentCall_Failure(t *testing.T) {
- mockExec := &mockExecutor{
- execFunc: func(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, o agent.OutputHandler) (proto.State, error) {
- return proto.State_STATE_UNSPECIFIED, fmt.Errorf("subagent execution failed")
- },
- }
-
- p := &geminiPlannerAgent{}
- fc := &genai.FunctionCall{
- Name: "test-subagent",
- Args: map[string]any{
- "history": "Previous history summary",
- "prompt": "Current user prompt",
- },
- }
-
- var handlerOutput *proto.AgentOutputs
- handler := func(outgoing *proto.AgentOutputs) error {
- handlerOutput = outgoing
- return nil
- }
-
- err := p.handleSubagentCall(context.Background(), "test-conv", fc, nil, nil, mockExec, handler)
- if err != nil {
- t.Fatalf("handleSubagentCall failed: %v", err)
- }
-
- msg := handlerOutput.Messages[0]
- tr := msg.Content.GetToolResult()
- fr := tr.GetFunctionResult()
- resp := fr.GetResponse()
- resultVal := resp.Fields["result"].GetStringValue()
- if resultVal != "sub agent failed" {
- t.Errorf("expected 'sub agent failed', got %s", resultVal)
- }
- errVal := resp.Fields["error"].GetStringValue()
- if !strings.Contains(errVal, "subagent execution failed") {
- t.Errorf("expected error to contain 'subagent execution failed', got %s", errVal)
- }
-}
-
-func TestHandleSubagentCall_Panic(t *testing.T) {
- mockExec := &mockExecutor{
- execFunc: func(ctx context.Context, conversationID string, execID string, start *proto.AgentStart, o agent.OutputHandler) (proto.State, error) {
- panic("something went wrong")
- },
- }
-
- p := &geminiPlannerAgent{}
- fc := &genai.FunctionCall{
- Name: "test-subagent",
- Args: map[string]any{
- "history": "Previous history summary",
- "prompt": "Current user prompt",
- },
- }
-
- var handlerOutput *proto.AgentOutputs
- handler := func(outgoing *proto.AgentOutputs) error {
- handlerOutput = outgoing
- return nil
- }
-
- err := p.handleSubagentCall(context.Background(), "test-conv", fc, nil, nil, mockExec, handler)
- if err != nil {
- t.Fatalf("handleSubagentCall failed: %v", err)
- }
-
- msg := handlerOutput.Messages[0]
- tr := msg.Content.GetToolResult()
- fr := tr.GetFunctionResult()
- resp := fr.GetResponse()
- resultVal := resp.Fields["result"].GetStringValue()
- if resultVal != "sub agent failed" {
- t.Errorf("expected 'sub agent failed', got %s", resultVal)
- }
- errVal := resp.Fields["error"].GetStringValue()
- if !strings.Contains(errVal, "panic: something went wrong") {
- t.Errorf("expected error to contain 'panic: something went wrong', got %s", errVal)
- }
- if !strings.Contains(errVal, "goroutine") {
- t.Errorf("expected stack trace in error, got %s", errVal)
- }
-}
-
-// TestNewGeminiPlannerAgent_NoSkillsPrompt verifies that the Gemini planner agent
-// system prompt does not contain the available_skills block when skills are disabled.
-func TestNewGeminiPlannerAgent_NoSkillsPrompt(t *testing.T) {
- t.Setenv("GEMINI_API_KEY", "mock-key")
- t.Setenv("SKILLS_DIR", "")
-
- registry := &mockAgentRegistry{}
- cfg := GeminiPlannerConfig{
- GeminiConfig: &GeminiConfig{
- SystemPrompt: "You are AX.",
- },
- SkillsDir: "",
- }
-
- agent, err := NewGeminiPlannerAgent(context.Background(), registry, cfg)
- if err != nil {
- t.Fatalf("NewGeminiPlannerAgent failed: %v", err)
- }
-
- p, ok := agent.(*geminiPlannerAgent)
- if !ok {
- t.Fatalf("expected agent to be *geminiPlannerAgent, got %T", agent)
- }
-
- prompt := p.config.GeminiConfig.SystemPrompt
- if strings.Contains(prompt, "<available_skills>") {
- t.Errorf("expected system prompt to not contain '<available_skills>', got: %s", prompt)
- }
-}
diff --git a/internal/gemini/gemini_test.go b/internal/gemini/gemini_test.go
deleted file mode 100644
index f692054..0000000
--- a/internal/gemini/gemini_test.go
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2026 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package gemini
-
-import (
- "os"
- "path/filepath"
- "testing"
-)
-
-// TestNewSkillsTool_NonExistentDir verifies that NewSkillsTool returns a NoopTool
-// and no error when the specified skills directory does not exist.
-func TestNewSkillsTool_NonExistentDir(t *testing.T) {
- // Use a directory that definitely does not exist
- nonExistentDir := filepath.Join(t.TempDir(), "does-not-exist")
-
- tool, err := NewSkillsTool(nonExistentDir)
- if err != nil {
- t.Fatalf("NewSkillsTool failed for non-existent dir: %v", err)
- }
-
- // Verify it returned a NoopTool
- if _, ok := tool.(*NoopTool); !ok {
- t.Errorf("Expected NoopTool, got %T", tool)
- }
- if len(tool.FuncDecl()) != 0 {
- t.Errorf("Expected empty FuncDecl for NoopTool, got %d", len(tool.FuncDecl()))
- }
- if tool.SystemPrompt() != "" {
- t.Errorf("Expected empty SystemPrompt for NoopTool, got %s", tool.SystemPrompt())
- }
-}
-
-// TestNewSkillsTool_EmptyDir verifies that NewSkillsTool returns a NoopTool
-// and no error when the specified skills directory contains no skills.
-func TestNewSkillsTool_EmptyDir(t *testing.T) {
- // Use an empty directory
- emptyDir := t.TempDir()
-
- tool, err := NewSkillsTool(emptyDir)
- if err != nil {
- t.Fatalf("NewSkillsTool failed for empty dir: %v", err)
- }
-
- // Verify it returned a NoopTool
- if _, ok := tool.(*NoopTool); !ok {
- t.Errorf("Expected NoopTool, got %T", tool)
- }
- if len(tool.FuncDecl()) != 0 {
- t.Errorf("Expected empty FuncDecl for NoopTool, got %d", len(tool.FuncDecl()))
- }
- if tool.SystemPrompt() != "" {
- t.Errorf("Expected empty SystemPrompt for NoopTool, got %s", tool.SystemPrompt())
- }
-}
-
-// TestNewSkillsTool_WithSkills verifies that NewSkillsTool successfully creates
-// a SkillsTool when valid skills are present.
-func TestNewSkillsTool_WithSkills(t *testing.T) {
- tmpDir := t.TempDir()
- skillDir := filepath.Join(tmpDir, "test-skill")
- err := os.MkdirAll(filepath.Join(skillDir, "scripts"), 0755)
- if err != nil {
- t.Fatal(err)
- }
-
- skillContent := `---
-name: test-skill
-description: A test skill
----
-Instructions go here.`
-
- err = os.WriteFile(filepath.Join(skillDir, "SKILL.md"), []byte(skillContent), 0644)
- if err != nil {
- t.Fatal(err)
- }
-
- tool, err := NewSkillsTool(tmpDir)
- if err != nil {
- t.Fatalf("NewSkillsTool failed: %v", err)
- }
-
- // Verify it returned a SkillsTool (FuncDecl should not be empty)
- if len(tool.FuncDecl()) == 0 {
- t.Error("Expected non-empty FuncDecl for SkillsTool")
- }
-}
-
-// TestNewSkillsTool_NoDir verifies that NewSkillsTool returns a NoopTool
-// when both the specified directory and the SKILLS_DIR environment variable are empty.
-func TestNewSkillsTool_NoDir(t *testing.T) {
- t.Setenv("SKILLS_DIR", "")
-
- tool, err := NewSkillsTool("")
- if err != nil {
- t.Fatalf("NewSkillsTool failed for empty dir: %v", err)
- }
-
- // Verify it returned a NoopTool
- if _, ok := tool.(*NoopTool); !ok {
- t.Errorf("Expected NoopTool, got %T", tool)
- }
-}
diff --git a/proto/ax.pb.go b/proto/ax.pb.go
index 5e8dfa2..9a3dbf1 100644
--- a/proto/ax.pb.go
+++ b/proto/ax.pb.go
@@ -15,7 +15,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
-// protoc v7.34.1
+// protoc v5.28.2
// source: proto/ax.proto
package proto
@@ -24,7 +24,6 @@ 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"
unsafe "unsafe"
@@ -146,304 +145,6 @@ 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"`
- AgentConfig []byte `protobuf:"bytes,2,opt,name=agent_config,json=agentConfig,proto3" json:"agent_config,omitempty"`
- Messages []*Message `protobuf:"bytes,3,rep,name=messages,proto3" json:"messages,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AgentStart) Reset() {
- *x = AgentStart{}
- mi := &file_proto_ax_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AgentStart) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AgentStart) ProtoMessage() {}
-
-func (x *AgentStart) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[0]
- 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 AgentStart.ProtoReflect.Descriptor instead.
-func (*AgentStart) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *AgentStart) GetAgentId() string {
- if x != nil {
- return x.AgentId
- }
- return ""
-}
-
-func (x *AgentStart) GetAgentConfig() []byte {
- if x != nil {
- return x.AgentConfig
- }
- return nil
-}
-
-func (x *AgentStart) GetMessages() []*Message {
- if x != nil {
- return x.Messages
- }
- return nil
-}
-
-type AgentOutputs 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 *AgentOutputs) Reset() {
- *x = AgentOutputs{}
- mi := &file_proto_ax_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AgentOutputs) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AgentOutputs) ProtoMessage() {}
-
-func (x *AgentOutputs) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[1]
- 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 AgentOutputs.ProtoReflect.Descriptor instead.
-func (*AgentOutputs) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *AgentOutputs) GetMessages() []*Message {
- if x != nil {
- return x.Messages
- }
- return nil
-}
-
-type AgentEnd struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AgentEnd) Reset() {
- *x = AgentEnd{}
- mi := &file_proto_ax_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AgentEnd) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AgentEnd) ProtoMessage() {}
-
-func (x *AgentEnd) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[2]
- 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 AgentEnd.ProtoReflect.Descriptor instead.
-func (*AgentEnd) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{2}
-}
-
-type AgentRequest struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"`
- ExecId string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"`
- Start *AgentStart `protobuf:"bytes,3,opt,name=start,proto3" json:"start,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AgentRequest) Reset() {
- *x = AgentRequest{}
- mi := &file_proto_ax_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AgentRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AgentRequest) ProtoMessage() {}
-
-func (x *AgentRequest) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[3]
- 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 AgentRequest.ProtoReflect.Descriptor instead.
-func (*AgentRequest) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *AgentRequest) GetConversationId() string {
- if x != nil {
- return x.ConversationId
- }
- return ""
-}
-
-func (x *AgentRequest) GetExecId() string {
- if x != nil {
- return x.ExecId
- }
- return ""
-}
-
-func (x *AgentRequest) GetStart() *AgentStart {
- if x != nil {
- return x.Start
- }
- return nil
-}
-
-type AgentResponse struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- ConversationId string `protobuf:"bytes,1,opt,name=conversation_id,json=conversationId,proto3" json:"conversation_id,omitempty"`
- ExecId string `protobuf:"bytes,2,opt,name=exec_id,json=execId,proto3" json:"exec_id,omitempty"`
- // Types that are valid to be assigned to Type:
- //
- // *AgentResponse_Outputs
- // *AgentResponse_End
- Type isAgentResponse_Type `protobuf_oneof:"type"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
-}
-
-func (x *AgentResponse) Reset() {
- *x = AgentResponse{}
- mi := &file_proto_ax_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
-}
-
-func (x *AgentResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*AgentResponse) ProtoMessage() {}
-
-func (x *AgentResponse) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[4]
- 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 AgentResponse.ProtoReflect.Descriptor instead.
-func (*AgentResponse) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *AgentResponse) GetConversationId() string {
- if x != nil {
- return x.ConversationId
- }
- return ""
-}
-
-func (x *AgentResponse) GetExecId() string {
- if x != nil {
- return x.ExecId
- }
- return ""
-}
-
-func (x *AgentResponse) GetType() isAgentResponse_Type {
- if x != nil {
- return x.Type
- }
- return nil
-}
-
-func (x *AgentResponse) GetOutputs() *AgentOutputs {
- if x != nil {
- if x, ok := x.Type.(*AgentResponse_Outputs); ok {
- return x.Outputs
- }
- }
- return nil
-}
-
-func (x *AgentResponse) GetEnd() *AgentEnd {
- if x != nil {
- if x, ok := x.Type.(*AgentResponse_End); ok {
- return x.End
- }
- }
- return nil
-}
-
-type isAgentResponse_Type interface {
- isAgentResponse_Type()
-}
-
-type AgentResponse_Outputs struct {
- Outputs *AgentOutputs `protobuf:"bytes,3,opt,name=outputs,proto3,oneof"`
-}
-
-type AgentResponse_End struct {
- End *AgentEnd `protobuf:"bytes,4,opt,name=end,proto3,oneof"`
-}
-
-func (*AgentResponse_Outputs) isAgentResponse_Type() {}
-
-func (*AgentResponse_End) isAgentResponse_Type() {}
-
// Message is a message in the history.
type Message struct {
state protoimpl.MessageState `protogen:"open.v1"`
@@ -459,7 +160,7 @@ type Message struct {
func (x *Message) Reset() {
*x = Message{}
- mi := &file_proto_ax_proto_msgTypes[5]
+ mi := &file_proto_ax_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -471,7 +172,7 @@ func (x *Message) String() string {
func (*Message) ProtoMessage() {}
func (x *Message) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[5]
+ mi := &file_proto_ax_proto_msgTypes[0]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -484,7 +185,7 @@ func (x *Message) ProtoReflect() protoreflect.Message {
// Deprecated: Use Message.ProtoReflect.Descriptor instead.
func (*Message) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{5}
+ return file_proto_ax_proto_rawDescGZIP(), []int{0}
}
func (x *Message) GetRole() string {
@@ -526,7 +227,7 @@ type ConversationEvent struct {
func (x *ConversationEvent) Reset() {
*x = ConversationEvent{}
- mi := &file_proto_ax_proto_msgTypes[6]
+ mi := &file_proto_ax_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -538,7 +239,7 @@ func (x *ConversationEvent) String() string {
func (*ConversationEvent) ProtoMessage() {}
func (x *ConversationEvent) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[6]
+ mi := &file_proto_ax_proto_msgTypes[1]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -551,7 +252,7 @@ func (x *ConversationEvent) ProtoReflect() protoreflect.Message {
// Deprecated: Use ConversationEvent.ProtoReflect.Descriptor instead.
func (*ConversationEvent) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{6}
+ return file_proto_ax_proto_rawDescGZIP(), []int{1}
}
func (x *ConversationEvent) GetConversationId() string {
@@ -612,7 +313,7 @@ type HealthCheckRequest struct {
func (x *HealthCheckRequest) Reset() {
*x = HealthCheckRequest{}
- mi := &file_proto_ax_proto_msgTypes[7]
+ mi := &file_proto_ax_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -624,7 +325,7 @@ func (x *HealthCheckRequest) String() string {
func (*HealthCheckRequest) ProtoMessage() {}
func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[7]
+ mi := &file_proto_ax_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -637,7 +338,7 @@ func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.
func (*HealthCheckRequest) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{7}
+ return file_proto_ax_proto_rawDescGZIP(), []int{2}
}
// HealthCheckResponse contains agent health status
@@ -651,7 +352,7 @@ type HealthCheckResponse struct {
func (x *HealthCheckResponse) Reset() {
*x = HealthCheckResponse{}
- mi := &file_proto_ax_proto_msgTypes[8]
+ mi := &file_proto_ax_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -663,7 +364,7 @@ func (x *HealthCheckResponse) String() string {
func (*HealthCheckResponse) ProtoMessage() {}
func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[8]
+ mi := &file_proto_ax_proto_msgTypes[3]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -676,7 +377,7 @@ func (x *HealthCheckResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.
func (*HealthCheckResponse) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{8}
+ return file_proto_ax_proto_rawDescGZIP(), []int{3}
}
func (x *HealthCheckResponse) GetHealthy() bool {
@@ -704,7 +405,7 @@ type HarnessStart struct {
func (x *HarnessStart) Reset() {
*x = HarnessStart{}
- mi := &file_proto_ax_proto_msgTypes[9]
+ mi := &file_proto_ax_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -716,7 +417,7 @@ func (x *HarnessStart) String() string {
func (*HarnessStart) ProtoMessage() {}
func (x *HarnessStart) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[9]
+ mi := &file_proto_ax_proto_msgTypes[4]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -729,7 +430,7 @@ func (x *HarnessStart) ProtoReflect() protoreflect.Message {
// Deprecated: Use HarnessStart.ProtoReflect.Descriptor instead.
func (*HarnessStart) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{9}
+ return file_proto_ax_proto_rawDescGZIP(), []int{4}
}
func (x *HarnessStart) GetHarnessConfig() []byte {
@@ -756,7 +457,7 @@ type HarnessCancel struct {
func (x *HarnessCancel) Reset() {
*x = HarnessCancel{}
- mi := &file_proto_ax_proto_msgTypes[10]
+ mi := &file_proto_ax_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -768,7 +469,7 @@ func (x *HarnessCancel) String() string {
func (*HarnessCancel) ProtoMessage() {}
func (x *HarnessCancel) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[10]
+ mi := &file_proto_ax_proto_msgTypes[5]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -781,7 +482,7 @@ func (x *HarnessCancel) ProtoReflect() protoreflect.Message {
// Deprecated: Use HarnessCancel.ProtoReflect.Descriptor instead.
func (*HarnessCancel) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{10}
+ return file_proto_ax_proto_rawDescGZIP(), []int{5}
}
func (x *HarnessCancel) GetReason() CancelReason {
@@ -806,7 +507,7 @@ type HarnessRequest struct {
func (x *HarnessRequest) Reset() {
*x = HarnessRequest{}
- mi := &file_proto_ax_proto_msgTypes[11]
+ mi := &file_proto_ax_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -818,7 +519,7 @@ func (x *HarnessRequest) String() string {
func (*HarnessRequest) ProtoMessage() {}
func (x *HarnessRequest) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[11]
+ mi := &file_proto_ax_proto_msgTypes[6]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -831,7 +532,7 @@ func (x *HarnessRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use HarnessRequest.ProtoReflect.Descriptor instead.
func (*HarnessRequest) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{11}
+ return file_proto_ax_proto_rawDescGZIP(), []int{6}
}
func (x *HarnessRequest) GetConversationId() string {
@@ -898,7 +599,7 @@ type HarnessOutputs struct {
func (x *HarnessOutputs) Reset() {
*x = HarnessOutputs{}
- mi := &file_proto_ax_proto_msgTypes[12]
+ mi := &file_proto_ax_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -910,7 +611,7 @@ func (x *HarnessOutputs) String() string {
func (*HarnessOutputs) ProtoMessage() {}
func (x *HarnessOutputs) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[12]
+ mi := &file_proto_ax_proto_msgTypes[7]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -923,7 +624,7 @@ func (x *HarnessOutputs) ProtoReflect() protoreflect.Message {
// Deprecated: Use HarnessOutputs.ProtoReflect.Descriptor instead.
func (*HarnessOutputs) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{12}
+ return file_proto_ax_proto_rawDescGZIP(), []int{7}
}
func (x *HarnessOutputs) GetMessages() []*Message {
@@ -945,7 +646,7 @@ type HarnessEnd struct {
func (x *HarnessEnd) Reset() {
*x = HarnessEnd{}
- mi := &file_proto_ax_proto_msgTypes[13]
+ mi := &file_proto_ax_proto_msgTypes[8]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -957,7 +658,7 @@ func (x *HarnessEnd) String() string {
func (*HarnessEnd) ProtoMessage() {}
func (x *HarnessEnd) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[13]
+ mi := &file_proto_ax_proto_msgTypes[8]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -970,7 +671,7 @@ func (x *HarnessEnd) ProtoReflect() protoreflect.Message {
// Deprecated: Use HarnessEnd.ProtoReflect.Descriptor instead.
func (*HarnessEnd) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{13}
+ return file_proto_ax_proto_rawDescGZIP(), []int{8}
}
func (x *HarnessEnd) GetState() State {
@@ -1001,7 +702,7 @@ type HarnessResponse struct {
func (x *HarnessResponse) Reset() {
*x = HarnessResponse{}
- mi := &file_proto_ax_proto_msgTypes[14]
+ mi := &file_proto_ax_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1013,7 +714,7 @@ func (x *HarnessResponse) String() string {
func (*HarnessResponse) ProtoMessage() {}
func (x *HarnessResponse) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[14]
+ mi := &file_proto_ax_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1026,7 +727,7 @@ func (x *HarnessResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use HarnessResponse.ProtoReflect.Descriptor instead.
func (*HarnessResponse) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{14}
+ return file_proto_ax_proto_rawDescGZIP(), []int{9}
}
func (x *HarnessResponse) GetConversationId() string {
@@ -1091,7 +792,7 @@ type ExecRequest struct {
func (x *ExecRequest) Reset() {
*x = ExecRequest{}
- mi := &file_proto_ax_proto_msgTypes[15]
+ mi := &file_proto_ax_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1103,7 +804,7 @@ func (x *ExecRequest) String() string {
func (*ExecRequest) ProtoMessage() {}
func (x *ExecRequest) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[15]
+ mi := &file_proto_ax_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1116,7 +817,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{15}
+ return file_proto_ax_proto_rawDescGZIP(), []int{10}
}
func (x *ExecRequest) GetConversationId() string {
@@ -1165,7 +866,7 @@ type ExecResponse struct {
func (x *ExecResponse) Reset() {
*x = ExecResponse{}
- mi := &file_proto_ax_proto_msgTypes[16]
+ mi := &file_proto_ax_proto_msgTypes[11]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1177,7 +878,7 @@ func (x *ExecResponse) String() string {
func (*ExecResponse) ProtoMessage() {}
func (x *ExecResponse) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[16]
+ mi := &file_proto_ax_proto_msgTypes[11]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1190,7 +891,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{16}
+ return file_proto_ax_proto_rawDescGZIP(), []int{11}
}
func (x *ExecResponse) GetOutputs() []*Message {
@@ -1216,7 +917,7 @@ type DeleteConversationRequest struct {
func (x *DeleteConversationRequest) Reset() {
*x = DeleteConversationRequest{}
- mi := &file_proto_ax_proto_msgTypes[17]
+ mi := &file_proto_ax_proto_msgTypes[12]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1228,7 +929,7 @@ func (x *DeleteConversationRequest) String() string {
func (*DeleteConversationRequest) ProtoMessage() {}
func (x *DeleteConversationRequest) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[17]
+ mi := &file_proto_ax_proto_msgTypes[12]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1241,7 +942,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{17}
+ return file_proto_ax_proto_rawDescGZIP(), []int{12}
}
func (x *DeleteConversationRequest) GetConversationId() string {
@@ -1259,7 +960,7 @@ type DeleteConversationResponse struct {
func (x *DeleteConversationResponse) Reset() {
*x = DeleteConversationResponse{}
- mi := &file_proto_ax_proto_msgTypes[18]
+ mi := &file_proto_ax_proto_msgTypes[13]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -1271,7 +972,7 @@ func (x *DeleteConversationResponse) String() string {
func (*DeleteConversationResponse) ProtoMessage() {}
func (x *DeleteConversationResponse) ProtoReflect() protoreflect.Message {
- mi := &file_proto_ax_proto_msgTypes[18]
+ mi := &file_proto_ax_proto_msgTypes[13]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -1284,33 +985,14 @@ func (x *DeleteConversationResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DeleteConversationResponse.ProtoReflect.Descriptor instead.
func (*DeleteConversationResponse) Descriptor() ([]byte, []int) {
- return file_proto_ax_proto_rawDescGZIP(), []int{18}
+ return file_proto_ax_proto_rawDescGZIP(), []int{13}
}
var File_proto_ax_proto protoreflect.FileDescriptor
const file_proto_ax_proto_rawDesc = "" +
"\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" +
- "\fagent_config\x18\x02 \x01(\fR\vagentConfig\x12'\n" +
- "\bmessages\x18\x03 \x03(\v2\v.ax.MessageR\bmessages\"7\n" +
- "\fAgentOutputs\x12'\n" +
- "\bmessages\x18\x01 \x03(\v2\v.ax.MessageR\bmessages\"\n" +
- "\n" +
- "\bAgentEnd\"v\n" +
- "\fAgentRequest\x12'\n" +
- "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12\x17\n" +
- "\aexec_id\x18\x02 \x01(\tR\x06execId\x12$\n" +
- "\x05start\x18\x03 \x01(\v2\x0e.ax.AgentStartR\x05start\"\xa9\x01\n" +
- "\rAgentResponse\x12'\n" +
- "\x0fconversation_id\x18\x01 \x01(\tR\x0econversationId\x12\x17\n" +
- "\aexec_id\x18\x02 \x01(\tR\x06execId\x12,\n" +
- "\aoutputs\x18\x03 \x01(\v2\x10.ax.AgentOutputsH\x00R\aoutputs\x12 \n" +
- "\x03end\x18\x04 \x01(\v2\f.ax.AgentEndH\x00R\x03endB\x06\n" +
- "\x04type\"i\n" +
+ "\x0eproto/ax.proto\x12\x02ax\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"i\n" +
"\aMessage\x12\x12\n" +
"\x04role\x18\x01 \x01(\tR\x04role\x12%\n" +
"\acontent\x18\x02 \x01(\v2\v.ax.ContentR\acontent\x12#\n" +
@@ -1395,63 +1077,53 @@ func file_proto_ax_proto_rawDescGZIP() []byte {
}
var file_proto_ax_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
-var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 19)
+var file_proto_ax_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
var file_proto_ax_proto_goTypes = []any{
(State)(0), // 0: ax.State
(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
- (*HealthCheckRequest)(nil), // 9: ax.HealthCheckRequest
- (*HealthCheckResponse)(nil), // 10: ax.HealthCheckResponse
- (*HarnessStart)(nil), // 11: ax.HarnessStart
- (*HarnessCancel)(nil), // 12: ax.HarnessCancel
- (*HarnessRequest)(nil), // 13: ax.HarnessRequest
- (*HarnessOutputs)(nil), // 14: ax.HarnessOutputs
- (*HarnessEnd)(nil), // 15: ax.HarnessEnd
- (*HarnessResponse)(nil), // 16: ax.HarnessResponse
- (*ExecRequest)(nil), // 17: ax.ExecRequest
- (*ExecResponse)(nil), // 18: ax.ExecResponse
- (*DeleteConversationRequest)(nil), // 19: ax.DeleteConversationRequest
- (*DeleteConversationResponse)(nil), // 20: ax.DeleteConversationResponse
- (*Content)(nil), // 21: ax.Content
- (*structpb.Struct)(nil), // 22: google.protobuf.Struct
+ (*Message)(nil), // 2: ax.Message
+ (*ConversationEvent)(nil), // 3: ax.ConversationEvent
+ (*HealthCheckRequest)(nil), // 4: ax.HealthCheckRequest
+ (*HealthCheckResponse)(nil), // 5: ax.HealthCheckResponse
+ (*HarnessStart)(nil), // 6: ax.HarnessStart
+ (*HarnessCancel)(nil), // 7: ax.HarnessCancel
+ (*HarnessRequest)(nil), // 8: ax.HarnessRequest
+ (*HarnessOutputs)(nil), // 9: ax.HarnessOutputs
+ (*HarnessEnd)(nil), // 10: ax.HarnessEnd
+ (*HarnessResponse)(nil), // 11: ax.HarnessResponse
+ (*ExecRequest)(nil), // 12: ax.ExecRequest
+ (*ExecResponse)(nil), // 13: ax.ExecResponse
+ (*DeleteConversationRequest)(nil), // 14: ax.DeleteConversationRequest
+ (*DeleteConversationResponse)(nil), // 15: ax.DeleteConversationResponse
+ (*Content)(nil), // 16: ax.Content
+ (*structpb.Struct)(nil), // 17: google.protobuf.Struct
}
var file_proto_ax_proto_depIdxs = []int32{
- 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
- 21, // 5: ax.Message.content:type_name -> ax.Content
- 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
+ 16, // 0: ax.Message.content:type_name -> ax.Content
+ 17, // 1: ax.ConversationEvent.harness_config:type_name -> google.protobuf.Struct
+ 2, // 2: ax.ConversationEvent.messages:type_name -> ax.Message
+ 0, // 3: ax.ConversationEvent.state:type_name -> ax.State
+ 2, // 4: ax.HarnessStart.messages:type_name -> ax.Message
+ 1, // 5: ax.HarnessCancel.reason:type_name -> ax.CancelReason
+ 6, // 6: ax.HarnessRequest.start:type_name -> ax.HarnessStart
+ 7, // 7: ax.HarnessRequest.cancel:type_name -> ax.HarnessCancel
+ 2, // 8: ax.HarnessOutputs.messages:type_name -> ax.Message
+ 0, // 9: ax.HarnessEnd.state:type_name -> ax.State
+ 9, // 10: ax.HarnessResponse.outputs:type_name -> ax.HarnessOutputs
+ 10, // 11: ax.HarnessResponse.end:type_name -> ax.HarnessEnd
+ 2, // 12: ax.ExecRequest.inputs:type_name -> ax.Message
+ 2, // 13: ax.ExecResponse.outputs:type_name -> ax.Message
+ 8, // 14: ax.HarnessService.Connect:input_type -> ax.HarnessRequest
+ 12, // 15: ax.ControllerService.Exec:input_type -> ax.ExecRequest
+ 14, // 16: ax.ConversationService.DeleteConversation:input_type -> ax.DeleteConversationRequest
+ 11, // 17: ax.HarnessService.Connect:output_type -> ax.HarnessResponse
+ 13, // 18: ax.ControllerService.Exec:output_type -> ax.ExecResponse
+ 15, // 19: ax.ConversationService.DeleteConversation:output_type -> ax.DeleteConversationResponse
+ 17, // [17:20] is the sub-list for method output_type
+ 14, // [14:17] is the sub-list for method input_type
+ 14, // [14:14] is the sub-list for extension type_name
+ 14, // [14:14] is the sub-list for extension extendee
+ 0, // [0:14] is the sub-list for field type_name
}
func init() { file_proto_ax_proto_init() }
@@ -1460,15 +1132,11 @@ func file_proto_ax_proto_init() {
return
}
file_proto_content_proto_init()
- file_proto_ax_proto_msgTypes[4].OneofWrappers = []any{
- (*AgentResponse_Outputs)(nil),
- (*AgentResponse_End)(nil),
- }
- file_proto_ax_proto_msgTypes[11].OneofWrappers = []any{
+ file_proto_ax_proto_msgTypes[6].OneofWrappers = []any{
(*HarnessRequest_Start)(nil),
(*HarnessRequest_Cancel)(nil),
}
- file_proto_ax_proto_msgTypes[14].OneofWrappers = []any{
+ file_proto_ax_proto_msgTypes[9].OneofWrappers = []any{
(*HarnessResponse_Outputs)(nil),
(*HarnessResponse_End)(nil),
}
@@ -1478,7 +1146,7 @@ func file_proto_ax_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_ax_proto_rawDesc), len(file_proto_ax_proto_rawDesc)),
NumEnums: 2,
- NumMessages: 19,
+ NumMessages: 14,
NumExtensions: 0,
NumServices: 3,
},
diff --git a/proto/ax.proto b/proto/ax.proto
index abbe501..f5ce83a 100644
--- a/proto/ax.proto
+++ b/proto/ax.proto
@@ -17,7 +17,6 @@ syntax = "proto3";
package ax;
import "google/protobuf/struct.proto";
-import "google/protobuf/timestamp.proto";
import "proto/content.proto";
option go_package = "github.com/google/ax/proto";
@@ -25,33 +24,6 @@ option go_package = "github.com/google/ax/proto";
// WARNING: This file is in active development and
// significant changes can be made with breaking changes.
-message AgentStart {
- string agent_id = 1;
- bytes agent_config = 2;
- repeated Message messages = 3;
-}
-
-message AgentOutputs {
- repeated Message messages = 1;
-}
-
-message AgentEnd {}
-
-message AgentRequest {
- string conversation_id = 1;
- string exec_id = 2;
- AgentStart start = 3;
-}
-
-message AgentResponse {
- string conversation_id = 1;
- string exec_id = 2;
- oneof type {
- AgentOutputs outputs = 3;
- AgentEnd end = 4;
- }
-}
-
// Message is a message in the history.
message Message {
string role = 1; // user, assistant, or model
diff --git a/proto/ax_grpc.pb.go b/proto/ax_grpc.pb.go
index 36ab2a5..56a8d74 100644
--- a/proto/ax_grpc.pb.go
+++ b/proto/ax_grpc.pb.go
@@ -14,8 +14,8 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
-// - protoc-gen-go-grpc v1.6.0
-// - protoc v7.34.1
+// - protoc-gen-go-grpc v1.5.1
+// - protoc v5.28.2
// source: proto/ax.proto
package proto
@@ -88,7 +88,7 @@ type HarnessServiceServer interface {
type UnimplementedHarnessServiceServer struct{}
func (UnimplementedHarnessServiceServer) Connect(grpc.BidiStreamingServer[HarnessRequest, HarnessResponse]) error {
- return status.Error(codes.Unimplemented, "method Connect not implemented")
+ return status.Errorf(codes.Unimplemented, "method Connect not implemented")
}
func (UnimplementedHarnessServiceServer) mustEmbedUnimplementedHarnessServiceServer() {}
func (UnimplementedHarnessServiceServer) testEmbeddedByValue() {}
@@ -101,7 +101,7 @@ type UnsafeHarnessServiceServer interface {
}
func RegisterHarnessServiceServer(s grpc.ServiceRegistrar, srv HarnessServiceServer) {
- // If the following call panics, it indicates UnimplementedHarnessServiceServer was
+ // If the following call pancis, it indicates UnimplementedHarnessServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
@@ -194,7 +194,7 @@ type ControllerServiceServer interface {
type UnimplementedControllerServiceServer struct{}
func (UnimplementedControllerServiceServer) Exec(*ExecRequest, grpc.ServerStreamingServer[ExecResponse]) error {
- return status.Error(codes.Unimplemented, "method Exec not implemented")
+ return status.Errorf(codes.Unimplemented, "method Exec not implemented")
}
func (UnimplementedControllerServiceServer) mustEmbedUnimplementedControllerServiceServer() {}
func (UnimplementedControllerServiceServer) testEmbeddedByValue() {}
@@ -207,7 +207,7 @@ type UnsafeControllerServiceServer interface {
}
func RegisterControllerServiceServer(s grpc.ServiceRegistrar, srv ControllerServiceServer) {
- // If the following call panics, it indicates UnimplementedControllerServiceServer was
+ // If the following call pancis, it indicates UnimplementedControllerServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
@@ -294,7 +294,7 @@ type ConversationServiceServer interface {
type UnimplementedConversationServiceServer struct{}
func (UnimplementedConversationServiceServer) DeleteConversation(context.Context, *DeleteConversationRequest) (*DeleteConversationResponse, error) {
- return nil, status.Error(codes.Unimplemented, "method DeleteConversation not implemented")
+ return nil, status.Errorf(codes.Unimplemented, "method DeleteConversation not implemented")
}
func (UnimplementedConversationServiceServer) mustEmbedUnimplementedConversationServiceServer() {}
func (UnimplementedConversationServiceServer) testEmbeddedByValue() {}
@@ -307,7 +307,7 @@ type UnsafeConversationServiceServer interface {
}
func RegisterConversationServiceServer(s grpc.ServiceRegistrar, srv ConversationServiceServer) {
- // If the following call panics, it indicates UnimplementedConversationServiceServer was
+ // If the following call pancis, it indicates UnimplementedConversationServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
diff --git a/proto/content.pb.go b/proto/content.pb.go
index 807eb73..1cae4f6 100644
--- a/proto/content.pb.go
+++ b/proto/content.pb.go
@@ -15,7 +15,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.36.11
-// protoc v7.34.1
+// protoc v5.28.2
// source: proto/content.proto
package proto
diff --git a/python/proto/ax_pb2.py b/python/proto/ax_pb2.py
index 0a7b121..08797f3 100644
--- a/python/proto/ax_pb2.py
+++ b/python/proto/ax_pb2.py
@@ -14,86 +14,66 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
-# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/ax.proto
-# Protobuf Python Version: 6.33.5
+# Protobuf Python Version: 4.25.1
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
-from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
-_runtime_version.ValidateProtobufRuntimeVersion(
- _runtime_version.Domain.PUBLIC,
- 6,
- 33,
- 5,
- '',
- 'proto/ax.proto'
-)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
-from google.protobuf import timestamp_pb2 as google_dot_protobuf_dot_timestamp__pb2
+from google.protobuf import struct_pb2 as google_dot_protobuf_dot_struct__pb2
from proto import content_pb2 as proto_dot_content__pb2
-DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x13proto/content.proto\"S\n\nAgentStart\x12\x10\n\x08\x61gent_id\x18\x01 \x01(\t\x12\x14\n\x0c\x61gent_config\x18\x02 \x01(\x0c\x12\x1d\n\x08messages\x18\x03 \x03(\x0b\x32\x0b.ax.Message\"-\n\x0c\x41gentOutputs\x12\x1d\n\x08messages\x18\x01 \x03(\x0b\x32\x0b.ax.Message\"\n\n\x08\x41gentEnd\"W\n\x0c\x41gentRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x0f\n\x07\x65xec_id\x18\x02 \x01(\t\x12\x1d\n\x05start\x18\x03 \x01(\x0b\x32\x0e.ax.AgentStart\"\x83\x01\n\rAgentResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x0f\n\x07\x65xec_id\x18\x02 \x01(\t\x12#\n\x07outputs\x18\x03 \x01(\x0b\x32\x10.ax.AgentOutputsH\x00\x12\x1b\n\x03\x65nd\x18\x04 \x01(\x0b\x32\x0c.ax.AgentEndH\x00\x42\x06\n\x04type\"L\n\x07Message\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x0b.ax.Content\x12\x15\n\rinternal_only\x18\x03 \x01(\x08\"\xaf\x01\n\x11\x43onversationEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x0b\n\x03seq\x18\x02 \x01(\x05\x12\x0f\n\x07\x65xec_id\x18\x03 \x01(\t\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12\x16\n\x0eharness_config\x18\x05 \x01(\x0c\x12\x1d\n\x08messages\x18\x06 \x03(\x0b\x32\x0b.ax.Message\x12\x18\n\x05state\x18\x07 \x01(\x0e\x32\t.ax.State\"\x14\n\x12HealthCheckRequest\"7\n\x13HealthCheckResponse\x12\x0f\n\x07healthy\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\"E\n\x0cHarnessStart\x12\x16\n\x0eharness_config\x18\x01 \x01(\x0c\x12\x1d\n\x08messages\x18\x02 \x03(\x0b\x32\x0b.ax.Message\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8d\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x12\n\nharness_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\"/\n\x0eHarnessOutputs\x12\x1d\n\x08messages\x18\x01 \x03(\x0b\x32\x0b.ax.Message\"=\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x15\n\rerror_message\x18\x02 \x01(\t\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"}\n\x0b\x45xecRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x1b\n\x06inputs\x18\x02 \x03(\x0b\x32\x0b.ax.Message\x12\x10\n\x08last_seq\x18\x03 \x01(\x05\x12\x10\n\x08\x61gent_id\x18\x04 \x01(\t\x12\x14\n\x0c\x61gent_config\x18\x05 \x01(\x0c\"9\n\x0c\x45xecResponse\x12\x1c\n\x07outputs\x18\x01 \x03(\x0b\x32\x0b.ax.Message\x12\x0b\n\x03seq\x18\x02 \x01(\x05\"4\n\x19\x44\x65leteConversationRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\"\x1c\n\x1a\x44\x65leteConversationResponse*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32@\n\x11\x43ontrollerService\x12+\n\x04\x45xec\x12\x0f.ax.ExecRequest\x1a\x10.ax.ExecResponse0\x01\x32j\n\x13\x43onversationService\x12S\n\x12\x44\x65leteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3')
+DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x0eproto/ax.proto\x12\x02\x61x\x1a\x1cgoogle/protobuf/struct.proto\x1a\x13proto/content.proto\"L\n\x07Message\x12\x0c\n\x04role\x18\x01 \x01(\t\x12\x1c\n\x07\x63ontent\x18\x02 \x01(\x0b\x32\x0b.ax.Content\x12\x15\n\rinternal_only\x18\x03 \x01(\x08\"\xc8\x01\n\x11\x43onversationEvent\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x0b\n\x03seq\x18\x02 \x01(\x05\x12\x0f\n\x07\x65xec_id\x18\x03 \x01(\t\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12/\n\x0eharness_config\x18\x05 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x1d\n\x08messages\x18\x06 \x03(\x0b\x32\x0b.ax.Message\x12\x18\n\x05state\x18\x07 \x01(\x0e\x32\t.ax.State\"\x14\n\x12HealthCheckRequest\"7\n\x13HealthCheckResponse\x12\x0f\n\x07healthy\x18\x01 \x01(\x08\x12\x0f\n\x07message\x18\x02 \x01(\t\"E\n\x0cHarnessStart\x12\x16\n\x0eharness_config\x18\x01 \x01(\x0c\x12\x1d\n\x08messages\x18\x02 \x03(\x0b\x32\x0b.ax.Message\"1\n\rHarnessCancel\x12 \n\x06reason\x18\x01 \x01(\x0e\x32\x10.ax.CancelReason\"\x8d\x01\n\x0eHarnessRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x12\n\nharness_id\x18\x02 \x01(\t\x12!\n\x05start\x18\x03 \x01(\x0b\x32\x10.ax.HarnessStartH\x00\x12#\n\x06\x63\x61ncel\x18\x04 \x01(\x0b\x32\x11.ax.HarnessCancelH\x00\x42\x06\n\x04type\"/\n\x0eHarnessOutputs\x12\x1d\n\x08messages\x18\x01 \x03(\x0b\x32\x0b.ax.Message\"=\n\nHarnessEnd\x12\x18\n\x05state\x18\x01 \x01(\x0e\x32\t.ax.State\x12\x15\n\rerror_message\x18\x02 \x01(\t\"x\n\x0fHarnessResponse\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12%\n\x07outputs\x18\x02 \x01(\x0b\x32\x12.ax.HarnessOutputsH\x00\x12\x1d\n\x03\x65nd\x18\x03 \x01(\x0b\x32\x0e.ax.HarnessEndH\x00\x42\x06\n\x04type\"\x81\x01\n\x0b\x45xecRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\x12\x1b\n\x06inputs\x18\x02 \x03(\x0b\x32\x0b.ax.Message\x12\x10\n\x08last_seq\x18\x03 \x01(\x05\x12\x12\n\nharness_id\x18\x04 \x01(\t\x12\x16\n\x0eharness_config\x18\x05 \x01(\x0c\"9\n\x0c\x45xecResponse\x12\x1c\n\x07outputs\x18\x01 \x03(\x0b\x32\x0b.ax.Message\x12\x0b\n\x03seq\x18\x02 \x01(\x05\"4\n\x19\x44\x65leteConversationRequest\x12\x17\n\x0f\x63onversation_id\x18\x01 \x01(\t\"\x1c\n\x1a\x44\x65leteConversationResponse*l\n\x05State\x12\x15\n\x11STATE_UNSPECIFIED\x10\x00\x12\x11\n\rSTATE_PENDING\x10\x01\x12\x10\n\x0cSTATE_FAILED\x10\x02\x12\x13\n\x0fSTATE_COMPLETED\x10\x03\x12\x12\n\x0eSTATE_CANCELED\x10\x04*\x8c\x01\n\x0c\x43\x61ncelReason\x12\x1d\n\x19\x43\x41NCEL_REASON_UNSPECIFIED\x10\x00\x12 \n\x1c\x43\x41NCEL_REASON_USER_REQUESTED\x10\x01\x12\x19\n\x15\x43\x41NCEL_REASON_TIMEOUT\x10\x02\x12 \n\x1c\x43\x41NCEL_REASON_INTERNAL_ERROR\x10\x03\x32H\n\x0eHarnessService\x12\x36\n\x07\x43onnect\x12\x12.ax.HarnessRequest\x1a\x13.ax.HarnessResponse(\x01\x30\x01\x32@\n\x11\x43ontrollerService\x12+\n\x04\x45xec\x12\x0f.ax.ExecRequest\x1a\x10.ax.ExecResponse0\x01\x32j\n\x13\x43onversationService\x12S\n\x12\x44\x65leteConversation\x12\x1d.ax.DeleteConversationRequest\x1a\x1e.ax.DeleteConversationResponseB\x1cZ\x1agithub.com/google/ax/protob\x06proto3')
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.ax_pb2', _globals)
-if not _descriptor._USE_C_DESCRIPTORS:
- _globals['DESCRIPTOR']._loaded_options = None
+if _descriptor._USE_C_DESCRIPTORS == False:
+ _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'Z\032github.com/google/ax/proto'
- _globals['_STATE']._serialized_start=1548
- _globals['_STATE']._serialized_end=1656
- _globals['_CANCELREASON']._serialized_start=1659
- _globals['_CANCELREASON']._serialized_end=1799
- _globals['_AGENTSTART']._serialized_start=76
- _globals['_AGENTSTART']._serialized_end=159
- _globals['_AGENTOUTPUTS']._serialized_start=161
- _globals['_AGENTOUTPUTS']._serialized_end=206
- _globals['_AGENTEND']._serialized_start=208
- _globals['_AGENTEND']._serialized_end=218
- _globals['_AGENTREQUEST']._serialized_start=220
- _globals['_AGENTREQUEST']._serialized_end=307
- _globals['_AGENTRESPONSE']._serialized_start=310
- _globals['_AGENTRESPONSE']._serialized_end=441
- _globals['_MESSAGE']._serialized_start=443
- _globals['_MESSAGE']._serialized_end=519
- _globals['_CONVERSATIONEVENT']._serialized_start=522
- _globals['_CONVERSATIONEVENT']._serialized_end=697
- _globals['_HEALTHCHECKREQUEST']._serialized_start=699
- _globals['_HEALTHCHECKREQUEST']._serialized_end=719
- _globals['_HEALTHCHECKRESPONSE']._serialized_start=721
- _globals['_HEALTHCHECKRESPONSE']._serialized_end=776
- _globals['_HARNESSSTART']._serialized_start=778
- _globals['_HARNESSSTART']._serialized_end=847
- _globals['_HARNESSCANCEL']._serialized_start=849
- _globals['_HARNESSCANCEL']._serialized_end=898
- _globals['_HARNESSREQUEST']._serialized_start=901
- _globals['_HARNESSREQUEST']._serialized_end=1042
- _globals['_HARNESSOUTPUTS']._serialized_start=1044
- _globals['_HARNESSOUTPUTS']._serialized_end=1091
- _globals['_HARNESSEND']._serialized_start=1093
- _globals['_HARNESSEND']._serialized_end=1154
- _globals['_HARNESSRESPONSE']._serialized_start=1156
- _globals['_HARNESSRESPONSE']._serialized_end=1276
- _globals['_EXECREQUEST']._serialized_start=1278
- _globals['_EXECREQUEST']._serialized_end=1403
- _globals['_EXECRESPONSE']._serialized_start=1405
- _globals['_EXECRESPONSE']._serialized_end=1462
- _globals['_DELETECONVERSATIONREQUEST']._serialized_start=1464
- _globals['_DELETECONVERSATIONREQUEST']._serialized_end=1516
- _globals['_DELETECONVERSATIONRESPONSE']._serialized_start=1518
- _globals['_DELETECONVERSATIONRESPONSE']._serialized_end=1546
- _globals['_HARNESSSERVICE']._serialized_start=1801
- _globals['_HARNESSSERVICE']._serialized_end=1873
- _globals['_CONTROLLERSERVICE']._serialized_start=1875
- _globals['_CONTROLLERSERVICE']._serialized_end=1939
- _globals['_CONVERSATIONSERVICE']._serialized_start=1941
- _globals['_CONVERSATIONSERVICE']._serialized_end=2047
+ _globals['_STATE']._serialized_start=1208
+ _globals['_STATE']._serialized_end=1316
+ _globals['_CANCELREASON']._serialized_start=1319
+ _globals['_CANCELREASON']._serialized_end=1459
+ _globals['_MESSAGE']._serialized_start=73
+ _globals['_MESSAGE']._serialized_end=149
+ _globals['_CONVERSATIONEVENT']._serialized_start=152
+ _globals['_CONVERSATIONEVENT']._serialized_end=352
+ _globals['_HEALTHCHECKREQUEST']._serialized_start=354
+ _globals['_HEALTHCHECKREQUEST']._serialized_end=374
+ _globals['_HEALTHCHECKRESPONSE']._serialized_start=376
+ _globals['_HEALTHCHECKRESPONSE']._serialized_end=431
+ _globals['_HARNESSSTART']._serialized_start=433
+ _globals['_HARNESSSTART']._serialized_end=502
+ _globals['_HARNESSCANCEL']._serialized_start=504
+ _globals['_HARNESSCANCEL']._serialized_end=553
+ _globals['_HARNESSREQUEST']._serialized_start=556
+ _globals['_HARNESSREQUEST']._serialized_end=697
+ _globals['_HARNESSOUTPUTS']._serialized_start=699
+ _globals['_HARNESSOUTPUTS']._serialized_end=746
+ _globals['_HARNESSEND']._serialized_start=748
+ _globals['_HARNESSEND']._serialized_end=809
+ _globals['_HARNESSRESPONSE']._serialized_start=811
+ _globals['_HARNESSRESPONSE']._serialized_end=931
+ _globals['_EXECREQUEST']._serialized_start=934
+ _globals['_EXECREQUEST']._serialized_end=1063
+ _globals['_EXECRESPONSE']._serialized_start=1065
+ _globals['_EXECRESPONSE']._serialized_end=1122
+ _globals['_DELETECONVERSATIONREQUEST']._serialized_start=1124
+ _globals['_DELETECONVERSATIONREQUEST']._serialized_end=1176
+ _globals['_DELETECONVERSATIONRESPONSE']._serialized_start=1178
+ _globals['_DELETECONVERSATIONRESPONSE']._serialized_end=1206
+ _globals['_HARNESSSERVICE']._serialized_start=1461
+ _globals['_HARNESSSERVICE']._serialized_end=1533
+ _globals['_CONTROLLERSERVICE']._serialized_start=1535
+ _globals['_CONTROLLERSERVICE']._serialized_end=1599
+ _globals['_CONVERSATIONSERVICE']._serialized_start=1601
+ _globals['_CONVERSATIONSERVICE']._serialized_end=1707
# @@protoc_insertion_point(module_scope)
diff --git a/python/proto/ax_pb2_grpc.py b/python/proto/ax_pb2_grpc.py
index e67bdd8..9e5ed73 100644
--- a/python/proto/ax_pb2_grpc.py
+++ b/python/proto/ax_pb2_grpc.py
@@ -15,31 +15,11 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
-import warnings
from proto import ax_pb2 as proto_dot_ax__pb2
-GRPC_GENERATED_VERSION = '1.81.1'
-GRPC_VERSION = grpc.__version__
-_version_not_supported = False
-try:
- from grpc._utilities import first_version_is_lower
- _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
-except ImportError:
- _version_not_supported = True
-
-if _version_not_supported:
- raise RuntimeError(
- f'The grpc package installed is at version {GRPC_VERSION},'
- + ' but the generated code in proto/ax_pb2_grpc.py depends on'
- + f' grpcio>={GRPC_GENERATED_VERSION}.'
- + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
- + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
- )
-
-
-class HarnessServiceStub:
+class HarnessServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
@@ -52,10 +32,10 @@ class HarnessServiceStub:
'/ax.HarnessService/Connect',
request_serializer=proto_dot_ax__pb2.HarnessRequest.SerializeToString,
response_deserializer=proto_dot_ax__pb2.HarnessResponse.FromString,
- _registered_method=True)
+ )
-class HarnessServiceServicer:
+class HarnessServiceServicer(object):
"""Missing associated documentation comment in .proto file."""
def Connect(self, request_iterator, context):
@@ -80,11 +60,10 @@ def add_HarnessServiceServicer_to_server(servicer, server):
generic_handler = grpc.method_handlers_generic_handler(
'ax.HarnessService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
- server.add_registered_method_handlers('ax.HarnessService', rpc_method_handlers)
# This class is part of an EXPERIMENTAL API.
-class HarnessService:
+class HarnessService(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
@@ -98,24 +77,14 @@ class HarnessService:
wait_for_ready=None,
timeout=None,
metadata=None):
- return grpc.experimental.stream_stream(
- request_iterator,
- target,
- '/ax.HarnessService/Connect',
+ return grpc.experimental.stream_stream(request_iterator, target, '/ax.HarnessService/Connect',
proto_dot_ax__pb2.HarnessRequest.SerializeToString,
proto_dot_ax__pb2.HarnessResponse.FromString,
- options,
- channel_credentials,
- insecure,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- _registered_method=True)
-
-
-class ControllerServiceStub:
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+
+class ControllerServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
@@ -128,10 +97,10 @@ class ControllerServiceStub:
'/ax.ControllerService/Exec',
request_serializer=proto_dot_ax__pb2.ExecRequest.SerializeToString,
response_deserializer=proto_dot_ax__pb2.ExecResponse.FromString,
- _registered_method=True)
+ )
-class ControllerServiceServicer:
+class ControllerServiceServicer(object):
"""Missing associated documentation comment in .proto file."""
def Exec(self, request, context):
@@ -154,11 +123,10 @@ def add_ControllerServiceServicer_to_server(servicer, server):
generic_handler = grpc.method_handlers_generic_handler(
'ax.ControllerService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
- server.add_registered_method_handlers('ax.ControllerService', rpc_method_handlers)
# This class is part of an EXPERIMENTAL API.
-class ControllerService:
+class ControllerService(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
@@ -172,24 +140,14 @@ class ControllerService:
wait_for_ready=None,
timeout=None,
metadata=None):
- return grpc.experimental.unary_stream(
- request,
- target,
- '/ax.ControllerService/Exec',
+ return grpc.experimental.unary_stream(request, target, '/ax.ControllerService/Exec',
proto_dot_ax__pb2.ExecRequest.SerializeToString,
proto_dot_ax__pb2.ExecResponse.FromString,
- options,
- channel_credentials,
- insecure,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- _registered_method=True)
-
-
-class ConversationServiceStub:
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
+
+
+class ConversationServiceStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
@@ -202,10 +160,10 @@ class ConversationServiceStub:
'/ax.ConversationService/DeleteConversation',
request_serializer=proto_dot_ax__pb2.DeleteConversationRequest.SerializeToString,
response_deserializer=proto_dot_ax__pb2.DeleteConversationResponse.FromString,
- _registered_method=True)
+ )
-class ConversationServiceServicer:
+class ConversationServiceServicer(object):
"""Missing associated documentation comment in .proto file."""
def DeleteConversation(self, request, context):
@@ -228,11 +186,10 @@ def add_ConversationServiceServicer_to_server(servicer, server):
generic_handler = grpc.method_handlers_generic_handler(
'ax.ConversationService', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
- server.add_registered_method_handlers('ax.ConversationService', rpc_method_handlers)
# This class is part of an EXPERIMENTAL API.
-class ConversationService:
+class ConversationService(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
@@ -246,18 +203,8 @@ class ConversationService:
wait_for_ready=None,
timeout=None,
metadata=None):
- return grpc.experimental.unary_unary(
- request,
- target,
- '/ax.ConversationService/DeleteConversation',
+ return grpc.experimental.unary_unary(request, target, '/ax.ConversationService/DeleteConversation',
proto_dot_ax__pb2.DeleteConversationRequest.SerializeToString,
proto_dot_ax__pb2.DeleteConversationResponse.FromString,
- options,
- channel_credentials,
- insecure,
- call_credentials,
- compression,
- wait_for_ready,
- timeout,
- metadata,
- _registered_method=True)
+ options, channel_credentials,
+ insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
diff --git a/python/proto/content_pb2.py b/python/proto/content_pb2.py
index 27a5937..c20ef7b 100644
--- a/python/proto/content_pb2.py
+++ b/python/proto/content_pb2.py
@@ -14,23 +14,13 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
-# NO CHECKED-IN PROTOBUF GENCODE
# source: proto/content.proto
-# Protobuf Python Version: 6.33.5
+# Protobuf Python Version: 4.25.1
"""Generated protocol buffer code."""
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
-from google.protobuf import runtime_version as _runtime_version
from google.protobuf import symbol_database as _symbol_database
from google.protobuf.internal import builder as _builder
-_runtime_version.ValidateProtobufRuntimeVersion(
- _runtime_version.Domain.PUBLIC,
- 6,
- 33,
- 5,
- '',
- 'proto/content.proto'
-)
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
@@ -44,8 +34,8 @@ DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13proto/content.
_globals = globals()
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'proto.content_pb2', _globals)
-if not _descriptor._USE_C_DESCRIPTORS:
- _globals['DESCRIPTOR']._loaded_options = None
+if _descriptor._USE_C_DESCRIPTORS == False:
+ _globals['DESCRIPTOR']._options = None
_globals['DESCRIPTOR']._serialized_options = b'Z\032github.com/google/ax/proto'
_globals['_MEDIARESOLUTION']._serialized_start=2638
_globals['_MEDIARESOLUTION']._serialized_end=2736
diff --git a/python/proto/content_pb2_grpc.py b/python/proto/content_pb2_grpc.py
index f6b95ba..fe9b2e7 100644
--- a/python/proto/content_pb2_grpc.py
+++ b/python/proto/content_pb2_grpc.py
@@ -15,24 +15,4 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
-import warnings
-
-GRPC_GENERATED_VERSION = '1.81.1'
-GRPC_VERSION = grpc.__version__
-_version_not_supported = False
-
-try:
- from grpc._utilities import first_version_is_lower
- _version_not_supported = first_version_is_lower(GRPC_VERSION, GRPC_GENERATED_VERSION)
-except ImportError:
- _version_not_supported = True
-
-if _version_not_supported:
- raise RuntimeError(
- f'The grpc package installed is at version {GRPC_VERSION},'
- + ' but the generated code in proto/content_pb2_grpc.py depends on'
- + f' grpcio>={GRPC_GENERATED_VERSION}.'
- + f' Please upgrade your grpc module to grpcio>={GRPC_GENERATED_VERSION}'
- + f' or downgrade your generated code using grpcio-tools<={GRPC_VERSION}.'
- )