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
Clean up v2 docs links (#1058)
Alex Reibman79c38c503d9e
diff --git a/docs/v1/concepts/core-concepts.mdx b/docs/v1/concepts/core-concepts.mdxindex 4a6cc74c..cd181965 100644--- a/docs/v1/concepts/core-concepts.mdx+++ b/docs/v1/concepts/core-concepts.mdx@@ -47,8 +47,6 @@ AgentOps can exist in one of two states:By default, AgentOps operates in single-session mode. All of the [base SDK functions](/v1/usage/sdk-reference) work as expected.-<Note>Under the hood, when you only have one session at a time, AgentOps can use functions like `agentops.add_tags(...)` and know that you want to perform the function on the one and only active session.</Note>-As soon as you create a second session, AgentOps enters **Multi-Session Mode**. As long as more than one session is active, the [base SDK functions](/v1/usage/sdk-reference) will no longer work.If multiple sessions exist, you are expected to call the function on the relevant session. Exdiff --git a/docs/v1/concepts/sessions.mdx b/docs/v1/concepts/sessions.mdxindex 60a503c8..eaec1883 100644--- a/docs/v1/concepts/sessions.mdx+++ b/docs/v1/concepts/sessions.mdx@@ -41,17 +41,6 @@ Optionally, sessions may include:**Params**- **event** ([Event](/v1/concepts/events#event-class)): The Event to record as part of the session--#### `add_tags`-**Params**-- **tags** (List[str]): a list of tags to assign to append to the current tags--#### `set_tags`-**Params**-- **tags** (List[str]): a list of tags to assign to append to set--_Note: Overrides any current tags_-#### `get_analytics`**Returns** (dict): A dictionary containing various analytics metrics for the session.@@ -183,7 +172,7 @@ _More info for the curious_Under the hood, `agentops.init()` creates a `Client` object with various configuration options. Whenever you start a new session, these configuration options will automaticallybe applied. You can also apply different configuration options when you start a new session by passing in a-[Configuration](/v1/usage/sdk-reference/#configuration) object.+[Config](/v1/usage/sdk-reference/#config) object.<script type="module" src="/scripts/github_stars.js"></script><script type="module" src="/scripts/adjust_api_dynamically.js"></script>diff --git a/docs/v1/usage/advanced-configuration.mdx b/docs/v1/usage/advanced-configuration.mdxindex 4b3d9010..393b57e1 100644--- a/docs/v1/usage/advanced-configuration.mdx+++ b/docs/v1/usage/advanced-configuration.mdx@@ -18,8 +18,6 @@ Find your AgentOps API Key in your Settings > [Projects & API Keys](https://app.#### Optional settings:```python .env-# Secondary API Key for simultaneously recording to a second project-AGENTOPS_PARENT_KEY=<YOUR PARENT KEY># The AgentOps API endpoint. Defaults to https://api.agentops.aiAGENTOPS_API_ENDPOINT=https://api.agentops.ai# Logging level. <DEBUG, INFO, CRITICAL>. Defaults to INFOdiff --git a/docs/v1/usage/langchain-callback-handler.mdx b/docs/v1/usage/langchain-callback-handler.mdxindex b10ab5eb..41c89cad 100644--- a/docs/v1/usage/langchain-callback-handler.mdx+++ b/docs/v1/usage/langchain-callback-handler.mdx@@ -36,8 +36,7 @@ When calling `.init()`, pass in the proper parameter.`agentops.init(instrument_llm_calls=False)`If you are building an Agent framework or other SDK and adding support for AgentOps, you cannot guarantee that your end user will-properly include `instrument_llm_calls=False`. In this case, call-`agentops.stop_instrumenting()`+properly include `instrument_llm_calls=False`.### Implement Callback Handlerdiff --git a/docs/v1/usage/multiple-sessions.mdx b/docs/v1/usage/multiple-sessions.mdxindex f84c18a6..964278ff 100644--- a/docs/v1/usage/multiple-sessions.mdx+++ b/docs/v1/usage/multiple-sessions.mdx@@ -9,8 +9,6 @@ In most development and scripting use cases, having only one session active at aBy default, AgentOps operates in single-session mode. All of the [base SDK functions](/v1/usage/sdk-reference) work as expected.-<Note>Under the hood, when you only have one session at a time, AgentOps can use functions like `agentops.add_tags(...)` and know that you want to perform the function on the one and only active session.</Note>-As soon as you create a second session, AgentOps enters **Multi-Session Mode**. As long as more than one session is active, the [base SDK functions](/v1/usage/sdk-reference) will no longer work.If multiple sessions exist, you are expected to call the function on the relevant session. Ex:@@ -63,14 +61,10 @@ Functions on `agentops` will no longer work in multi-session mode<CodeGroup>```python works ✅session.end_session(...)-session.add_tags(...)-session.set_tags(...)``````python does not work ❌agentops.end_session(...)-agentops.add_tags(...)-agentops.set_tags(...)```</CodeGroup>@@ -185,46 +179,16 @@ obs_response = observed_create()```-[//]: # (Alternatively, you can include the session object as a keyword parameter in the completion call.)--[//]: # ()-[//]: # (```python)--[//]: # (import agentops)--[//]: # (import openai)--[//]: # ()-[//]: # (session = agentops.start_session())--[//]: # (messages = [{"role": "user", "content": "Hello"}])--[//]: # (response = openai.chat.completions.create()--[//]: # ( model="gpt-3.5-turbo",)--[//]: # ( messages=messages,)--[//]: # ( temperature=0.5,)--[//]: # ( session=session)--[//]: # ())--[//]: # (```)--[//]: # ()-[//]: # (<Warning>Passing `session` as a keyword parameter is functional, but will likely show an Unexpected Argument warning.</Warning>)If you make an LLM completion call without one of these methods while you currently have more than one active session, a `MultiSessionException` will be raised.# Exceptions+### `MultiSessionException`-_"If multiple sessions exist, you must use session.function(). Example: session.add_tags(...) instead of agentops.add_tags(...)."_Receiving this exception means that you tried to perform a function on the SDK base, but at runtime had more than one active session.### `NoSessionException`-A [session](/v1/concepts/session) action was attempted while no session existed on the client.\ No newline at end of file+A [session](/v1/concepts/session) action was attempted while no session existed on the client.diff --git a/docs/v1/usage/sdk-reference.mdx b/docs/v1/usage/sdk-reference.mdxindex ae0690c3..0f6001db 100644--- a/docs/v1/usage/sdk-reference.mdx+++ b/docs/v1/usage/sdk-reference.mdx@@ -16,7 +16,6 @@ The first element of AgentOps is always calling .init()**Parameters**:- `api_key` (str, optional): API Key for AgentOps services. If not provided, the key will be read from the `AGENTOPS_API_KEY` environment variable.-- `parent_key` (str, optional): Organization key to give visibility of all user sessions within the user's organization. If not provided, the key will be read from the `AGENTOPS_PARENT_KEY` environment variable.- `endpoint` (str, optional): The endpoint for the AgentOps service. Defaults to 'https://api.agentops.ai'.- `max_wait_time` (int, optional): The maximum time to wait in milliseconds before flushing the queue. Defaults to 30,000 (30 seconds).- `max_queue_size` (int, optional): The maximum size of the event queue. Defaults to 100.@@ -40,7 +39,7 @@ Start a new [Session](/v1/concepts/sessions) for recording events.**Parameters**:- `tags` (List[str], optional): Tags for the session.-- `config` ([Configuration](#configuration), optional): Client configuration object.+- `config` ([Config](#config), optional): Client configuration object.- `inherited_session_id` (str, optional): Session ID to continue from an existing session.**Returns**:@@ -71,25 +70,6 @@ Record an event with the AgentOps service.----### `add_tags()`--Append to session tags at runtime.--**Parameters**:--- `tags` (List[str]): The list of tags to append.-------### `set_tags()`--Replace session tags at runtime.--**Parameters**:--- `tags` (List[str]): The list of tags to set.-----### `get_api_key()`@@ -101,37 +81,17 @@ Retrieve the API key used by the client.----### `set_parent_key()`--Set the parent API key which has visibility over projects it is a parent of.--**Parameters**:--- `parent_key` (str): The API key of the parent organization to set.-------### `stop_instrumenting()`--Stops instrumenting LLM calls. This is typically used by agent frameworks (i.e., [CrewAI](/v1/integrations/crewai) and-[AG2](/v1/integrations/autogen)) to stop using AgentOps' auto-instrumentation of LLM libraries such as OpenAI. This-allows these frameworks to use their own instrumenting or callback handler.----## Types----### `Configuration`+### `Config`Stores the configuration settings for AgentOps clients.**Parameters**:- `api_key` (str, optional): API Key for AgentOps services. If not provided, the key will be read from the `AGENTOPS_API_KEY` environment variable. If no key is found, a `ConfigurationError` is raised.-- `parent_key` (str, optional): Organization key to give visibility of all user sessions within the user's organization. If not provided, the key will be read from the `AGENTOPS_PARENT_KEY` environment variable.- `endpoint` (str, optional): The endpoint for the AgentOps service. If not provided, the endpoint will be read from the `AGENTOPS_API_ENDPOINT` environment variable. Defaults to 'https://api.agentops.ai'.- `max_wait_time` (int, optional): The maximum time to wait in milliseconds before flushing the queue. Defaults to 30000.- `max_queue_size` (int, optional): The maximum size of the event queue. Defaults to 100.@@ -142,7 +102,6 @@ Stores the configuration settings for AgentOps clients.- **endpoint** (str): Get or set the endpoint for the AgentOps service.- **max_wait_time** (int): Get or set the maximum wait time in milliseconds before flushing the queue.- **max_queue_size** (int): Get or set the maximum size of the event queue.-- **parent_key** (str, optional): Get or set the organization key for session visibility.---diff --git a/docs/v1/usage/tracking-llm-calls.mdx b/docs/v1/usage/tracking-llm-calls.mdxindex 0ab4d03d..51a660c2 100644--- a/docs/v1/usage/tracking-llm-calls.mdx+++ b/docs/v1/usage/tracking-llm-calls.mdx@@ -28,14 +28,6 @@ To get started, just follow the quick start guide.</Card></CardGroup>-### Stop Tracking LLM Calls--To stop tracking LLM calls after running `agentops.init()`, you can call `agentops.stop_instrumenting()`.--This function reverts the changes made to your LLM provider's module, removing AgentOps instrumentation.--_Special consideration for Cohere: Calling `stop_instrumenting()` has no effect on previously instantiated Cohere clients. You must create a new Cohere client after calling this function._-<script type="module" src="/scripts/github_stars.js"></script><script type="module" src="/scripts/scroll-img-fadein-animation.js"></script><script type="module" src="/scripts/button_heartbeat_animation.js"></script>diff --git a/docs/v2/integrations/langchain.mdx b/docs/v2/integrations/langchain.mdxindex e9ea799a..57d10816 100644--- a/docs/v2/integrations/langchain.mdx+++ b/docs/v2/integrations/langchain.mdx@@ -65,7 +65,7 @@ import EnvTooltip from '/snippets/add-env-tooltip.mdx'AGENTOPS_API_KEY=<YOUR API KEY>```</CodeGroup>- Read more about environment variables in [Advanced Configuration](/v1/usage/advanced-configuration)+ Read more about environment variables in [Advanced Configuration](/v2/usage/advanced-configuration)</Step><Step title="Run your agent">Execute your program and visit [app.agentops.ai/traces](https://app.agentops.ai/traces) to observe your LangChain Agent! 🕵️diff --git a/docs/v2/introduction.mdx b/docs/v2/introduction.mdxindex 833e66cf..f12ba7b8 100644--- a/docs/v2/introduction.mdx+++ b/docs/v2/introduction.mdx@@ -20,7 +20,7 @@ mode: "wide"<Card title="OpenAI Agents SDK" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/openai/openai-logomark.png?raw=true" alt="OpenAI Agents SDK" />} iconType="image" href="/v2/integrations/agentssdk" /><Card title="CrewAI" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/crew/crew.png?raw=true" alt="CrewAI" />} iconType="image" href="/v2/integrations/crewai" /><Card title="AG2" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/autogen/ag2.svg?raw=true" alt="Autogen"/>} iconType="image" href="/v2/integrations/ag2" />- <Card title="AutoGen" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/microsoft/microsoft_logo.svg?raw=true" alt="AutoGen" />} iconType="image" href="/v1/integrations/autogen" />+ <Card title="AutoGen" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/microsoft/microsoft_logo.svg?raw=true" alt="AutoGen" />} iconType="image" href="/v2/integrations/autogen" /><Card title="OpenAI" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/openai/openai-logomark.png?raw=true" alt="OpenAI" />} iconType="image" href="/v2/integrations/openai" /><Card title="Anthropic" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/anthropic/anthropic_icon_slate.png?raw=true" alt="Anthropic" />} iconType="image" href="/v2/integrations/anthropic" /><Card title="LangChain" icon={<img src="https://www.github.com/agentops-ai/agentops/blob/main/docs/images/external/langchain/langchain-logo.svg?raw=true" alt="LangChain" />} iconType="image" href="/v2/integrations/langchain" />diff --git a/docs/v2/usage/advanced-configuration.mdx b/docs/v2/usage/advanced-configuration.mdxindex 4b3d9010..393b57e1 100644--- a/docs/v2/usage/advanced-configuration.mdx+++ b/docs/v2/usage/advanced-configuration.mdx@@ -18,8 +18,6 @@ Find your AgentOps API Key in your Settings > [Projects & API Keys](https://app.#### Optional settings:```python .env-# Secondary API Key for simultaneously recording to a second project-AGENTOPS_PARENT_KEY=<YOUR PARENT KEY># The AgentOps API endpoint. Defaults to https://api.agentops.aiAGENTOPS_API_ENDPOINT=https://api.agentops.ai# Logging level. <DEBUG, INFO, CRITICAL>. Defaults to INFO