counterfact-repl

Interact with a Counterfact mock server Admin API to manipulate context state and proxy settings.

169|19|Updated Apr 8, 2022
One-click install
npx skills add https://github.com/counterfact/api-simulator --skill counterfact-repl
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: counterfact-repl
Source: https://github.com/counterfact/api-simulator/tree/main/skills/counterfact-repl
Command: npx skills add https://github.com/counterfact/api-simulator --skill counterfact-repl

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

AI agents often need to interact with a live API mock to inspect and adjust runtime state, proxy decisions, and endpoint behavior without restarting servers.

Core Features & Use Cases

  • Admin API access to health, contexts, config, routes, and proxy for on-demand management.
  • A JavaScript REPL to modify mock state and script behavior at runtime.
  • Proxy mode to selectively route paths to real backends while maintaining mocked responses.
  • Hierarchical contexts with smart diffing for efficient updates across nested paths. Use cases include inspecting current state, simulating failures, switching between mock and proxy, and batch data setup.

Quick Start

Start a Counterfact server, then call GET /_counterfact/api/health to verify it is running and begin manipulating state.

Frequently Asked Questions about counterfact-repl

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I change API mock state at runtime without restarting the server?

You can change API mock state at runtime by interacting with a running Counterfact mock server via its Admin API, manipulating context state and proxy settings through REST endpoints under /_counterfact/api.

Can I selectively route some API paths to a real backend while keeping others mocked?

Yes, proxy mode allows you to selectively route specific paths to real backends while maintaining mocked responses for others, enabling hybrid testing scenarios during development.

How do I verify a Counterfact mock server is running and ready for state manipulation?

Call GET /_counterfact/api/health to verify the Counterfact mock server is running before you begin manipulating context state, config, routes, and proxy settings.

What is the best way to simulate API failures during AI agent testing?

Simulating API failures during AI agent testing is best achieved by using an OpenAPI-driven mock server with runtime Admin API access, allowing you to adjust endpoint behavior and state on demand.

Does Counterfact support stateful behavior for OpenAPI-driven mocks?

Yes, Counterfact supports stateful behavior for OpenAPI-driven mocks by maintaining in-memory state and offering hierarchical contexts with smart diffing for efficient runtime updates.