agentgateway service initialization flow

agentgateway service initialization flow#

Initialization flow#

Below I describe the initialization flow and the thread model. The main thread types are:

  • main thread — thread name: agentgateway

  • main spawn thread — thread name: agentgateway

  • agentgateway workers — thread name format: agentgateway-N

Figure: Agentgateway initialization flow

Figure: Agentgateway initialization flow#

Open in Draw.io

Reading Rust code that uses Tokio and async can be a bit overwhelming for Rust newcomers. Fortunately I previously learned Go and its goroutines, which makes the concepts easier to grasp. Each OS thread can have a tokio::runtime::Runtime bound to its thread-local context (similar to a scheduler with a thread pool). The key is to focus on the code that performs spawn operations.