{
  "type": "module",
  "source": "doc/api/api-agent.md",
  "modules": [
    {
      "textRaw": "Agent",
      "name": "agent",
      "type": "module",
      "desc": "<p>Extends: <code>undici.Dispatcher</code></p>\n<p>Agent allows dispatching requests against multiple different origins.</p>\n<p>Requests are not guaranteed to be dispatched in order of invocation.</p>",
      "signatures": [
        {
          "textRaw": "`new undici.Agent([options])`",
          "name": "undici.Agent",
          "type": "ctor",
          "params": [
            {
              "name": "options",
              "optional": true
            }
          ],
          "desc": "<p>Arguments:</p>\n<ul>\n<li><strong>options</strong> <code>AgentOptions</code> (optional)</li>\n</ul>\n<p>Returns: <code>Agent</code></p>",
          "modules": [
            {
              "textRaw": "Parameter: `AgentOptions`",
              "name": "parameter:_`agentoptions`",
              "type": "module",
              "desc": "<p>Extends: <a href=\"/docs/docs/api/Pool.html#parameter-pooloptions\"><code>PoolOptions</code></a></p>\n<ul>\n<li><strong>factory</strong> <code>(origin: URL, opts: Object) => Dispatcher</code> - Default: <code>(origin, opts) => new Pool(origin, opts)</code></li>\n<li><strong>maxOrigins</strong> <code>number</code> (optional) - Default: <code>Infinity</code> - Limits the total number of origins that can receive requests at a time, throwing an <code>MaxOriginsReachedError</code> error when attempting to dispatch when the max is reached. If <code>Infinity</code>, no limit is enforced.</li>\n</ul>\n<blockquote>\n<p>[!NOTE]\nLike <code>Pool</code>, <code>Agent</code> inherits all <a href=\"/docs/docs/api/Client.html#parameter-clientoptions\"><code>ClientOptions</code></a>. <code>allowH2</code> defaults to <code>true</code> and <code>maxConcurrentStreams</code> to <code>100</code>. The per-origin <code>Pool</code> it creates uses the default unlimited <code>connections</code>, so concurrent requests to the same origin land on separate <code>Client</code> instances and separate TCP/TLS sockets — HTTP/2 multiplexing on a shared session does not apply unless <code>connections</code> is set to a small value. See <a href=\"/docs/docs/api/Pool.html#parameter-pooloptions\"><code>PoolOptions</code></a>.</p>\n</blockquote>",
              "displayName": "Parameter: `AgentOptions`"
            }
          ]
        }
      ],
      "modules": [
        {
          "textRaw": "Instance Properties",
          "name": "instance_properties",
          "type": "module",
          "properties": [
            {
              "textRaw": "`Agent.closed`",
              "name": "closed",
              "type": "property",
              "desc": "<p>Implements <a href=\"/docs/docs/api/Client.html#clientclosed\">Client.closed</a></p>"
            },
            {
              "textRaw": "`Agent.destroyed`",
              "name": "destroyed",
              "type": "property",
              "desc": "<p>Implements <a href=\"/docs/docs/api/Client.html#clientdestroyed\">Client.destroyed</a></p>"
            }
          ],
          "displayName": "Instance Properties"
        },
        {
          "textRaw": "Instance Methods",
          "name": "instance_methods",
          "type": "module",
          "methods": [
            {
              "textRaw": "`Agent.close([callback])`",
              "name": "close",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherclosecallback-promise\"><code>Dispatcher.close([callback])</code></a>.</p>"
            },
            {
              "textRaw": "`Agent.destroy([error, callback])`",
              "name": "destroy",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "error",
                      "optional": true
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherdestroyerror-callback-promise\"><code>Dispatcher.destroy([error, callback])</code></a>.</p>"
            },
            {
              "textRaw": "`Agent.dispatch(options, handler: AgentDispatchOptions)`",
              "name": "dispatch",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "handler: AgentDispatchOptions"
                    }
                  ]
                }
              ],
              "desc": "<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherdispatchoptions-handler\"><code>Dispatcher.dispatch(options, handler)</code></a>.</p>",
              "modules": [
                {
                  "textRaw": "Parameter: `AgentDispatchOptions`",
                  "name": "parameter:_`agentdispatchoptions`",
                  "type": "module",
                  "desc": "<p>Extends: <a href=\"/docs/docs/api/Dispatcher.html#parameter-dispatchoptions\"><code>DispatchOptions</code></a></p>\n<ul>\n<li><strong>origin</strong> <code>string | URL</code></li>\n</ul>\n<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherdestroyerror-callback-promise\"><code>Dispatcher.destroy([error, callback])</code></a>.</p>",
                  "displayName": "Parameter: `AgentDispatchOptions`"
                }
              ]
            },
            {
              "textRaw": "`Agent.connect(options[, callback])`",
              "name": "connect",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherconnectoptions-callback\"><code>Dispatcher.connect(options[, callback])</code></a>.</p>"
            },
            {
              "textRaw": "`Agent.dispatch(options, handler)`",
              "name": "dispatch",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "handler"
                    }
                  ]
                }
              ],
              "desc": "<p>Implements <a href=\"/docs/docs/api/Dispatcher.html#dispatcherdispatchoptions-handler\"><code>Dispatcher.dispatch(options, handler)</code></a>.</p>"
            },
            {
              "textRaw": "`Agent.pipeline(options, handler)`",
              "name": "pipeline",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "handler"
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherpipelineoptions-handler\"><code>Dispatcher.pipeline(options, handler)</code></a>.</p>"
            },
            {
              "textRaw": "`Agent.request(options[, callback])`",
              "name": "request",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherrequestoptions-callback\"><code>Dispatcher.request(options [, callback])</code></a>.</p>"
            },
            {
              "textRaw": "`Agent.stream(options, factory[, callback])`",
              "name": "stream",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "factory"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherstreamoptions-factory-callback\"><code>Dispatcher.stream(options, factory[, callback])</code></a>.</p>"
            },
            {
              "textRaw": "`Agent.upgrade(options[, callback])`",
              "name": "upgrade",
              "type": "method",
              "signatures": [
                {
                  "params": [
                    {
                      "name": "options"
                    },
                    {
                      "name": "callback",
                      "optional": true
                    }
                  ]
                }
              ],
              "desc": "<p>See <a href=\"/docs/docs/api/Dispatcher.html#dispatcherupgradeoptions-callback\"><code>Dispatcher.upgrade(options[, callback])</code></a>.</p>"
            },
            {
              "textRaw": "`Agent.stats()`",
              "name": "stats",
              "type": "method",
              "signatures": [
                {
                  "params": []
                }
              ],
              "desc": "<p>Returns an object of stats by origin in the format of <code>Record&#x3C;string, TClientStats | TPoolStats></code></p>\n<p>See <a href=\"/docs/docs/api/PoolStats.html\"><code>PoolStats</code></a> and <a href=\"/docs/docs/api/ClientStats.html\"><code>ClientStats</code></a>.</p>"
            }
          ],
          "displayName": "Instance Methods"
        }
      ],
      "displayName": "Agent"
    }
  ]
}