Skip to content

Function: createAgent()

ts
function createAgent(): Promise<HttpProxyAgent<string> | HttpsProxyAgent<string> | undefined>;

Defined in: src/proxy/index.ts:100

Create an HTTP or HTTPS proxy agent from the Windows system proxy settings. Return undefined on non-Windows platforms or when no proxy is configured.

Returns

Promise<HttpProxyAgent<string> | HttpsProxyAgent<string> | undefined>

The proxy agent, or undefined if no proxy applies.

Example

ts
const agent = await createAgent();
if (agent) {
  fetch('https://api.example.com/invoices', { agent });
}

Matterway Assistant SDK Documentation