Installation
Install AgentOps and the necessary LangChain dependencies:Setting Up API Keys
You’ll need API keys for AgentOps and OpenAI (asChatOpenAI
is commonly used with LangChain):
- OPENAI_API_KEY: From the OpenAI Platform
- AGENTOPS_API_KEY: From your AgentOps Dashboard
.env
file.
Usage
Integrating AgentOps with LangChain involves using theLangchainCallbackHandler
.
You don’t need a separate
agentops.init()
call; the LangchainCallbackHandler
initializes the AgentOps client automatically if an API key is provided to it or found in the environment.