Be aware that LLMs responses are non-deterministic and the results vary in quality. Take this guide as a starting point to understand how to use Checkly with AI agents.
Getting started with Checkly using AI agents
Context management is one of the most important concepts when using LLMs because the AI models usually have a cut-off date and without providing documentation and guidance your results will suffer from hallucinations. The same applies if you want to use your agent to configure your Checkly monitoring. Before your AI assistant can effectively configure Checkly monitoring, it needs context about your project, your monitoring goals, and Checkly documentation and conventions. This context is critical and without it, the LLM will rely on potentially outdated training data and most likely produce unreliable results.Add the Checkly rules file
Download the official Checkly rules file and add it to your project. This file contains instructions on project structure, CLI commands, links to documentation and code examples for all the different Checkly check types.checkly.rules.md
.claude/ directory because the guide uses Claude Code.
Configure your AI agent to read this file
Generally, you don’t want to fill your conversation context with unwanted tokens. To avoid including all this Checkly information in every conversation, update your AI assistant’s configuration file (e.g.,CLAUDE.md) to reference the Checkly rules if needed.
Add an instruction like:
claude.md
Initialize Checkly in your project (optional)
If your project doesn’t include a validcheckly.config.ts yet, ask your AI assistant to set up Checkly:
AI Prompt
npx checkly init, which generates a checkly.config.ts file and a __checks__ directory. This base configuration file defines your project meta information, default check frequencies, and monitoring locations.
checkly.config.ts
checkly.config.ts and the checkly CLI dependency installed things will be fine.
Set up uptime monitoring
Uptime monitoring verifies that your endpoints are accessible and responding correctly. To target your production or preview site, add additional context to yourclaude.md (recommended).
claude.md
AI Prompt
base-url.check.ts) that initializes a new UrlMonitor containing the URL, expected status code, check frequency, and monitoring locations.
base-url.check.ts
AI Prompt
checkly.rules.md, the AI knows how to handle the Checkly CLI and runs npx checkly test, which executes your monitoring configuration in Checkly’s infrastructure.
Setting up alert channels
Monitors need alert channels to notify you when something breaks. Luckily, alert channels can also be defined in code. Request and set up anEmailAlert construct:
AI Prompt
- alert-channels.ts
- base-url.check.ts
Modifying monitoring locations
Now that your project includes acheckly.config and defines an uptime monitor in code, additional monitoring adjustments are only one prompt away:
AI Prompt
eu-central-1 as a monitoring location.
base-url.check.ts
Set up API monitoring
For a solid monitoring strategy uptime monitoring is only the first step. API Checks go beyond uptime monitoring by validating response payloads with assertions. To create complex assertions, target AI to analyze your source code to generate meaningful assertions automatically.AI Prompt
product-api.check.ts
Review generated assertions carefully. AI can hallucinate properties or use incorrect assertion syntax. Always verify against your actual API response.
Use Playwright for synthetic monitoring
Checkly provides Playwright Check Suites, which let you reuse existing Playwright tests as synthetic monitors. Monitor critical user flows like login, checkout, or search in production using your existing Playwright Test code base.Organizing tests for monitoring
Full Playwright Test suites often run for more than ten minutes; this execution time is too slow for production monitoring because you don’t want to wait for a slow Playwright test suite to finish before getting alerted about failures. To guarantee timely alerts, it’s recommended to use Playwright’s Projects to tag tests entering your monitoring setup:playwright.config.ts
Critical Playwright project will only include tests tagged with @critical to run independently as fast, focused synthetic monitors.
Creating a Playwright Check Suite
If you have this basic Playwright configuration in place, prompt your AI assistant to reuse the critical tests as production monitors. Prompt your AI assistant:AI Prompt
check.ts file using the PlaywrightCheck construct that references your Playwright project:
critical-suite.check.ts
npx checkly deploy, Checkly runs your Playwright tests on schedule from the defined global locations. Results include full Playwright traces for debugging in case of an alert.
Playwright test generation
At this stage, you control your entire Checkly monitoring by talking to your favorite AI agent. But could you generate Playwright tests as well? To generate Playwright tests via an LLM, use MCP (Model Context Protocol) and the official Playwright MCP server. The Playwright MCP server lets AI assistants control browsers directly, capturing page snapshots and context needed to generate accurate tests. This alone doesn’t enable AI test generation, though. The key to successful test generation is, as with many things in AI, to provide valuable context. Luckily, the Playwright MCP server doesn’t only allow you to control browsers via an LLM, but also reports back with extensive page context. If the controlled browser navigates to a page, page snapshots, DOM structures, the network waterfall and JavaScript exceptions will enter your agent conversation. With this information being included in the conversation context, you can turn your agent into a Playwright Test generator with some context engineering.generate-playwright-test.md
search-liquid.spec.ts
@critical tag to include the new test in your monitoring suite. Of course, you can perform this action in plain English, too.
AI Prompt
search-liquid.spec.ts
Set up, control and configure your entire monitoring infrastructure through conversational prompts thanks to Monitoring as Code and Checkly’s code-first approach. As mentioned in the beginning: Checkly is by definition AI-ready without complex setups or additional MCP servers.
Key takeaways
- Regardless of what you want to achieve: context is everything. Update your
checkly-rules.mdand AI configuration files to fit your project’s requirements. When the AI produces unwanted output, refine your instructions. Aclaude.mdoragents.mdis never done! - Always review generated code. AI assistants are useful but not perfect. You’re still responsible for what you deploy.
- Test your monitoring configuration before deploying. Use
npx checkly testto validate checks locally before pushing to production. - Your AI agent might deploy your monitoring when running in YOLO or
--skip-permissionsmode. Be aware of this risk and implement guard rails.