Configure settings from kwargs, validating where necessary
(
self,
api_key: Optional[str] = None,
endpoint: Optional[str] = None,
app_url: Optional[str] = None,
max_wait_time: Optional[int] = None,
export_flush_interval: Optional[int] = None,
max_queue_size: Optional[int] = 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,
prefetch_jwt_token: Optional[bool] = None,
log_session_replay_url: Optional[bool] = None,
exporter: Optional[SpanExporter] = None,
processor: Optional[SpanProcessor] = None,
exporter_endpoint: Optional[str] = None,
)
| 136 | ) |
| 137 | |
| 138 | def configure( |
| 139 | self, |
| 140 | api_key: Optional[str] = None, |
| 141 | endpoint: Optional[str] = None, |
| 142 | app_url: Optional[str] = None, |
| 143 | max_wait_time: Optional[int] = None, |
| 144 | export_flush_interval: Optional[int] = None, |
| 145 | max_queue_size: Optional[int] = None, |
| 146 | default_tags: Optional[List[str]] = None, |
| 147 | trace_name: Optional[str] = None, |
| 148 | instrument_llm_calls: Optional[bool] = None, |
| 149 | auto_start_session: Optional[bool] = None, |
| 150 | auto_init: Optional[bool] = None, |
| 151 | skip_auto_end_session: Optional[bool] = None, |
| 152 | env_data_opt_out: Optional[bool] = None, |
| 153 | log_level: Optional[Union[str, int]] = None, |
| 154 | fail_safe: Optional[bool] = None, |
| 155 | prefetch_jwt_token: Optional[bool] = None, |
| 156 | log_session_replay_url: Optional[bool] = None, |
| 157 | exporter: Optional[SpanExporter] = None, |
| 158 | processor: Optional[SpanProcessor] = None, |
| 159 | exporter_endpoint: Optional[str] = None, |
| 160 | ): |
| 161 | """Configure settings from kwargs, validating where necessary""" |
| 162 | if api_key is not None: |
| 163 | self.api_key = api_key |
| 164 | if not TESTING: # Allow setting dummy keys in tests |
| 165 | try: |
| 166 | UUID(api_key) |
| 167 | except ValueError: |
| 168 | # Log warning but don't throw exception - let async auth handle it |
| 169 | from agentops.logging import logger |
| 170 | |
| 171 | logger.warning( |
| 172 | f"API key format appears invalid: {api_key[:8]}... " |
| 173 | f"Authentication may fail. Find your API key at {self.endpoint}/settings/projects" |
| 174 | ) |
| 175 | # Continue with the invalid key - async auth will handle the failure gracefully |
| 176 | |
| 177 | if endpoint is not None: |
| 178 | self.endpoint = endpoint |
| 179 | |
| 180 | if app_url is not None: |
| 181 | self.app_url = app_url |
| 182 | |
| 183 | if max_wait_time is not None: |
| 184 | self.max_wait_time = max_wait_time |
| 185 | |
| 186 | if export_flush_interval is not None: |
| 187 | self.export_flush_interval = export_flush_interval |
| 188 | |
| 189 | if max_queue_size is not None: |
| 190 | self.max_queue_size = max_queue_size |
| 191 | |
| 192 | if default_tags is not None: |
| 193 | self.default_tags = set(default_tags) |
| 194 | |
| 195 | if trace_name is not None: |
no outgoing calls