add-lens
Installation
SKILL.md
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_idandsession_id. Every Lens UI view is filtered byagent_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) andlangchain_core. Many frameworks call one of these underneath; confirm in step 2. Any other client (for examplegoogle-genaiorlitellm) 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:
.clientcalls, custom retrieval, thread pools, process hops, short-lived processes.
Then match the shape. It decides who opens the turn: