import openai
import agentops

# Beginning of program's code (i.e. main.py, __init__.py)
agentops.init(<INSERT YOUR API KEY HERE>)

# Woohoo! You're on your way 🎉

Explanation

When openai has been imported, instantiating the AgentOps client will automatically instrument chat completions. You will be able to see all of your sessions on the AgentOps dashboard along with the full LLM chat histories, cost, token counts, etc.

Finishing up on the basic functionality

Example Code

Here is the complete code from the sections above

python
import openai
import agentops

# Beginning of program's code (i.e. main.py, __init__.py)
agentops.init(<INSERT YOUR API KEY HERE>)

# (record specific functions)
@agentops.record_function('sample function being record')
def sample_function(...):
  ...

# (track a named agent)
@agentops.track_agent(name='my-expert-agent')
class sample_agent(...):
  ...

# End of program
agentops.end_session('Success')
# Woohoo! You're done 🎉

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!

Explore our more advanced functionality!