SShortSingh.
Back to feed

How to Test TypeScript AI Agents Without Making Real Model API Calls

0
·1 views

Developers building AI agents in TypeScript often skip proper testing, relying on live runs that can miss critical failures like runaway loops or malformed tool responses. A lightweight interface called ModelClient can be used to inject a scripted fake client during tests, replacing real API calls entirely. The scripted client replays predefined responses in sequence, records all outgoing requests, and clamps to its last step to simulate infinite-loop scenarios safely. This approach allows developers to assert on turn limits, budget checks, and tool result pairing before any broken request reaches the API. The technique keeps production code unchanged while making edge-case agent behaviour fully testable in isolation.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How to auto-post daily funding rounds to Slack using a four-node n8n workflow

A developer has shared a lightweight n8n automation that posts newly funded companies to a Slack channel each morning using just four nodes: a Schedule Trigger, a Datahyena data fetch, an optional filter or scoring step, and a Slack posting node. The workflow pulls funding events filtered by stage, amount, geography, and industry, then formats each result into a concise Slack block showing company name, raise amount, location, and investors. A key requirement is tracking a cursor between runs to avoid reposting duplicate companies, which the author warns will cause teams to mute the channel quickly. The author argues Slack delivery outperforms CRM list views because it is ambient, socially visible, and easy to reconfigure without filing IT requests. The same four-node structure can be adapted for other sales signals such as acquisitions or executive leadership changes.

0
ProgrammingDEV Community ·

Five ways to source startup funding data and what each will cost you

Startup funding data comes in five main forms: free press coverage, incumbent databases like Crunchbase and PitchBook, GTM-focused tools like Harmonic, public filings such as SEC EDGAR Form D, and pay-per-pull filtered feeds. Each option involves a trade-off between cost, depth of historical data, and suitability for automation. Incumbent databases suit research and market mapping but can be expensive and slow to automate, while filtered feeds work better for outbound sales pipelines that need fresh, structured data on a schedule. Public filings are free and authoritative but suffer from reporting lags and incomplete coverage. Experts advise testing any source with real filters — not demo queries — to accurately gauge daily data volume and row quality before committing.

0
ProgrammingDEV Community ·

How to Recreate a VHS Effect in the Browser Using CSS, Canvas, or WebGL

Developers can replicate the classic VHS look directly in the browser without video editing software like After Effects. The effect relies on four key visual elements: horizontal tracking lines, chroma shift between color channels, analog grain and noise, and a blocky date stamp. Three implementation approaches are available — Canvas 2D for per-pixel manipulation, CSS filters for a lightweight static look, and WebGL shaders for the most realistic real-time result. A free browser-based tool also exists for those who want the full effect applied quickly without writing any code. Understanding which artifact produces which visual cue allows developers to implement the effect at whatever complexity level their project requires.

0
ProgrammingDEV Community ·

Narrow Your Funding Trigger to Four Dimensions Before Outbound Outreach

Sales teams running outbound campaigns off funding announcements often cast too wide a net, turning a useful signal into an unmanageable firehose of low-quality leads. A more effective approach requires defining the trigger precisely across four dimensions: funding stage, round size, geography, and industry vertical. Round size serves as a rough proxy for spending capacity, while limiting geography to supported regions and narrowing industry to segments with proven references improves conversion odds. Timing also matters significantly, as reaching out within the first day of an announcement consistently outperforms more polished follow-ups sent days later. Three metrics — time from announcement to first touch, reply rate versus baseline, and the share of leads a rep actually works — can reveal whether a trigger is still too broad.

How to Test TypeScript AI Agents Without Making Real Model API Calls · ShortSingh