Prerequisites

Install dependencies:
pip install "quotientai>=0.4.6" "langgraph>=0.1.6" "openinference-instrumentation-langchain==0.1.1"
Set environment variables:
export ANTHROPIC_API_KEY=your-anthropic-api-key
export QUOTIENT_API_KEY=your-quotient-api-key

Sample Integration

quotient_trace_langgraph.py
from openinference.instrumentation.langchain import LangChainInstrumentor

from quotientai import QuotientAI

quotient = QuotientAI()
quotient.tracer.init(
    app_name="langgraph-weather-app",
    environment="dev",
    instruments=[LangChainInstrumentor()],
)

from langgraph.prebuilt import create_react_agent

def get_weather(city: str) -> str:
    """Get weather for a given city."""
    return f"It's always sunny in {city}!"

@quotient.trace('langgraph-weather-agent')
def main() -> None:
    agent = create_react_agent(
        model="anthropic:claude-3-7-sonnet-latest",
        tools=[get_weather],
        prompt="You are a helpful assistant",
    )
    agent.invoke({"messages": [{"role": "user", "content": "what is the weather in sf"}]})

if __name__ == "__main__":
    main()

Notes

  • The LangChain instrumentor emits spans for tool calls, model invocations, and state transitions within the graph.
  • Use descriptive span names in the decorator to quickly identify flows in the Quotient UI.

Next: Smolagents