Skip to content

armgit / ax

Public Imported from GitHub
0

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

Go

Allow exec to resume without inputs (#142)

Jaana Dogan3facd41cb0c5
diff --git a/README.md b/README.md
index ed084b4..6e9edd0 100644
--- a/README.md
+++ b/README.md
@@ -84,6 +84,11 @@ Instead of running the default planner agent, you can run any registered agent:
ax exec --agent coding --input "Can you write me a simple HTTP server in Python?"
```
+You can resume an incomplete execution:
+```bash
+ax exec --resume --agent "coding" --id "edf98ef5-4bb1-4a9e-a091-3a77e03727e6"
+```
+
### 2. Run exec with Custom Agents
Most developers want to build their own agents. AX allows running custom agents as remote
diff --git a/cmd/ax/exec.go b/cmd/ax/exec.go
index ddb5726..5ff5560 100644
--- a/cmd/ax/exec.go
+++ b/cmd/ax/exec.go
@@ -38,6 +38,7 @@ var (
execInput string
execServerAddr string
execConfigFile string
+ execResume bool // allow resuming an execution without inputs
)
var execCmd = &cobra.Command{
@@ -54,6 +55,8 @@ func init() {
execCmd.Flags().StringVar(&execInput, "input", "", "Input message to send (optional)")
execCmd.Flags().StringVar(&execServerAddr, "server", "", "gRPC controller server address (if specified, connects to remote server; otherwise runs with a local built-in AX server)")
execCmd.Flags().StringVar(&execConfigFile, "config", "ax.yaml", "Path to YAML configuration file (only used with a local built-in AX server)")
+ execCmd.Flags().BoolVar(&execResume, "resume", false, "Resume an execution without inputs")
+ execCmd.MarkFlagsMutuallyExclusive("input", "resume")
}
// TODO(jbd): Add multimodal input flags, e.g. --input-image.
@@ -93,22 +96,25 @@ func execLoop(ctx context.Context, id string, agentID string, input string) erro
d := internal.NewDisplay(id)
d.DisplayHeader()
- input, quit, err := promptUser(d, input)
- if err != nil {
- return err
- }
- if quit {
- return nil
- }
- history := []*proto.Content{
- {
- Role: "user",
- Content: &proto.Content_Text{
- Text: &proto.TextContent{
- Text: input,
+ var history []*proto.Content
+ if !execResume {
+ input, quit, err := promptUser(d, input)
+ if err != nil {
+ return err
+ }
+ if quit {
+ return nil
+ }
+ history = []*proto.Content{
+ {
+ Role: "user",
+ Content: &proto.Content_Text{
+ Text: &proto.TextContent{
+ Text: input,
+ },
},
},
- },
+ }
}
for {