Quickstart
Start using AgentOps with just 2 lines of code
Install the AgentOps SDK
Add 2 lines of code
Make sure to call agentops.init
before calling any openai
, cohere
, crew
, etc models.
Get an AgentOps API key here
Set your API key as an .env
variable for easy access.
Run your agent
Execute your program and visit app.agentops.ai/drilldown to observe your Agent! 🕵️
Clickable link to session
More basic functionality
Decorate Functions
You can instrument other functions inside your code with the handy @record_action
decorator, which will record an action_type
, the parameters, and the returns. You
will see these function calls alongside your LLM calls from instantiating the AgentOps client.
Track Agents
If you use specific named agents within your system, you can tie all downstream Events to a
Named Agent with the @track_agent
decorator.
Ending Your Session
Finally, you should end your session by calling .end_session()
indicating whether your session
was successful or not (Success|Fail)
. We suggest setting session state depending on how
your agent exits or whether your agent succeeded or not. You can also specify a end state reason,
such as user interrupted, ran to completion, or unhandled exception.
Example Code
Here is the complete code from the sections above
Simple Code Example
Jupyter Notebook with sample code that you can run!
That’s all you need to get started! Check out the documentation below to see how you can record other events. AgentOps is a lot more powerful this way!