agenta 0.27.0a0__tar.gz → 0.27.0a1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of agenta might be problematic. Click here for more details.

Files changed (186) hide show
  1. {agenta-0.27.0a0 → agenta-0.27.0a1}/PKG-INFO +1 -1
  2. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/__init__.py +1 -0
  3. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/__init__.py +1 -0
  4. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/agenta_init.py +7 -6
  5. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/decorators/routing.py +36 -31
  6. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/decorators/tracing.py +6 -0
  7. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/tracing/attributes.py +0 -45
  8. agenta-0.27.0a1/agenta/sdk/tracing/conventions.py +47 -0
  9. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/tracing/exporters.py +3 -0
  10. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/tracing/inline.py +23 -49
  11. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/tracing/processors.py +13 -2
  12. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/tracing/tracing.py +79 -24
  13. agenta-0.27.0a1/agenta/sdk/utils/exceptions.py +22 -0
  14. {agenta-0.27.0a0 → agenta-0.27.0a1}/pyproject.toml +1 -1
  15. agenta-0.27.0a0/agenta/sdk/tracing/conventions.py +0 -43
  16. agenta-0.27.0a0/agenta/sdk/utils/exceptions.py +0 -19
  17. {agenta-0.27.0a0 → agenta-0.27.0a1}/README.md +0 -0
  18. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/cli/evaluation_commands.py +0 -0
  19. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/cli/helper.py +0 -0
  20. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/cli/main.py +0 -0
  21. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/cli/telemetry.py +0 -0
  22. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/cli/variant_commands.py +0 -0
  23. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/cli/variant_configs.py +0 -0
  24. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/Readme.md +0 -0
  25. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/__init__.py +0 -0
  26. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/api.py +0 -0
  27. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/api_models.py +0 -0
  28. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/__init__.py +0 -0
  29. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/apps/__init__.py +0 -0
  30. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/apps/client.py +0 -0
  31. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/bases/__init__.py +0 -0
  32. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/bases/client.py +0 -0
  33. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/client.py +0 -0
  34. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/configs/__init__.py +0 -0
  35. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/configs/client.py +0 -0
  36. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/containers/__init__.py +0 -0
  37. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/containers/client.py +0 -0
  38. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/containers/types/__init__.py +0 -0
  39. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/containers/types/container_templates_response.py +0 -0
  40. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/__init__.py +0 -0
  41. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/api_error.py +0 -0
  42. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/client_wrapper.py +0 -0
  43. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/datetime_utils.py +0 -0
  44. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/file.py +0 -0
  45. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/http_client.py +0 -0
  46. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/jsonable_encoder.py +0 -0
  47. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/pydantic_utilities.py +0 -0
  48. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/query_encoder.py +0 -0
  49. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/remove_none_from_dict.py +0 -0
  50. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/request_options.py +0 -0
  51. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/core/serialization.py +0 -0
  52. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/environments/__init__.py +0 -0
  53. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/environments/client.py +0 -0
  54. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/errors/__init__.py +0 -0
  55. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/errors/unprocessable_entity_error.py +0 -0
  56. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/evaluations/__init__.py +0 -0
  57. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/evaluations/client.py +0 -0
  58. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/evaluators/__init__.py +0 -0
  59. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/evaluators/client.py +0 -0
  60. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/observability/__init__.py +0 -0
  61. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/observability/client.py +0 -0
  62. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/testsets/__init__.py +0 -0
  63. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/testsets/client.py +0 -0
  64. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/__init__.py +0 -0
  65. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/aggregated_result.py +0 -0
  66. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/aggregated_result_evaluator_config.py +0 -0
  67. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/app.py +0 -0
  68. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/app_variant_response.py +0 -0
  69. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/app_variant_revision.py +0 -0
  70. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/base_output.py +0 -0
  71. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/body_import_testset.py +0 -0
  72. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/config_db.py +0 -0
  73. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/correct_answer.py +0 -0
  74. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/create_app_output.py +0 -0
  75. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/create_span.py +0 -0
  76. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/create_trace_response.py +0 -0
  77. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/docker_env_vars.py +0 -0
  78. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/environment_output.py +0 -0
  79. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/environment_output_extended.py +0 -0
  80. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/environment_revision.py +0 -0
  81. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/error.py +0 -0
  82. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluation.py +0 -0
  83. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluation_scenario.py +0 -0
  84. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluation_scenario_input.py +0 -0
  85. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluation_scenario_output.py +0 -0
  86. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluation_scenario_result.py +0 -0
  87. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluation_scenario_score_update.py +0 -0
  88. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluation_status_enum.py +0 -0
  89. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluation_type.py +0 -0
  90. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluator.py +0 -0
  91. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/evaluator_config.py +0 -0
  92. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/get_config_response.py +0 -0
  93. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/http_validation_error.py +0 -0
  94. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/human_evaluation.py +0 -0
  95. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/human_evaluation_scenario.py +0 -0
  96. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/human_evaluation_scenario_input.py +0 -0
  97. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/human_evaluation_scenario_output.py +0 -0
  98. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/human_evaluation_scenario_update.py +0 -0
  99. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/human_evaluation_update.py +0 -0
  100. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/image.py +0 -0
  101. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/invite_request.py +0 -0
  102. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/list_api_keys_response.py +0 -0
  103. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/llm_run_rate_limit.py +0 -0
  104. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/llm_tokens.py +0 -0
  105. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/lm_providers_enum.py +0 -0
  106. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/new_human_evaluation.py +0 -0
  107. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/new_testset.py +0 -0
  108. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/organization.py +0 -0
  109. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/organization_output.py +0 -0
  110. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/outputs.py +0 -0
  111. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/permission.py +0 -0
  112. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/result.py +0 -0
  113. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/score.py +0 -0
  114. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/simple_evaluation_output.py +0 -0
  115. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/span.py +0 -0
  116. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/span_detail.py +0 -0
  117. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/span_status_code.py +0 -0
  118. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/span_variant.py +0 -0
  119. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/template.py +0 -0
  120. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/template_image_info.py +0 -0
  121. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/test_set_output_response.py +0 -0
  122. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/test_set_simple_response.py +0 -0
  123. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/trace_detail.py +0 -0
  124. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/update_app_output.py +0 -0
  125. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/uri.py +0 -0
  126. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/validation_error.py +0 -0
  127. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/validation_error_loc_item.py +0 -0
  128. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/variant_action.py +0 -0
  129. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/variant_action_enum.py +0 -0
  130. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/with_pagination.py +0 -0
  131. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/workspace_member_response.py +0 -0
  132. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/workspace_permission.py +0 -0
  133. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/workspace_response.py +0 -0
  134. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/workspace_role.py +0 -0
  135. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/types/workspace_role_response.py +0 -0
  136. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/variants/__init__.py +0 -0
  137. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/variants/client.py +0 -0
  138. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/variants/types/__init__.py +0 -0
  139. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +0 -0
  140. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/client.py +0 -0
  141. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/client/exceptions.py +0 -0
  142. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/config.py +0 -0
  143. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/config.toml +0 -0
  144. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/docker/docker-assets/Dockerfile.cloud.template +0 -0
  145. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/docker/docker-assets/Dockerfile.template +0 -0
  146. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/docker/docker-assets/README.md +0 -0
  147. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/docker/docker-assets/entrypoint.sh +0 -0
  148. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/docker/docker-assets/lambda_function.py +0 -0
  149. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/docker/docker-assets/main.py +0 -0
  150. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/docker/docker_utils.py +0 -0
  151. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/assets.py +0 -0
  152. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/client.py +0 -0
  153. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/config_manager.py +0 -0
  154. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/context/__init__.py +0 -0
  155. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/context/routing.py +0 -0
  156. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/context/tracing.py +0 -0
  157. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/decorators/__init__.py +0 -0
  158. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/litellm/__init__.py +0 -0
  159. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/litellm/litellm.py +0 -0
  160. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/router.py +0 -0
  161. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/tracing/__init__.py +0 -0
  162. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/tracing/context.py +0 -0
  163. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/tracing/spans.py +0 -0
  164. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/types.py +0 -0
  165. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/utils/__init__.py +0 -0
  166. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/utils/costs.py +0 -0
  167. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/utils/debug.py +0 -0
  168. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/utils/globals.py +0 -0
  169. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/utils/logging.py +0 -0
  170. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/utils/preinit.py +0 -0
  171. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/sdk/utils/singleton.py +0 -0
  172. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/compose_email/README.md +0 -0
  173. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/compose_email/app.py +0 -0
  174. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/compose_email/env.example +0 -0
  175. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/compose_email/requirements.txt +0 -0
  176. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/compose_email/template.toml +0 -0
  177. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/extract_data_to_json/README.md +0 -0
  178. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/extract_data_to_json/app.py +0 -0
  179. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/extract_data_to_json/env.example +0 -0
  180. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/extract_data_to_json/requirements.txt +0 -0
  181. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/extract_data_to_json/template.toml +0 -0
  182. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/simple_prompt/README.md +0 -0
  183. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/simple_prompt/app.py +0 -0
  184. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/simple_prompt/env.example +0 -0
  185. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/simple_prompt/requirements.txt +0 -0
  186. {agenta-0.27.0a0 → agenta-0.27.0a1}/agenta/templates/simple_prompt/template.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: agenta
3
- Version: 0.27.0a0
3
+ Version: 0.27.0a1
4
4
  Summary: The SDK for agenta is an open-source LLMOps platform.
5
5
  Home-page: https://agenta.ai
6
6
  Keywords: LLMOps,LLM,evaluation,prompt engineering
@@ -16,6 +16,7 @@ from .sdk.types import (
16
16
  from .sdk.utils.logging import log as logging
17
17
  from .sdk.tracing import Tracing
18
18
  from .sdk.decorators.tracing import instrument
19
+ from .sdk.tracing.conventions import Reference
19
20
  from .sdk.decorators.routing import entrypoint, app, route
20
21
  from .sdk.agenta_init import Config, AgentaSingleton, init
21
22
  from .sdk.utils.costs import calculate_token_usage
@@ -17,6 +17,7 @@ from .types import (
17
17
 
18
18
  from .tracing import Tracing, get_tracer
19
19
  from .decorators.tracing import instrument
20
+ from .tracing.conventions import Reference
20
21
  from .decorators.routing import entrypoint, app, route
21
22
  from .agenta_init import Config, AgentaSingleton, init as _init
22
23
  from .utils.costs import calculate_token_usage
@@ -37,9 +37,9 @@ class AgentaSingleton:
37
37
  #
38
38
  app_id: Optional[str] = None,
39
39
  ) -> None:
40
- log.info(f"\n--------------------------------")
41
- log.info(f"Using Agenta Python SDK version: {version('agenta')}")
42
- log.info(f"--------------------------------\n")
40
+ log.info(f"---------------------------")
41
+ log.info(f"Agenta SDK - using version: {version('agenta')}")
42
+ log.info(f"---------------------------")
43
43
 
44
44
  """Main function to initialize the singleton.
45
45
 
@@ -126,9 +126,10 @@ class Config:
126
126
  self.base_id = base_id
127
127
 
128
128
  if self.base_id is None:
129
- print(
130
- "Warning: Your configuration will not be saved permanently since base_id is not provided.\n"
131
- )
129
+ # print(
130
+ # "Warning: Your configuration will not be saved permanently since base_id is not provided.\n"
131
+ # )
132
+ pass
132
133
 
133
134
  if base_id is None or host is None:
134
135
  self.persist = False
@@ -1,8 +1,3 @@
1
- """The code for the Agenta SDK"""
2
-
3
- import os
4
- import sys
5
- import time
6
1
  import json
7
2
  import inspect
8
3
  import argparse
@@ -12,7 +7,6 @@ import functools
12
7
  from pathlib import Path
13
8
  from tempfile import NamedTemporaryFile
14
9
  from typing import Any, Callable, Dict, Optional, Tuple, List
15
- from importlib.metadata import version
16
10
  from fastapi.middleware.cors import CORSMiddleware
17
11
  from fastapi import Body, FastAPI, UploadFile, HTTPException
18
12
 
@@ -44,8 +38,8 @@ from typing import Type
44
38
  from annotated_types import Ge, Le, Gt, Lt
45
39
 
46
40
  from pydantic import BaseModel, HttpUrl
47
- import contextvars
48
- from contextlib import contextmanager
41
+
42
+ from traceback import format_exc
49
43
 
50
44
 
51
45
  app = FastAPI()
@@ -369,11 +363,11 @@ class entrypoint:
369
363
  *args,
370
364
  **func_params,
371
365
  ):
372
- log.info(f"\n--------------------------")
366
+ log.info(f"---------------------------")
373
367
  log.info(
374
- f"Running application route: {repr(self.route_path if self.route_path != '' else '/')}"
368
+ f"Agenta SDK - running route: {repr(self.route_path if self.route_path != '' else '/')}"
375
369
  )
376
- log.info(f"--------------------------\n")
370
+ log.info(f"---------------------------")
377
371
 
378
372
  tracing_context.set(routing_context.get())
379
373
 
@@ -394,9 +388,11 @@ class entrypoint:
394
388
  )
395
389
  data = self.patch_result(result)
396
390
  except Exception as e:
397
- log.error(f"Agenta SDK - Routing Exception")
398
-
399
- traceback.print_exc()
391
+ log.error("--------------------------------------------------")
392
+ log.error("Agenta SDK - handling application exception below:")
393
+ log.error("--------------------------------------------------")
394
+ log.error(format_exc().strip("\n"))
395
+ log.error("--------------------------------------------------")
400
396
 
401
397
  self.handle_exception(e)
402
398
 
@@ -426,6 +422,10 @@ class entrypoint:
426
422
 
427
423
  response = BaseResponse(data=data, trace=trace)
428
424
 
425
+ log.info(f"----------------------------------")
426
+ log.info(f"Agenta SDK - exiting successfully: 200")
427
+ log.info(f"----------------------------------")
428
+
429
429
  return response
430
430
 
431
431
  def handle_exception(self, e: Exception):
@@ -434,6 +434,10 @@ class entrypoint:
434
434
  stacktrace = traceback.format_exception(e, value=e, tb=e.__traceback__) # type: ignore
435
435
  detail = {"message": message, "stacktrace": stacktrace}
436
436
 
437
+ log.error(f"----------------------------------------")
438
+ log.error(f"Agenta SDK - exiting with HTTPException: {status_code}")
439
+ log.error(f"----------------------------------------")
440
+
437
441
  raise HTTPException(
438
442
  status_code=status_code,
439
443
  detail=detail,
@@ -658,27 +662,28 @@ class entrypoint:
658
662
  SHOW_DATA = False
659
663
  SHOW_TRACE = False
660
664
 
661
- log.info("\n========= Result =========\n")
665
+ if result.trace:
666
+ log.info("\n========= Result =========\n")
662
667
 
663
- log.info(f"trace_id: {result.trace['trace_id']}")
664
- if SHOW_DETAILS:
665
- log.info(f"latency: {result.trace.get('latency')}")
666
- log.info(f"cost: {result.trace.get('cost')}")
667
- log.info(f"usage: {list(result.trace.get('usage', {}).values())}")
668
+ log.info(f"trace_id: {result.trace['trace_id']}")
669
+ if SHOW_DETAILS:
670
+ log.info(f"latency: {result.trace.get('latency')}")
671
+ log.info(f"cost: {result.trace.get('cost')}")
672
+ log.info(f"usage: {list(result.trace.get('usage', {}).values())}")
668
673
 
669
- if SHOW_DATA:
670
- log.info(" ")
671
- log.info(f"data:")
672
- log.info(json.dumps(result.data, indent=2))
674
+ if SHOW_DATA:
675
+ log.info(" ")
676
+ log.info(f"data:")
677
+ log.info(json.dumps(result.data, indent=2))
673
678
 
674
- if SHOW_TRACE:
675
- log.info(" ")
676
- log.info(f"trace:")
677
- log.info(f"----------------")
678
- log.info(json.dumps(result.trace.get("spans", []), indent=2))
679
- log.info(f"----------------")
679
+ if SHOW_TRACE:
680
+ log.info(" ")
681
+ log.info(f"trace:")
682
+ log.info(f"----------------")
683
+ log.info(json.dumps(result.trace.get("spans", []), indent=2))
684
+ log.info(f"----------------")
680
685
 
681
- log.info("\n==========================\n")
686
+ log.info("\n==========================\n")
682
687
 
683
688
  def override_config_in_schema(
684
689
  self,
@@ -147,6 +147,9 @@ class instrument:
147
147
  cost = result.get("cost", None)
148
148
  usage = result.get("usage", {})
149
149
 
150
+ if isinstance(usage, (int, float)):
151
+ usage = {"total_tokens": usage}
152
+
150
153
  span.set_attributes(
151
154
  attributes={"total": cost},
152
155
  namespace="metrics.unit.costs",
@@ -240,6 +243,9 @@ class instrument:
240
243
  cost = result.get("cost", None)
241
244
  usage = result.get("usage", {})
242
245
 
246
+ if isinstance(usage, (int, float)):
247
+ usage = {"total_tokens": usage}
248
+
243
249
  span.set_attributes(
244
250
  attributes={"total": cost},
245
251
  namespace="metrics.unit.costs",
@@ -134,48 +134,3 @@ def serialize(
134
134
  }
135
135
 
136
136
  return _attributes
137
-
138
-
139
- """
140
- def _decode_key(namespace: Optional[str] = None, key: str = "") -> str:
141
- if namespace is None:
142
- return key
143
-
144
- return key.replace(f"ag.{namespace}.", "")
145
- """
146
-
147
- """
148
- def _decode_value(value: Attribute) -> Any:
149
- if isinstance(value, (int, float, bool, bytes)):
150
- return value
151
-
152
- if isinstance(value, str):
153
- if value == "@ag.type=none:":
154
- return None
155
-
156
- if value.startswith("@ag.type=json:"):
157
- encoded = value[len("@ag.type=json:") :]
158
- value = loads(encoded)
159
- return value
160
-
161
- return value
162
-
163
- return value
164
- """
165
-
166
- """
167
- def deserialize(
168
- *,
169
- namespace: str,
170
- attributes: Dict[str, Any],
171
- max_depth: Optional[int] = None,
172
- ) -> Dict[str, Any]:
173
- if not isinstance(attributes, dict):
174
- return {}
175
-
176
- return {
177
- _decode_key(namespace, key): _decode_value(value)
178
- for key, value in attributes
179
- if key != _decode_key(namespace, key)
180
- }
181
- """
@@ -0,0 +1,47 @@
1
+ from opentelemetry.trace import SpanKind
2
+
3
+ from enum import Enum
4
+
5
+ from re import fullmatch
6
+
7
+ _PATTERN = r"[A-Za-z0-9._-]+"
8
+
9
+
10
+ def is_valid_attribute_key(string):
11
+ return bool(fullmatch(_PATTERN, string))
12
+
13
+
14
+ class Reference(str, Enum):
15
+ #
16
+ VARIANT_ID = "variant.id"
17
+ VARIANT_SLUG = "variant.slug"
18
+ VARIANT_VERSION = "variant.version"
19
+ #
20
+ ENVIRONMENT_ID = "environment.id"
21
+ ENVIRONMENT_SLUG = "environment.slug"
22
+ ENVIRONMENT_VERSION = "environment.version"
23
+ #
24
+ APPLICATION_ID = "application.id"
25
+ APPLICATION_SLUG = "application.slug"
26
+ #
27
+
28
+
29
+ def parse_span_kind(type: str) -> SpanKind:
30
+ kind = SpanKind.INTERNAL
31
+ if type in [
32
+ "agent",
33
+ "chain",
34
+ "workflow",
35
+ ]:
36
+ kind = SpanKind.SERVER
37
+ elif type in [
38
+ "tool",
39
+ "embedding",
40
+ "query",
41
+ "completion",
42
+ "chat",
43
+ "rerank",
44
+ ]:
45
+ kind = SpanKind.CLIENT
46
+
47
+ return kind
@@ -48,6 +48,9 @@ class InlineTraceExporter(SpanExporter):
48
48
  return trace
49
49
 
50
50
 
51
+ OTLPSpanExporter._MAX_RETRY_TIMEOUT = 2
52
+
53
+
51
54
  ConsoleExporter = ConsoleSpanExporter
52
55
  InlineExporter = InlineTraceExporter
53
56
  OTLPExporter = OTLPSpanExporter
@@ -131,14 +131,6 @@ AttributeValueType = Any
131
131
  Attributes = Dict[str, AttributeValueType]
132
132
 
133
133
 
134
- class AttributesDTO(DisplayBase):
135
- data: Optional[Attributes] = None
136
- metrics: Optional[Attributes] = None
137
- meta: Optional[Attributes] = None
138
- tags: Optional[Attributes] = None
139
- semconv: Optional[Attributes] = None
140
-
141
-
142
134
  class TreeType(Enum):
143
135
  # --- VARIANTS --- #
144
136
  INVOCATION = "invocation"
@@ -242,7 +234,7 @@ class OTelExtraDTO(DisplayBase):
242
234
  class SpanDTO(DisplayBase):
243
235
  scope: ProjectScopeDTO
244
236
 
245
- lifecycle: LifecycleDTO
237
+ lifecycle: Optional[LifecycleDTO] = None
246
238
 
247
239
  root: RootDTO
248
240
  tree: TreeDTO
@@ -266,29 +258,6 @@ class SpanDTO(DisplayBase):
266
258
  nodes: Optional[Dict[str, Union["SpanDTO", List["SpanDTO"]]]] = None
267
259
 
268
260
 
269
- class SpanCreateDTO(DisplayBase):
270
- scope: ProjectScopeDTO
271
-
272
- root: RootDTO
273
- tree: TreeDTO
274
- node: NodeDTO
275
-
276
- parent: Optional[ParentDTO] = None
277
-
278
- time: TimeDTO
279
- status: StatusDTO
280
-
281
- data: Optional[Data] = None
282
- metrics: Optional[Metrics] = None
283
- meta: Optional[Metadata] = None
284
- tags: Optional[Tags] = None
285
- refs: Optional[Refs] = None
286
-
287
- links: Optional[List[LinkDTO]] = None
288
-
289
- otel: Optional[OTelExtraDTO] = None
290
-
291
-
292
261
  class OTelSpanDTO(DisplayBase):
293
262
  context: OTelContextDTO
294
263
 
@@ -321,20 +290,20 @@ from typing import List, Dict, OrderedDict
321
290
 
322
291
 
323
292
  def parse_span_dtos_to_span_idx(
324
- span_dtos: List[SpanCreateDTO],
325
- ) -> Dict[str, SpanCreateDTO]:
293
+ span_dtos: List[SpanDTO],
294
+ ) -> Dict[str, SpanDTO]:
326
295
  span_idx = {span_dto.node.id: span_dto for span_dto in span_dtos}
327
296
 
328
297
  return span_idx
329
298
 
330
299
 
331
300
  def parse_span_idx_to_span_id_tree(
332
- span_idx: Dict[str, SpanCreateDTO],
301
+ span_idx: Dict[str, SpanDTO],
333
302
  ) -> OrderedDict:
334
303
  span_id_tree = OrderedDict()
335
304
  index = {}
336
305
 
337
- def push(span_dto: SpanCreateDTO) -> None:
306
+ def push(span_dto: SpanDTO) -> None:
338
307
  if span_dto.parent is None:
339
308
  span_id_tree[span_dto.node.id] = OrderedDict()
340
309
  index[span_dto.node.id] = span_id_tree[span_dto.node.id]
@@ -350,15 +319,15 @@ def parse_span_idx_to_span_id_tree(
350
319
 
351
320
  def cumulate_costs(
352
321
  spans_id_tree: OrderedDict,
353
- spans_idx: Dict[str, SpanCreateDTO],
322
+ spans_idx: Dict[str, SpanDTO],
354
323
  ) -> None:
355
- def _get_unit(span: SpanCreateDTO):
324
+ def _get_unit(span: SpanDTO):
356
325
  if span.metrics is not None:
357
326
  return span.metrics.get("unit.costs.total", 0.0)
358
327
 
359
328
  return 0.0
360
329
 
361
- def _get_acc(span: SpanCreateDTO):
330
+ def _get_acc(span: SpanDTO):
362
331
  if span.metrics is not None:
363
332
  return span.metrics.get("acc.costs.total", 0.0)
364
333
 
@@ -367,7 +336,7 @@ def cumulate_costs(
367
336
  def _acc(a: float, b: float):
368
337
  return a + b
369
338
 
370
- def _set(span: SpanCreateDTO, cost: float):
339
+ def _set(span: SpanDTO, cost: float):
371
340
  if span.metrics is None:
372
341
  span.metrics = {}
373
342
 
@@ -381,7 +350,7 @@ def cumulate_tokens(
381
350
  spans_id_tree: OrderedDict,
382
351
  spans_idx: Dict[str, dict],
383
352
  ) -> None:
384
- def _get_unit(span: SpanCreateDTO):
353
+ def _get_unit(span: SpanDTO):
385
354
  _tokens = {
386
355
  "prompt": 0.0,
387
356
  "completion": 0.0,
@@ -397,7 +366,7 @@ def cumulate_tokens(
397
366
 
398
367
  return _tokens
399
368
 
400
- def _get_acc(span: SpanCreateDTO):
369
+ def _get_acc(span: SpanDTO):
401
370
  _tokens = {
402
371
  "prompt": 0.0,
403
372
  "completion": 0.0,
@@ -420,7 +389,7 @@ def cumulate_tokens(
420
389
  "total": a.get("total", 0.0) + b.get("total", 0.0),
421
390
  }
422
391
 
423
- def _set(span: SpanCreateDTO, tokens: dict):
392
+ def _set(span: SpanDTO, tokens: dict):
424
393
  if span.metrics is None:
425
394
  span.metrics = {}
426
395
 
@@ -442,7 +411,7 @@ def cumulate_tokens(
442
411
 
443
412
  def _cumulate_tree_dfs(
444
413
  spans_id_tree: OrderedDict,
445
- spans_idx: Dict[str, SpanCreateDTO],
414
+ spans_idx: Dict[str, SpanDTO],
446
415
  get_unit_metric,
447
416
  get_acc_metric,
448
417
  accumulate_metric,
@@ -1032,7 +1001,7 @@ def parse_inline_trace(
1032
1001
  ###############################################
1033
1002
  ### services.observability.service.ingest() ###
1034
1003
  ### --------------------------------------- ###
1035
- calculate_cost(span_idx)
1004
+ calculate_costs(span_idx)
1036
1005
  cumulate_costs(span_id_tree, span_idx)
1037
1006
  cumulate_tokens(span_id_tree, span_idx)
1038
1007
  ### --------------------------------------- ###
@@ -1254,7 +1223,7 @@ def _parse_to_legacy_span(span: SpanDTO) -> CreateSpan:
1254
1223
  ),
1255
1224
  #
1256
1225
  app_id=(
1257
- span.refs.get("application_id", "missing-app-id")
1226
+ span.refs.get("application.id", "missing-app-id")
1258
1227
  if span.refs
1259
1228
  else "missing-app-id"
1260
1229
  ),
@@ -1271,7 +1240,7 @@ def _parse_to_legacy_span(span: SpanDTO) -> CreateSpan:
1271
1240
  return legacy_span
1272
1241
 
1273
1242
 
1274
- PAYING_TYPES = [
1243
+ TYPES_WITH_COSTS = [
1275
1244
  "embedding",
1276
1245
  "query",
1277
1246
  "completion",
@@ -1280,9 +1249,14 @@ PAYING_TYPES = [
1280
1249
  ]
1281
1250
 
1282
1251
 
1283
- def calculate_cost(span_idx: Dict[str, SpanCreateDTO]):
1252
+ def calculate_costs(span_idx: Dict[str, SpanDTO]):
1284
1253
  for span in span_idx.values():
1285
- if span.node.type.name.lower() in PAYING_TYPES and span.meta and span.metrics:
1254
+ if (
1255
+ span.node.type
1256
+ and span.node.type.name.lower() in TYPES_WITH_COSTS
1257
+ and span.meta
1258
+ and span.metrics
1259
+ ):
1286
1260
  try:
1287
1261
  costs = cost_calculator.cost_per_token(
1288
1262
  model=span.meta.get("response.model"),
@@ -1,4 +1,5 @@
1
- from typing import Optional, Any, Dict
1
+ from typing import Optional, Dict
2
+ from traceback import format_exc
2
3
 
3
4
  from opentelemetry.context import Context
4
5
  from opentelemetry.sdk.trace import Span
@@ -10,6 +11,8 @@ from opentelemetry.sdk.trace.export import (
10
11
  _DEFAULT_MAX_QUEUE_SIZE,
11
12
  )
12
13
 
14
+ from agenta.sdk.utils.logging import log
15
+
13
16
  # LOAD CONTEXT, HERE
14
17
 
15
18
 
@@ -28,7 +31,7 @@ class TraceProcessor(BatchSpanProcessor):
28
31
  _DEFAULT_MAX_QUEUE_SIZE,
29
32
  60 * 60 * 1000, # 1 hour
30
33
  _DEFAULT_MAX_QUEUE_SIZE,
31
- _DEFAULT_EXPORT_TIMEOUT_MILLIS,
34
+ 500, # < 1 second (0.5 seconds)
32
35
  )
33
36
 
34
37
  self._registry = dict()
@@ -54,6 +57,14 @@ class TraceProcessor(BatchSpanProcessor):
54
57
  if self.is_ready(span.get_span_context().trace_id):
55
58
  self.force_flush()
56
59
 
60
+ def force_flush(self, timeout_millis: int = None) -> bool:
61
+ ret = super().force_flush(timeout_millis)
62
+
63
+ if not ret:
64
+ log.error("--------------------------------------------")
65
+ log.error("Agenta SDK - skipping export due to timeout.")
66
+ log.error("--------------------------------------------")
67
+
57
68
  def is_ready(self, trace_id: Optional[int] = None) -> bool:
58
69
  is_ready = not len(self._registry.get(trace_id, {}))
59
70
 
@@ -1,4 +1,5 @@
1
1
  from typing import Optional, Any, Dict
2
+ from enum import Enum
2
3
 
3
4
  from httpx import get as check
4
5
 
@@ -13,15 +14,16 @@ from opentelemetry.sdk.trace import Span, Tracer, TracerProvider
13
14
  from opentelemetry.sdk.resources import Resource
14
15
 
15
16
  from agenta.sdk.utils.singleton import Singleton
16
- from agenta.sdk.utils.exceptions import suppress # USE IT !
17
+ from agenta.sdk.utils.exceptions import suppress
17
18
  from agenta.sdk.utils.logging import log
18
19
 
19
20
  from agenta.sdk.tracing.processors import TraceProcessor
20
21
  from agenta.sdk.tracing.exporters import ConsoleExporter, InlineExporter, OTLPExporter
21
22
  from agenta.sdk.tracing.spans import CustomSpan
22
- from agenta.sdk.tracing.context import tracing_context
23
23
  from agenta.sdk.tracing.inline import parse_inline_trace
24
24
 
25
+ from agenta.sdk.tracing.conventions import Reference, is_valid_attribute_key
26
+
25
27
 
26
28
  class Tracing(metaclass=Singleton):
27
29
  VERSION = "0.1.0"
@@ -74,7 +76,7 @@ class Tracing(metaclass=Singleton):
74
76
  if api_key:
75
77
  self.headers.update(**{"Authorization": self.api_key})
76
78
  # REFERENCES
77
- self.references = {"application_id": app_id}
79
+ self.references = {"application.id": app_id}
78
80
 
79
81
  # TRACER PROVIDER
80
82
  self.tracer_provider = TracerProvider(
@@ -120,10 +122,13 @@ class Tracing(metaclass=Singleton):
120
122
  def get_current_span(
121
123
  self,
122
124
  ):
123
- _span = get_current_span()
125
+ _span = None
126
+
127
+ with suppress():
128
+ _span = get_current_span()
124
129
 
125
- if _span.is_recording():
126
- return CustomSpan(_span)
130
+ if _span.is_recording():
131
+ return CustomSpan(_span)
127
132
 
128
133
  return _span
129
134
 
@@ -132,39 +137,89 @@ class Tracing(metaclass=Singleton):
132
137
  attributes: Dict[str, Any],
133
138
  span: Optional[Span] = None,
134
139
  ):
135
- if span is None:
136
- span = self.get_current_span()
140
+ with suppress():
141
+ if span is None:
142
+ span = self.get_current_span()
143
+
144
+ span.set_attributes(attributes={"internals": attributes}, namespace="data")
145
+
146
+ def store_refs(
147
+ self,
148
+ refs: Dict[str, str],
149
+ span: Optional[Span] = None,
150
+ ):
151
+ with suppress():
152
+ if span is None:
153
+ span = self.get_current_span()
154
+
155
+ for key in refs.keys():
156
+ if key in Reference:
157
+ # ADD REFERENCE TO THIS SPAN
158
+ span.set_attribute(
159
+ key.value if isinstance(key, Enum) else key,
160
+ refs[key],
161
+ namespace="refs",
162
+ )
163
+ # AND TO ALL SPANS CREATED AFTER THIS ONE
164
+ self.references[key] = refs[key]
165
+ # TODO: THIS SHOULD BE REPLACED BY A TRACE CONTEXT !!!
166
+
167
+ def store_meta(
168
+ self,
169
+ meta: Dict[str, Any],
170
+ span: Optional[Span] = None,
171
+ ):
172
+ with suppress():
173
+ if span is None:
174
+ span = self.get_current_span()
175
+
176
+ for key in meta.keys():
177
+ if is_valid_attribute_key(key):
178
+ span.set_attribute(key, meta[key], namespace="meta")
137
179
 
138
- span.set_attributes(attributes={"internals": attributes}, namespace="data")
180
+ def store_metrics(
181
+ self,
182
+ metrics: Dict[str, Any],
183
+ span: Optional[Span] = None,
184
+ ):
185
+ with suppress():
186
+ if span is None:
187
+ span = self.get_current_span()
188
+
189
+ for key in metrics.keys():
190
+ if is_valid_attribute_key(key):
191
+ span.set_attribute(key, metrics[key], namespace="metrics")
139
192
 
140
193
  def is_inline_trace_ready(
141
194
  self,
142
- trace_id: int,
195
+ trace_id: Optional[int] = None,
143
196
  ) -> bool:
144
- is_ready = self.inline.is_ready(trace_id)
197
+ is_ready = True
198
+
199
+ with suppress():
200
+ if trace_id is not None:
201
+ is_ready = self.inline.is_ready(trace_id)
145
202
 
146
203
  return is_ready
147
204
 
148
205
  def get_inline_trace(
149
206
  self,
150
- trace_id: int,
207
+ trace_id: Optional[int] = None,
151
208
  ) -> Dict[str, Any]:
152
- if trace_id is None:
153
- return {}
154
-
155
- is_ready = self.inline.is_ready(trace_id)
156
-
157
- if is_ready is False:
158
- return {}
209
+ _inline_trace = {}
159
210
 
160
- otel_spans = self.inline.fetch(trace_id)
211
+ with suppress():
212
+ is_ready = self.inline.is_ready(trace_id)
161
213
 
162
- if not otel_spans:
163
- return {}
214
+ if is_ready is True:
215
+ otel_spans = self.inline.fetch(trace_id)
164
216
 
165
- inline_trace = parse_inline_trace(self.project_id or self.app_id, otel_spans)
217
+ if otel_spans:
218
+ _inline_trace = parse_inline_trace(
219
+ self.project_id or self.app_id, otel_spans
220
+ )
166
221
 
167
- return inline_trace
222
+ return _inline_trace
168
223
 
169
224
 
170
225
  def get_tracer(tracing: Tracing) -> Tracer: