diff --git a/pkg/api/handlers/invoke.go b/pkg/api/handlers/invoke.go
index a54fed371..c5cf02c0c 100644
--- a/pkg/api/handlers/invoke.go
+++ b/pkg/api/handlers/invoke.go
@@ -91,10 +91,13 @@ func (i *InvokeHandler) Invoke(req api.Context) error {
return err
}
} else {
- synchronous = false
+ if threadID == "" || stepID != "" {
+ synchronous = false
+ }
resp, err = i.invoker.Workflow(req.Context(), req.Storage, &wf, string(input), invoke.WorkflowOptions{
- ThreadName: threadID,
- StepID: stepID,
+ Synchronous: synchronous,
+ ThreadName: threadID,
+ StepID: stepID,
})
if err != nil {
return err
diff --git a/pkg/invoke/workflow.go b/pkg/invoke/workflow.go
index cf4db5e33..66077d89d 100644
--- a/pkg/invoke/workflow.go
+++ b/pkg/invoke/workflow.go
@@ -8,6 +8,7 @@ import (
"github.com/obot-platform/nah/pkg/router"
"github.com/obot-platform/obot/apiclient/types"
"github.com/obot-platform/obot/pkg/events"
+ "github.com/obot-platform/obot/pkg/render"
v1 "github.com/obot-platform/obot/pkg/storage/apis/otto.otto8.ai/v1"
"github.com/obot-platform/obot/pkg/system"
"github.com/obot-platform/obot/pkg/wait"
@@ -18,6 +19,7 @@ import (
)
type WorkflowOptions struct {
+ Synchronous bool
ThreadName string
StepID string
OwningThreadName string
@@ -100,7 +102,6 @@ func (i *Invoker) Workflow(ctx context.Context, c kclient.WithWatch, wf *v1.Work
}
} else if opt.ThreadName != "" {
threadName = opt.ThreadName
- rerun = true
}
if rerun {
@@ -108,6 +109,25 @@ func (i *Invoker) Workflow(ctx context.Context, c kclient.WithWatch, wf *v1.Work
if err != nil {
return nil, err
}
+ } else if threadName != "" {
+ thread = &v1.Thread{}
+ if err := c.Get(ctx, router.Key(wf.Namespace, threadName), thread); err != nil {
+ return nil, err
+ }
+ if err := c.Get(ctx, router.Key(wf.Namespace, thread.Spec.WorkflowExecutionName), wfe); err != nil {
+ return nil, err
+ }
+ agent, err := render.Workflow(ctx, c, wf, render.WorkflowOptions{
+ Input: wfe.Spec.Input,
+ ManifestOverride: wfe.Status.WorkflowManifest,
+ })
+ if err != nil {
+ return nil, err
+ }
+ return i.Agent(ctx, c, agent, input, Options{
+ ThreadName: threadName,
+ Synchronous: opt.Synchronous,
+ })
} else {
wfe, thread, err = i.startWorkflow(ctx, c, wf, input, opt)
if err != nil {
diff --git a/ui/admin/app/routes/_auth.threads.$id.tsx b/ui/admin/app/routes/_auth.threads.$id.tsx
index cadce59f5..52b9ab48e 100644
--- a/ui/admin/app/routes/_auth.threads.$id.tsx
+++ b/ui/admin/app/routes/_auth.threads.$id.tsx
@@ -100,7 +100,6 @@ export default function ChatAgent() {
id={entity.id}
mode="agent"
threadId={thread.id}
- readOnly={!isAgent}
>
diff --git a/ui/user/src/lib/components/editor/Controls.svelte b/ui/user/src/lib/components/editor/Controls.svelte
index 9b2fc3930..886056b6a 100644
--- a/ui/user/src/lib/components/editor/Controls.svelte
+++ b/ui/user/src/lib/components/editor/Controls.svelte
@@ -1,5 +1,5 @@