Python SDK for AI agent monitoring, LLM cost tracking, benchmarking, and more. Integrates with most LLMs and agent frameworks including CrewAI, Agno, OpenAI Agents SDK, Langchain, Autogen, AG2, and CamelAI
Python agentagentopsagents-sdkaianthropicautogencost-estimationcrewaievalsevaluation-metricsgroqlangchainllmmistralollamaopenaiopenai-agents
Fixing job_posting and calling end_session in notebook automation (#390)
Howard Gil8161133a853f
diff --git a/.github/workflows/test-notebooks.yml b/.github/workflows/test-notebooks.ymlindex 406a7351..303437e0 100644--- a/.github/workflows/test-notebooks.yml+++ b/.github/workflows/test-notebooks.yml@@ -1,14 +1,7 @@name: Test Notebookson:- push:- branches:- - main- paths:- - "agentops/**"- - "examples/**"- - "tests/**"- - ".github/workflows/test-notebooks.yml"- pull_request_target:+ pull_request:+ types: [closed]branches:- mainpaths:@@ -43,13 +36,17 @@ jobs:echo "GROQ_API_KEY=${{ secrets.GROQ_API_KEY }}" >> .envecho "MULTION_API_KEY=${{ secrets.MULTION_API_KEY }}" >> .envecho "SERPER_API_KEY=${{ secrets.SERPER_API_KEY }}" >> .env+ - name: Install AgentOps from main branch and remove agentops install from notebooks+ run: |+ pip install git+https://github.com/AgentOps-AI/agentops.git@main+ find . -name '*.ipynb' -exec sed -i '/^%pip install.*agentops/d' {} +- name: Run notebooks and check for errorsrun: |mkdir -p logsexit_code=0exclude_notebooks=(- "./examples/crew/job_posting.ipynb",+ "./examples/crewai_examples/job_posting.ipynb","./examples/demos/agentchat_agentops.ipynb")diff --git a/examples/anthropic-sdk/anthropic_example.ipynb b/examples/anthropic_examples/anthropic_example.ipynbsimilarity index 100%rename from examples/anthropic-sdk/anthropic_example.ipynbrename to examples/anthropic_examples/anthropic_example.ipynbdiff --git a/examples/autogen/AgentChat.ipynb b/examples/autogen_examples/AgentChat.ipynbsimilarity index 99%rename from examples/autogen/AgentChat.ipynbrename to examples/autogen_examples/AgentChat.ipynbindex 4de700ab..85fd4991 100644--- a/examples/autogen/AgentChat.ipynb+++ b/examples/autogen_examples/AgentChat.ipynb@@ -146,6 +146,7 @@"except StdinNotImplementedError:\n"," # This is only necessary for AgentOps testing automation which is headless and will not have user input\n"," print(\"Stdin not implemented. Skipping initiate_chat\")\n",+ " agentops.end_session(\"Indeterminate\")\n","\n","# Close your AgentOps session to indicate that it completed.\n","agentops.end_session(\"Success\")\n",diff --git a/examples/autogen/MathAgent.ipynb b/examples/autogen_examples/MathAgent.ipynbsimilarity index 99%rename from examples/autogen/MathAgent.ipynbrename to examples/autogen_examples/MathAgent.ipynbindex bf542594..13bf58a8 100644--- a/examples/autogen/MathAgent.ipynb+++ b/examples/autogen_examples/MathAgent.ipynb@@ -195,6 +195,7 @@"except StdinNotImplementedError:\n"," # This is only necessary for AgentOps testing automation which is headless and will not have user input\n"," print(\"Stdin not implemented. Skipping initiate_chat\")\n",+ " agentops.end_session(\"Indeterminate\")\n","\n","agentops.end_session(\"Success\")"]diff --git a/examples/cohere-sdk/cohere_example.ipynb b/examples/cohere_examples/cohere_example.ipynbsimilarity index 100%rename from examples/cohere-sdk/cohere_example.ipynbrename to examples/cohere_examples/cohere_example.ipynbdiff --git a/examples/crew/README.md b/examples/crewai_examples/README.mdsimilarity index 100%rename from examples/crew/README.mdrename to examples/crewai_examples/README.mddiff --git a/examples/crew/job_posting.ipynb b/examples/crewai_examples/job_posting.ipynbsimilarity index 95%rename from examples/crew/job_posting.ipynbrename to examples/crewai_examples/job_posting.ipynbindex eb3faaaa..4c118ac4 100644--- a/examples/crew/job_posting.ipynb+++ b/examples/crewai_examples/job_posting.ipynb@@ -41,7 +41,10 @@"from crewai_tools.tools import WebsiteSearchTool, SerperDevTool, FileReadTool\n","import agentops\n","import os\n",- "from dotenv import load_dotenv"+ "from dotenv import load_dotenv\n",+ "from IPython.core.error import (\n",+ " StdinNotImplementedError,\n",+ ") # only needed by AgentOps testing automation"]},{@@ -244,8 +247,13 @@" ],\n",")\n","\n",- "# Kick off the process\n",- "result = crew.kickoff()\n",+ "try:\n",+ " # Kick off the process\n",+ " result = crew.kickoff()\n",+ "except StdinNotImplementedError:\n",+ " # This is only necessary for AgentOps testing automation which is headless and will not have user input\n",+ " print(\"Stdin not implemented. Skipping kickoff()\")\n",+ " agentops.end_session(\"Indeterminate\")\n","\n","print(\"Job Posting Creation Process Completed.\")\n","print(\"Final Job Posting:\")\n",diff --git a/examples/crew/markdown_validator.ipynb b/examples/crewai_examples/markdown_validator.ipynbsimilarity index 100%rename from examples/crew/markdown_validator.ipynbrename to examples/crewai_examples/markdown_validator.ipynbdiff --git a/examples/demos/agentchat_agentops.ipynb b/examples/demos/agentchat_agentops.ipynbindex 7b0d7b18..2aa7a84e 100644--- a/examples/demos/agentchat_agentops.ipynb+++ b/examples/demos/agentchat_agentops.ipynb@@ -196,6 +196,7 @@"except StdinNotImplementedError:\n"," # This is only necessary for AgentOps testing automation which is headless and will not have user input\n"," print(\"Stdin not implemented. Skipping initiate_chat\")\n",+ " agentops.end_session(\"Indeterminate\")\n","\n","# Close your AgentOps session to indicate that it completed.\n","agentops.end_session(\"Success\")"diff --git a/examples/langchain/langchain_examples.ipynb b/examples/langchain_examples/langchain_examples.ipynbsimilarity index 99%rename from examples/langchain/langchain_examples.ipynbrename to examples/langchain_examples/langchain_examples.ipynbindex 361064c6..b087de3b 100644--- a/examples/langchain/langchain_examples.ipynb+++ b/examples/langchain_examples/langchain_examples.ipynb@@ -148,6 +148,10 @@},"outputs": [],"source": [+ "agentops_handler = AgentOpsLangchainCallbackHandler(\n",+ " api_key=AGENTOPS_API_KEY, default_tags=[\"Langchain Example\"]\n",+ ")\n",+ "\n","llm = ChatOpenAI(\n"," openai_api_key=OPENAI_API_KEY, callbacks=[agentops_handler], model=\"gpt-3.5-turbo\"\n",")\n",diff --git a/examples/litellm-sdk/litellm_example.ipynb b/examples/litellm_examples/litellm_example.ipynbsimilarity index 100%rename from examples/litellm-sdk/litellm_example.ipynbrename to examples/litellm_examples/litellm_example.ipynbdiff --git a/examples/multion/Autonomous_web_browsing.ipynb b/examples/multion_examples/Autonomous_web_browsing.ipynbsimilarity index 100%rename from examples/multion/Autonomous_web_browsing.ipynbrename to examples/multion_examples/Autonomous_web_browsing.ipynbdiff --git a/examples/multion/Sample_browsing_agent.ipynb b/examples/multion_examples/Sample_browsing_agent.ipynbsimilarity index 100%rename from examples/multion/Sample_browsing_agent.ipynbrename to examples/multion_examples/Sample_browsing_agent.ipynbdiff --git a/examples/multion/Step_by_step_web_browsing.ipynb b/examples/multion_examples/Step_by_step_web_browsing.ipynbsimilarity index 100%rename from examples/multion/Step_by_step_web_browsing.ipynbrename to examples/multion_examples/Step_by_step_web_browsing.ipynbdiff --git a/examples/multion/Webpage_data_retrieval.ipynb b/examples/multion_examples/Webpage_data_retrieval.ipynbsimilarity index 100%rename from examples/multion/Webpage_data_retrieval.ipynbrename to examples/multion_examples/Webpage_data_retrieval.ipynb