InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

[enhancement]: Description about ececuting workflow.

Open andrzejlisek opened this issue 3 months ago • 5 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Contact Details

[email protected]

What should this feature add?

I just downloaded InvokeAI 6.2.0 and I am trying to use it as GUI-less engine through REST API, similarly to ComfyUI. The my client application is in Java SE.

The planned workflow procedure:

  1. Create and upload workflow graph
  2. Upload source image (for image-to-image process only, skip this step for text-to-image)
  3. Run the worflow
  4. Wait until workflow execution is finished
  5. Download finally created image

I just created such workflow with ComfyUI and now, i would like to do similar with InvokeAI. I already "discussed" several times with newest version of GPT, Gemini and Claude, i got fictional, non-working examples only, so these chatbots not helped me.

I am using the http://127.0.0.1:9090/docs for the endpoint info. The very first test (the "hello world" equivalend) is prepared as following:

  1. I installed and run the InvokeAI as web appliacation http://127.0.0.1:9090
  2. I downloaded the "Deliberate v5" model in Model Manager.
  3. In the Workflows sections, I created the simple text-to-image workflow, tested it, and saved as TestWF.
  4. In my Java application, I performed GET http://127.0.0.1:9090/api/v1/workflows/ - the TestWF is listed, then I copied the workflow_id
  5. I performed GET http://127.0.0.1:9090/api/v1/workflows/i/36d98a0a-de1d-49f6-a23e-226c5bc2a77a and I got the JSON of my workflow
  6. I stucked here I am trying to prepare JSON based on the workflow JSON, to perform the POST http://127.0.0.1:9090/api/v1/queue/default/enqueue_batch

Ho to do it correctly from my Java application? How to remotely execute any workflow graph through HTTP API? The http://127.0.0.1:9090/dosc describes the JSON templates and does not help me. The doc helped only about available endpoints.

I even tried to run the example after substitution my workflow, both in Java and in Python. https://github.com/invoke-ai/InvokeAI/issues/6581 The example also seems not working. I am very newbie in Python, but I am advanced in Java and C#.

Alternatives

No response

Additional Content

No response

andrzejlisek avatar Jul 27 '25 14:07 andrzejlisek

The workflow format is an enriched data structure that represents an execution graph and other metadata. It is not executed directly. The client builds a graph from the workflow and that is what you enqueue. Suggest running the app in GUI mode and inspecting the network traffic to see the data format for the enqueue_batch endpoint.

psychedelicious avatar Jul 28 '25 09:07 psychedelicious

I even tried with these configuration in invokeai.yamp:

log_handlers:
- console
- file=worklog.txt
log_format: plain
log_level: debug
log_sql: true
log_level_network: debug

I excepted, that the log will work like "sniffer" for all operations from GUI. I am dissapointed, because, if I click the yellow "Invoke" button within the GUI, the log does not contains the API I/O, so the work principle is not the same as using the REST API.

The only entries seems be promising, was the JSON containing in SQL query into the database, but the query also not works as REST API query.

Unfortunately, I did not found correct and working "hello world" example, which presents the whole HTTP API session from scratch into the getting some picture.

andrzejlisek avatar Jul 28 '25 12:07 andrzejlisek

Sorry, I think you misunderstood - you can use a web browser's dev tools (network tab) to inspect the payloads sent to the enqueue_batch endpoint. The endpoint is hit when you click Invoke.

Go to the workflows tab, add a single "add integers" node and click Invoke - that's your "hello world" example.

Invoke's REST API is designed for Invoke as an application, not for programmatic use. We don't have docs on how to use it programmatically. That said, it's not a super complicated API or anything, and we do have many users who have written their own frontends. You'll need to implement polling and/or websockets to retrieve graph execution outputs.

psychedelicious avatar Jul 28 '25 14:07 psychedelicious

Now, I read, that you suggest the reverse engineering (for instance, dev tools in web browser) as the only way to find out, how to collaborate my software with the InvokeAI core.

Do I understand correctly, that the InvokeAI is not intended to be used as server collaborating with external own software, and the existing REST API is rather side effect of InvokeAI development, than the intended feature for usage with external software?

I conclude, that the InvokeAI is intended for standalone usage only and is not developed as 2-in-1 product, consisting of standalone usage and usage with external client software. If I want to collaborate with my own software, i should use other server software, like ComfyUI or Automatic1111, the InvokeAI is not intended for usage as I want. Is is a good conclusion?

andrzejlisek avatar Jul 31 '25 16:07 andrzejlisek

Now, I read, that you suggest the reverse engineering (for instance, dev tools in web browser) as the only way to find out, how to collaborate my software with the InvokeAI core.

I suggest that using the dev tools is a way to gain a better understanding of the API and typical usage patterns. The OpenAPI swagger docs are complete.

Do I understand correctly, that the InvokeAI is not intended to be used as server collaborating with external own software

Invoke is a developed as a user-facing application, not an API. The HTTP and socket APIs are focused on providing a good user experience to application users. I cannot comment on whether or not comfy or A1111 are any better or worse.

psychedelicious avatar Jul 31 '25 20:07 psychedelicious