{"id":46881,"library":"agentch","title":"agentch","description":"agentch v0.5.2 is a lightweight HTTP request agent built on the Fetch API, written in TypeScript. It provides a minimal abstraction over fetch for making requests with support for interceptors, timeouts, and custom headers. Released under an MIT license, it is intended primarily for Node.js environments but can work in browsers that support fetch. The library is still in early development (0.x) with an unstable API and known missing features like race condition handling, caching, and retry logic. It differentiates from axios and superagent by relying entirely on the native fetch, thus having no dependencies, but this also means it lacks Node.js-specific features like HTTP/2 or agent handling currently. With weekly updates, it targets developers needing a tiny, typed fetch wrapper.","status":"active","version":"0.5.2","language":"javascript","source_language":"en","source_url":"https://github.com/lanbenhua/agentch","tags":["javascript","fetch","agent","request","ts","typescript"],"install":[{"cmd":"npm install agentch","lang":"bash","label":"npm"},{"cmd":"yarn add agentch","lang":"bash","label":"yarn"},{"cmd":"pnpm add agentch","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; use import syntax. Agent is the main class.","wrong":"const Agent = require('agentch')","symbol":"Agent","correct":"import { Agent } from 'agentch'"},{"note":"createAgent is a named export, not default. Use curly braces.","wrong":"import createAgent from 'agentch'","symbol":"createAgent","correct":"import { createAgent } from 'agentch'"},{"note":"AgentConfig is a TypeScript type; use import type for more efficient compiled output.","wrong":"import { AgentConfig } from 'agentch'","symbol":"AgentConfig","correct":"import type { AgentConfig } from 'agentch'"}],"quickstart":{"code":"import { Agent } from 'agentch';\n\nconst agent = new Agent({\n  baseURL: 'https://api.example.com',\n  timeout: 5000,\n  headers: {\n    'Content-Type': 'application/json',\n  },\n});\n\nasync function main() {\n  try {\n    const response = await agent.get('/data', {\n      params: { id: 123 },\n    });\n    console.log('Status:', response.status);\n    const body = await response.json();\n    console.log('Body:', body);\n  } catch (error) {\n    console.error('Request failed:', error);\n  }\n}\n\nmain();","lang":"typescript","description":"Creates an Agent instance with base URL, timeout, and custom headers, then performs a GET request with query parameters."},"warnings":[{"fix":"Pin to exact version in package.json (e.g., \"agentch\": \"0.5.2\") and review changelog before upgrading.","message":"agentch is v0.5.2 and under active development; API breaking changes may occur between minor versions.","severity":"breaking","affected_versions":"<1.0.0"},{"fix":"Use Node's undici or node-fetch polyfill and configure via fetch options if needed. The library does not expose a way to pass custom fetch implementation yet.","message":"The Agent class uses native fetch, which does not support Node.js specific agent options (e.g., keepAlive, ca certificates) out of the box.","severity":"gotcha","affected_versions":"*"},{"fix":"Currently no replacement; consider wrapping agent calls with retry logic from a library like 'p-retry' or 'retry-axios' and treat as temporary.","message":"The package does not have built-in retry or caching mechanisms; implementing your own may conflict with future versions.","severity":"deprecated","affected_versions":"*"},{"fix":"Always verify type assertions manually or use 'as' casts for response data if needed.","message":"TypeScript types are bundled but may not be fully accurate for edge cases (e.g., response body parsing).","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'0':63 'abstract':22 'agent':9,110,127 'agentch':1,2 'also':100 'api':14,68 'axio':84 'browser':52 'built':10 'cach':77 'condit':75 'current':112 'custom':34 'depend':97 'develop':62,118 'differenti':82 'earli':61 'entir':89 'environ':47 'featur':72,106 'fetch':13,24,55,93,123,126 'handl':76,111 'header':35 'http':7 'http/2':108 'intend':43 'interceptor':31 'javascript':125 'known':70 'lack':103 'librari':57 'licens':40 'lightweight':6 'like':73,107 'logic':80 'make':26 'mean':101 'minim':21 'miss':71 'mit':39 'nativ':92 'need':119 'node.js':46,104 'primarili':44 'provid':19 'race':74 'releas':36 'reli':88 'request':8,27,128 'retri':79 'specif':105 'still':59 'superag':86 'support':29,54 'target':117 'thus':94 'timeout':32 'tini':121 'ts':129 'type':122 'typescript':17,130 'unstabl':67 'updat':115 'v0.5.2':3 'week':114 'work':50 'wrapper':124 'written':15 'x':64","created_at":"2026-06-07T16:48:03.189750+00:00","updated_at":"2026-06-07T16:48:03.189750+00:00","problems":[{"fix":"Run `npm install agentch` or ensure package.json includes \"agentch\": \"^0.5.2\" and run `npm install`.","cause":"Package not installed or not in node_modules.","error":"Error: Cannot find module 'agentch'"},{"fix":"Ensure you are using v0.5.2 and import correctly: `import { Agent } from 'agentch'`. Check your agentch version: `npm ls agentch`.","cause":"Importing Agent incorrectly or using an older version that doesn't have get method.","error":"TypeError: agent.get is not a function"},{"fix":"Always provide a valid string for baseURL or omit it and pass full URLs in request methods.","cause":"Passing undefined or non-string to the Agent constructor baseURL option.","error":"ERR_INVALID_ARG_TYPE: The \"url\" argument must be of type string"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/lanbenhua/agentch#readme","github":"https://github.com/lanbenhua/agentch","docs":null,"changelog":null,"pypi":null,"npm":"agentch","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}