export type CreateApiTinyfishAgentV1AutomationRunAsyncArgs = {body: {url: string, goal: string, browser_profile?: string | undefined, agent_config?: Record | undefined, capture_config?: Record | undefined, webhook_url?: string | undefined, use_vault?: boolean | undefined, use_profile?: boolean | undefined, profile_id?: string | undefined, proxy_config?: Record | undefined, output_schema?: Record | undefined}}; export type CreateApiTinyfishAgentV1AutomationRunAsyncOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Start a browser automation task asynchronously. Returns a run_id immediately without waiting for completion. Use GET /v1/runs/{id} to poll for results. * * POST /tinyfish-agent/v1/automation/run-async */ export const createApiTinyfishAgentV1AutomationRunAsync = async (args: CreateApiTinyfishAgentV1AutomationRunAsyncArgs, options?: CreateApiTinyfishAgentV1AutomationRunAsyncOptions) => { const {baseUrl = "https://api.orthogonal.com/mpp", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/tinyfish-agent/v1/automation/run-async${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };