Get started
Set up with your coding agent
Add Latent to your project by pasting one prompt into Claude Code, Codex, Cursor or another coding agent.
Your coding agent can add Latent to a project in one pass. The change is small: install one package, read two environment variables and add one call at startup.
The prompt
Paste this into your coding agent while it works in your project:
Add Latent hallucination scoring to this project.
Read https://runlatent.ai/docs/quickstart and https://runlatent.ai/docs/sdk before changing any code.
1. Install the runlatent package from PyPI (pip install runlatent) and add it to the project's dependencies.
2. Read LATENT_API_URL and LATENT_API_KEY from the project's environment configuration. Add both to the example env file if there is one, with LATENT_API_URL=https://app.runlatent.ai. Do not write a real key into the code.
3. In the app's entry point, import runlatent and call runlatent.auto_instrument() once at startup, before any OpenAI, Anthropic or Google GenAI client is created, including an openai client pointed at another endpoint by base_url.
4. If LATENT_API_KEY is not set, stop here and ask me to create a key at https://app.runlatent.ai and add it to the project's environment myself. Never ask for the key in this chat.
5. Run the app once so it makes one model call, then call runlatent.flush() and print runlatent.stats(). Confirm that "posted" is at least 1 and "failed" is 0.
Change nothing else.
What the agent changes
- A dependency.
runlatentjoins your requirements. It brings no dependencies of its own. - Two environment variables.
LATENT_isAPI_ URL https://, andapp. runlatent. ai LATENT_is your key, shown once on the console's setup page after you first sign in. It lasts one year. The key stays in your environment and never in the code.API_ KEY - One call at startup.
runlatent.covers every OpenAI, Anthropic and Google GenAI client the process creates.auto_ instrument() - A check. With a key set, one model call, then
runlatent.andflush() runlatent.show the answer was posted and none failed. Without a key, the agent stops and asks you to add one, so the key never passes through the chat.stats()
Nothing else in the app changes: the agent does not wrap calls, add retries or touch your prompts.
Review the change
Before you merge, check three things in the diff:
- The key is read from the environment.
auto_runs once, at startup.instrument() - No other code changed.
Best practices
- Ask the agent to stop after the check, so a first run never reaches production traffic by surprise.
- Leave
LATENT_andAPI_ URL LATENT_unset in environments where you don't want answers sent. Nothing is sent without one of them.SIDECAR_ URL - If your team prefers explicit wiring, ask the agent to use the per-client wrappers in the Python SDK reference instead of
auto_.instrument()
Was this page helpful?
Updated 3 October 2026