Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

add-lens

БесплатноБез исполняемых скриптовНе проверен

Add Redis Iris Lens tracing to an existing AI agent through redis-iris, so every agent turn is one trace in the Lens UI with its LLM calls, tokens, tool…

redisот redis★ 177 звёзд на GitHub

Об этом скилле

Add Lens

One trace per agent turn, visible in the Lens UI under the agent's agent_id. Lens runs inside redis-iris; it has no service to provision and no CLI. Two lines at start-up, one turn per message, then close the gaps the agent has. Lens sits next to any other Iris product, or none.

Full reference: Lens (docs/core/lens.md in redis-iris).

1. Discover

Read the project:

  • The turn: where one user message becomes one answer (app.invoke, Runner.run, runner.run_async, agent.run, kickoff, or the handler around a hand-written loop).
  • The ids: where the agent's own name lives, and where each request's session or thread id and user id live. Always set both agent_id and session_id. Every Lens UI view is filtered by agent_id, so a trace without one never shows. Turns are shown grouped by session, so a turn without a session id does not show either (showing turns without a session is an upcoming feature).
  • Start-up: the one place that runs before the first turn (app factory, main, worker boot).
  • The model client: the library that finally calls the model, under any framework. Lens instruments four: openai, anthropic, botocore (Bedrock) and langchain_core. Many frameworks call one of these underneath; confirm in step 2. Any other client (for example google-genai or litellm) records no LLM span and no tokens unless step 6 adds an instrumentor for it.
  • Existing telemetry: opentelemetry, TracerProvider, opentelemetry-instrument, OTEL_* variables, or another LLM instrumentation. Note who installs the global provider and when.
  • The gaps in step 5: .client calls, custom retrieval, thread pools, process hops, short-lived processes.

Then match the shape. It decides who opens the turn:

The agent Turn opened by You add
redis_iris.integrations.langgraph.attach(hooks, graph) attach, on every invoke / stream and async twin, session from configurable.thread_id, user from configurable.user_id lens.init() only
workflows.turn(...) / workflows.aturn(...) workflows.turn, from session= and owner= lens.init() only
LangGraph without attach you lens.turn() around app.invoke / app.ainvoke, thread id as the session
Google ADK, including redis_iris.integrations.adk.attach you: ADK attach does not open one, so before and after would be two traces lens.turn() around runner.run_async
OpenAI Agents SDK you lens.turn() around Runner.run
Pydantic AI, CrewAI, any other framework you lens.turn() around agent.run / kickoff
Plain loop (openai, anthropic, another client) you lens.turn() around the handler for one message, not around one model call

Two loops in one process: each opens its own turns at its own seam. A turn already open is kept; attach and workflows.turn add none inside it.

2. Get current facts from MCP

Do this before writing code. Never guess framework APIs from memory.

  • Framework docs: query an available docs MCP (Context7, or the framework's own) for the installed version's run entry point, which model client it calls underneath, whether it emits OpenTelemetry spans of its own, and whether it runs work on threads or other processes.
  • Redis docs: if the Redis docs MCP is connected, use it for Lens concepts.
  • No MCP available: read the installed package source in the virtualenv. Say so in the report.

3. Install and configure

Always install the extra. It brings the instrumentation lens.init() starts for OpenAI, Anthropic, Bedrock and LangChain, mcp and threading; without it there are no LLM spans and no token totals.

  • uv.lock or [tool.uv] present: uv add 'redis-iris[llm-tracing]'.
  • Poetry: poetry add 'redis-iris[llm-tracing]'.
  • Otherwise add redis-iris[llm-tracing] to the project's requirements file.

The endpoint and the agent key come from the Lens UI. There is no CLI command that mints them, so hand off: tell the person to open the Lens UI, copy the Lens endpoint, create an agent key, and put both in .env as below. Never ask for the key in chat, pass it on a command line, or echo, cat or grep an env file.

IRIS_LENS_ENDPOINT=   # the Iris host, such as https://iris.example.com
IRIS_LENS_API_KEY=    # the Lens agent key

Add the same two names to .env.example with empty values. Never commit .env. On-prem inside the cluster, the endpoint can be plain http (http://lens-dataplane:9000) only with IRIS_LENS_ALLOW_INSECURE=true.

Leave content capture at its default. Do not ask about it.

4. Wire

At start-up, once, before the first turn and after the app's own OpenTelemetry setup (step 6):

import logging

from redis_iris import lens

lens.init(agent_id="support-bot")  # always: every Lens UI view is filtered by agent_id
state = lens.instrumentation()
if state.get("lens") != "on":
    logging.warning("Lens is not recording: %s", state)
Полный SKILL.md на GitHub

Установить add-lens в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл add-lens?

Add Redis Iris Lens tracing to an existing AI agent through redis-iris, so every agent turn is one trace in the Lens UI with its LLM calls, tokens, tool calls, memory and document retrievals, and which of them entered the prompt. Detects how the agent runs (LangGraph or ADK attach, workflows.turn, another framework, or a plain loop), installs redis-iris[llm-tracing], calls lens.init(agent_id=...), opens one lens.turn() per turn where Iris does not open it already, and covers coexistence with an OpenTelemetry setup or LLM instrumentation the app already has. Use when the user asks to add Lens, tracing, observability, or per-turn traces to their agent, or asks why their Lens traces are missing.

Как установить скилл add-lens?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл add-lens запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить add-lens с