Invoking Agent from Workflow

I added an Invoke Agent block to a workflow. I have 2 questions around setting this up:

  1. Why doesn’t Sync have the same input options as Async (ie JSON and GUI)?
  2. If I wanted to use Async GUI, how do I setup the agent’s input parameters, so that something shows up here?

Overall, I’m just tinkering at the moment, and user interface for this block didn’t make sense to me.

Hi @lkiss!

Happy to explain here! The Result (sync) return type in the Invoke Agent block will synchronously block your workflow until it receives a response, whereas the Run State (async) return type continues to schedule workflow blocks while the agent is processing your request. In other words: Sync is best used for shorter running queries where you know you won’t have to wait too long for an agent’s response, whereas Async is better suited when there’s still workflow steps that could happen during longer running queries.

Sync mode (as well as ā€œInvokeā€ in the Async GUI mode) only accepts a message as an input. Async has the additional JSON Input Mode to offer more granularity/control over what you’d like that Agent Block to handle. This guide provides a good example of this, and demonstrates how to poll an agent for its logs using a JSON input. An Invoke Agent block triggered with an "Invokeā€ action will return an agentId and agentRunId, which you could use in a subsequent code block, an Agent block using JSON (i.e. action: checkLogs), or an Agent block using the ā€˜Check Resultsā€ action in GUI mode.

Hope this clears it up!

Best,

Altai || Retool Support

1 Like

Thanks for spending time on the explanation @Altai_Chiang . I guess I don’t understand why Async would be given more granular options than Sync. Async vs Sync is not Simple vs Complex or Beginner vs Advanced. Async vs Sync is just whether we wait for the result or not. So now, if I want want to provide a json input to Sync, I have to modify my prompt to set expectations. Modifying a prompt to handle Sync vs Async doesn’t seem right to me. Just my unsolicited two cents.

Thanks for hearing me out.

That's a fair point and good feedback, @lkiss - I'll pass it on to the team. :+1: They'd probably be interested in hearing some additional context about how you'd potentially augment the invoke payload in sync mode, as that's the only meaningful gap between the two modes.