Initializes the AgentOps SDK. Args: api_key (str, optional): API Key for AgentOps services. If none is provided, key will be read from the AGENTOPS_API_KEY environment variable. endpoint (str, optional): The endpoint for the AgentOps service. If none is provided
(
api_key: Optional[str] = None,
endpoint: Optional[str] = None,
app_url: Optional[str] = None,
max_wait_time: Optional[int] = None,
max_queue_size: Optional[int] = None,
tags: Optional[List[str]] = None,
default_tags: Optional[List[str]] = None,
trace_name: Optional[str] = None,
instrument_llm_calls: Optional[bool] = None,
auto_start_session: Optional[bool] = None,
auto_init: Optional[bool] = None,
skip_auto_end_session: Optional[bool] = None,
env_data_opt_out: Optional[bool] = None,
log_level: Optional[Union[str, int]] = None,
fail_safe: Optional[bool] = None,
log_session_replay_url: Optional[bool] = None,
exporter_endpoint: Optional[str] = None,
**kwargs,
)
| 75 | |
| 76 | |
| 77 | def init( |
| 78 | api_key: Optional[str] = None, |
| 79 | endpoint: Optional[str] = None, |
| 80 | app_url: Optional[str] = None, |
| 81 | max_wait_time: Optional[int] = None, |
| 82 | max_queue_size: Optional[int] = None, |
| 83 | tags: Optional[List[str]] = None, |
| 84 | default_tags: Optional[List[str]] = None, |
| 85 | trace_name: Optional[str] = None, |
| 86 | instrument_llm_calls: Optional[bool] = None, |
| 87 | auto_start_session: Optional[bool] = None, |
| 88 | auto_init: Optional[bool] = None, |
| 89 | skip_auto_end_session: Optional[bool] = None, |
| 90 | env_data_opt_out: Optional[bool] = None, |
| 91 | log_level: Optional[Union[str, int]] = None, |
| 92 | fail_safe: Optional[bool] = None, |
| 93 | log_session_replay_url: Optional[bool] = None, |
| 94 | exporter_endpoint: Optional[str] = None, |
| 95 | **kwargs, |
| 96 | ): |
| 97 | """ |
| 98 | Initializes the AgentOps SDK. |
| 99 | |
| 100 | Args: |
| 101 | api_key (str, optional): API Key for AgentOps services. If none is provided, key will |
| 102 | be read from the AGENTOPS_API_KEY environment variable. |
| 103 | endpoint (str, optional): The endpoint for the AgentOps service. If none is provided, key will |
| 104 | be read from the AGENTOPS_API_ENDPOINT environment variable. Defaults to 'https://api.agentops.ai'. |
| 105 | app_url (str, optional): The dashboard URL for the AgentOps app. If none is provided, key will |
| 106 | be read from the AGENTOPS_APP_URL environment variable. Defaults to 'https://app.agentops.ai'. |
| 107 | max_wait_time (int, optional): The maximum time to wait in milliseconds before flushing the queue. |
| 108 | Defaults to 5,000 (5 seconds) |
| 109 | max_queue_size (int, optional): The maximum size of the event queue. Defaults to 512. |
| 110 | tags (List[str], optional): [Deprecated] Use `default_tags` instead. |
| 111 | default_tags (List[str], optional): Default tags for the sessions that can be used for grouping or sorting later (e.g. ["GPT-4"]). |
| 112 | trace_name (str, optional): Name for the default trace/session. If none is provided, defaults to "default". |
| 113 | instrument_llm_calls (bool): Whether to instrument LLM calls and emit LLMEvents. |
| 114 | auto_start_session (bool): Whether to start a session automatically when the client is created. |
| 115 | auto_init (bool): Whether to automatically initialize the client on import. Defaults to True. |
| 116 | skip_auto_end_session (optional, bool): Don't automatically end session based on your framework's decision-making |
| 117 | (i.e. Crew determining when tasks are complete and ending the session) |
| 118 | env_data_opt_out (bool): Whether to opt out of collecting environment data. |
| 119 | log_level (str, int): The log level to use for the client. Defaults to 'CRITICAL'. |
| 120 | fail_safe (bool): Whether to suppress errors and continue execution when possible. |
| 121 | log_session_replay_url (bool): Whether to log session replay URLs to the console. Defaults to True. |
| 122 | exporter_endpoint (str, optional): Endpoint for the exporter. If none is provided, key will |
| 123 | be read from the AGENTOPS_EXPORTER_ENDPOINT environment variable. |
| 124 | **kwargs: Additional configuration parameters to be passed to the client. |
| 125 | """ |
| 126 | global _client |
| 127 | |
| 128 | # Check for deprecated parameters and emit warnings |
| 129 | if tags is not None: |
| 130 | warn_deprecated_param("tags", "default_tags") |
| 131 | |
| 132 | # Merge tags and default_tags if both are provided |
| 133 | merged_tags = None |
| 134 | if tags and default_tags: |
no test coverage detected
searching dependent graphs…