agenta 0.25.3a1__tar.gz → 0.25.4a1__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 (184) hide show
  1. {agenta-0.25.3a1 → agenta-0.25.4a1}/PKG-INFO +1 -1
  2. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/decorators/routing.py +4 -1
  3. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/decorators/tracing.py +7 -1
  4. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/tracing/inline.py +74 -35
  5. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/tracing/tracing.py +13 -10
  6. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/utils/exceptions.py +1 -0
  7. {agenta-0.25.3a1 → agenta-0.25.4a1}/pyproject.toml +1 -1
  8. {agenta-0.25.3a1 → agenta-0.25.4a1}/README.md +0 -0
  9. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/__init__.py +0 -0
  10. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/cli/evaluation_commands.py +0 -0
  11. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/cli/helper.py +0 -0
  12. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/cli/main.py +0 -0
  13. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/cli/telemetry.py +0 -0
  14. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/cli/variant_commands.py +0 -0
  15. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/cli/variant_configs.py +0 -0
  16. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/Readme.md +0 -0
  17. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/__init__.py +0 -0
  18. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/api.py +0 -0
  19. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/api_models.py +0 -0
  20. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/__init__.py +0 -0
  21. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/apps/__init__.py +0 -0
  22. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/apps/client.py +0 -0
  23. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/bases/__init__.py +0 -0
  24. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/bases/client.py +0 -0
  25. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/client.py +0 -0
  26. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/configs/__init__.py +0 -0
  27. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/configs/client.py +0 -0
  28. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/containers/__init__.py +0 -0
  29. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/containers/client.py +0 -0
  30. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/containers/types/__init__.py +0 -0
  31. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/containers/types/container_templates_response.py +0 -0
  32. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/__init__.py +0 -0
  33. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/api_error.py +0 -0
  34. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/client_wrapper.py +0 -0
  35. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/datetime_utils.py +0 -0
  36. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/file.py +0 -0
  37. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/http_client.py +0 -0
  38. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/jsonable_encoder.py +0 -0
  39. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/pydantic_utilities.py +0 -0
  40. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/query_encoder.py +0 -0
  41. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/remove_none_from_dict.py +0 -0
  42. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/request_options.py +0 -0
  43. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/core/serialization.py +0 -0
  44. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/environments/__init__.py +0 -0
  45. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/environments/client.py +0 -0
  46. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/errors/__init__.py +0 -0
  47. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/errors/unprocessable_entity_error.py +0 -0
  48. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/evaluations/__init__.py +0 -0
  49. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/evaluations/client.py +0 -0
  50. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/evaluators/__init__.py +0 -0
  51. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/evaluators/client.py +0 -0
  52. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/observability/__init__.py +0 -0
  53. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/observability/client.py +0 -0
  54. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/testsets/__init__.py +0 -0
  55. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/testsets/client.py +0 -0
  56. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/__init__.py +0 -0
  57. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/aggregated_result.py +0 -0
  58. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/aggregated_result_evaluator_config.py +0 -0
  59. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/app.py +0 -0
  60. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/app_variant_response.py +0 -0
  61. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/app_variant_revision.py +0 -0
  62. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/base_output.py +0 -0
  63. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/body_import_testset.py +0 -0
  64. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/config_db.py +0 -0
  65. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/correct_answer.py +0 -0
  66. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/create_app_output.py +0 -0
  67. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/create_span.py +0 -0
  68. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/create_trace_response.py +0 -0
  69. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/docker_env_vars.py +0 -0
  70. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/environment_output.py +0 -0
  71. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/environment_output_extended.py +0 -0
  72. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/environment_revision.py +0 -0
  73. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/error.py +0 -0
  74. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluation.py +0 -0
  75. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluation_scenario.py +0 -0
  76. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluation_scenario_input.py +0 -0
  77. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluation_scenario_output.py +0 -0
  78. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluation_scenario_result.py +0 -0
  79. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluation_scenario_score_update.py +0 -0
  80. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluation_status_enum.py +0 -0
  81. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluation_type.py +0 -0
  82. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluator.py +0 -0
  83. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/evaluator_config.py +0 -0
  84. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/get_config_response.py +0 -0
  85. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/http_validation_error.py +0 -0
  86. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/human_evaluation.py +0 -0
  87. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/human_evaluation_scenario.py +0 -0
  88. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/human_evaluation_scenario_input.py +0 -0
  89. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/human_evaluation_scenario_output.py +0 -0
  90. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/human_evaluation_scenario_update.py +0 -0
  91. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/human_evaluation_update.py +0 -0
  92. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/image.py +0 -0
  93. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/invite_request.py +0 -0
  94. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/list_api_keys_response.py +0 -0
  95. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/llm_run_rate_limit.py +0 -0
  96. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/llm_tokens.py +0 -0
  97. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/lm_providers_enum.py +0 -0
  98. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/new_human_evaluation.py +0 -0
  99. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/new_testset.py +0 -0
  100. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/organization.py +0 -0
  101. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/organization_output.py +0 -0
  102. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/outputs.py +0 -0
  103. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/permission.py +0 -0
  104. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/result.py +0 -0
  105. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/score.py +0 -0
  106. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/simple_evaluation_output.py +0 -0
  107. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/span.py +0 -0
  108. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/span_detail.py +0 -0
  109. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/span_status_code.py +0 -0
  110. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/span_variant.py +0 -0
  111. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/template.py +0 -0
  112. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/template_image_info.py +0 -0
  113. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/test_set_output_response.py +0 -0
  114. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/test_set_simple_response.py +0 -0
  115. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/trace_detail.py +0 -0
  116. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/update_app_output.py +0 -0
  117. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/uri.py +0 -0
  118. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/validation_error.py +0 -0
  119. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/validation_error_loc_item.py +0 -0
  120. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/variant_action.py +0 -0
  121. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/variant_action_enum.py +0 -0
  122. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/with_pagination.py +0 -0
  123. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/workspace_member_response.py +0 -0
  124. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/workspace_permission.py +0 -0
  125. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/workspace_response.py +0 -0
  126. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/workspace_role.py +0 -0
  127. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/types/workspace_role_response.py +0 -0
  128. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/variants/__init__.py +0 -0
  129. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/variants/client.py +0 -0
  130. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/variants/types/__init__.py +0 -0
  131. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/backend/variants/types/add_variant_from_base_and_config_response.py +0 -0
  132. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/client.py +0 -0
  133. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/client/exceptions.py +0 -0
  134. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/config.py +0 -0
  135. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/config.toml +0 -0
  136. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/docker/docker-assets/Dockerfile.cloud.template +0 -0
  137. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/docker/docker-assets/Dockerfile.template +0 -0
  138. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/docker/docker-assets/README.md +0 -0
  139. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/docker/docker-assets/entrypoint.sh +0 -0
  140. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/docker/docker-assets/lambda_function.py +0 -0
  141. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/docker/docker-assets/main.py +0 -0
  142. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/docker/docker_utils.py +0 -0
  143. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/__init__.py +0 -0
  144. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/agenta_init.py +0 -0
  145. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/assets.py +0 -0
  146. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/client.py +0 -0
  147. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/config_manager.py +0 -0
  148. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/context/__init__.py +0 -0
  149. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/context/routing.py +0 -0
  150. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/context/tracing.py +0 -0
  151. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/decorators/__init__.py +0 -0
  152. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/litellm/__init__.py +0 -0
  153. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/litellm/litellm.py +0 -0
  154. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/router.py +0 -0
  155. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/tracing/__init__.py +0 -0
  156. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/tracing/attributes.py +0 -0
  157. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/tracing/context.py +0 -0
  158. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/tracing/conventions.py +0 -0
  159. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/tracing/exporters.py +0 -0
  160. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/tracing/processors.py +0 -0
  161. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/tracing/spans.py +0 -0
  162. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/types.py +0 -0
  163. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/utils/__init__.py +0 -0
  164. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/utils/costs.py +0 -0
  165. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/utils/debug.py +0 -0
  166. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/utils/globals.py +0 -0
  167. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/utils/logging.py +0 -0
  168. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/utils/preinit.py +0 -0
  169. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/sdk/utils/singleton.py +0 -0
  170. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/compose_email/README.md +0 -0
  171. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/compose_email/app.py +0 -0
  172. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/compose_email/env.example +0 -0
  173. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/compose_email/requirements.txt +0 -0
  174. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/compose_email/template.toml +0 -0
  175. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/extract_data_to_json/README.md +0 -0
  176. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/extract_data_to_json/app.py +0 -0
  177. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/extract_data_to_json/env.example +0 -0
  178. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/extract_data_to_json/requirements.txt +0 -0
  179. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/extract_data_to_json/template.toml +0 -0
  180. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/simple_prompt/README.md +0 -0
  181. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/simple_prompt/app.py +0 -0
  182. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/simple_prompt/env.example +0 -0
  183. {agenta-0.25.3a1 → agenta-0.25.4a1}/agenta/templates/simple_prompt/requirements.txt +0 -0
  184. {agenta-0.25.3a1 → agenta-0.25.4a1}/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.25.3a1
3
+ Version: 0.25.4a1
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
@@ -392,9 +392,12 @@ class entrypoint:
392
392
  if inspect.iscoroutinefunction(func)
393
393
  else func(*args, **func_params["params"])
394
394
  )
395
-
396
395
  data = self.patch_result(result)
397
396
  except Exception as e:
397
+ log.error(f"Agenta SDK - Routing Exception")
398
+
399
+ traceback.print_exc()
400
+
398
401
  self.handle_exception(e)
399
402
 
400
403
  with suppress():
@@ -1,4 +1,5 @@
1
1
  import inspect
2
+ import traceback
2
3
  from functools import wraps
3
4
  from itertools import chain
4
5
  from typing import Callable, Optional, Any, Dict, List
@@ -63,7 +64,9 @@ class instrument:
63
64
  not in (
64
65
  ignore
65
66
  if isinstance(ignore, list)
66
- else io.keys() if ignore is True else []
67
+ else io.keys()
68
+ if ignore is True
69
+ else []
67
70
  )
68
71
  }
69
72
 
@@ -137,6 +140,8 @@ class instrument:
137
140
  try:
138
141
  result = await func(*args, **kwargs)
139
142
  except Exception as e:
143
+ traceback.print_exc()
144
+
140
145
  span.record_exception(e)
141
146
 
142
147
  span.set_status("ERROR")
@@ -146,6 +151,7 @@ class instrument:
146
151
  with suppress():
147
152
  cost = None
148
153
  usage = {}
154
+
149
155
  if isinstance(result, dict):
150
156
  cost = result.get("cost", None)
151
157
  usage = result.get("usage", {})
@@ -60,7 +60,7 @@ def _p_ora(o, open="{", close="}", sep=": ", foo=repr):
60
60
  return f"[{', '.join([repr(el) for el in o])}]"
61
61
  elif isinstance(o, dict):
62
62
  o = OrderedDict(sorted(o.items()))
63
- return f"{open}{', '.join([f"{foo(elk)}{sep}{_p_ora(elv)}" for elk, elv in o.items()])}{close}"
63
+ return f"{open}{', '.join([f'{foo(elk)}{sep}{_p_ora(elv)}' for elk, elv in o.items()])}{close}"
64
64
  else:
65
65
  if o is not None:
66
66
  return repr(o)
@@ -92,6 +92,7 @@ class LifecycleDTO(DisplayBase):
92
92
 
93
93
  updated_by_id: Optional[UUID] = None
94
94
 
95
+
95
96
  ### -------------------- ###
96
97
  ### services.shared.dtos ###
97
98
  ############################
@@ -306,6 +307,7 @@ class OTelSpanDTO(DisplayBase):
306
307
  parent: Optional[OTelContextDTO] = None
307
308
  links: Optional[List[OTelLinkDTO]] = None
308
309
 
310
+
309
311
  ### --------------------------- ###
310
312
  ### services.observability.dtos ###
311
313
  ###################################
@@ -321,7 +323,6 @@ from typing import List, Dict, OrderedDict
321
323
  def parse_span_dtos_to_span_idx(
322
324
  span_dtos: List[SpanCreateDTO],
323
325
  ) -> Dict[str, SpanCreateDTO]:
324
-
325
326
  span_idx = {span_dto.node.id: span_dto for span_dto in span_dtos}
326
327
 
327
328
  return span_idx
@@ -330,7 +331,6 @@ def parse_span_dtos_to_span_idx(
330
331
  def parse_span_idx_to_span_id_tree(
331
332
  span_idx: Dict[str, SpanCreateDTO],
332
333
  ) -> OrderedDict:
333
-
334
334
  span_id_tree = OrderedDict()
335
335
  index = {}
336
336
 
@@ -352,7 +352,6 @@ def cumulate_costs(
352
352
  spans_id_tree: OrderedDict,
353
353
  spans_idx: Dict[str, SpanCreateDTO],
354
354
  ) -> None:
355
-
356
355
  def _get_unit(span: SpanCreateDTO):
357
356
  if span.metrics is not None:
358
357
  return span.metrics.get("unit.costs.total", 0.0)
@@ -382,7 +381,6 @@ def cumulate_tokens(
382
381
  spans_id_tree: OrderedDict,
383
382
  spans_idx: Dict[str, dict],
384
383
  ) -> None:
385
-
386
384
  def _get_unit(span: SpanCreateDTO):
387
385
  _tokens = {
388
386
  "prompt": 0.0,
@@ -429,9 +427,15 @@ def cumulate_tokens(
429
427
  if tokens.get("prompt", 0.0) != 0.0:
430
428
  span.metrics["acc.tokens.prompt"] = tokens.get("prompt", 0.0)
431
429
  if tokens.get("completion", 0.0) != 0.0:
432
- span.metrics["acc.tokens.completion"] = tokens.get("completion", 0.0) if tokens.get("completion", 0.0) != 0.0 else None
430
+ span.metrics["acc.tokens.completion"] = (
431
+ tokens.get("completion", 0.0)
432
+ if tokens.get("completion", 0.0) != 0.0
433
+ else None
434
+ )
433
435
  if tokens.get("total", 0.0) != 0.0:
434
- span.metrics["acc.tokens.total"] = tokens.get("total", 0.0) if tokens.get("total", 0.0) != 0.0 else None
436
+ span.metrics["acc.tokens.total"] = (
437
+ tokens.get("total", 0.0) if tokens.get("total", 0.0) != 0.0 else None
438
+ )
435
439
 
436
440
  _cumulate_tree_dfs(spans_id_tree, spans_idx, _get_unit, _get_acc, _acc, _set)
437
441
 
@@ -500,6 +504,7 @@ def _connect_tree_dfs(
500
504
  if len(parent_span.nodes) == 0:
501
505
  parent_span.nodes = None
502
506
 
507
+
503
508
  ### ---------------------------- ###
504
509
  ### services.observability.utils ###
505
510
  ####################################
@@ -631,7 +636,6 @@ def _unmarshal_attributes(
631
636
  level = unmarshalled
632
637
 
633
638
  for i, part in enumerate(keys[:-1]):
634
-
635
639
  if part.isdigit():
636
640
  part = int(part)
637
641
 
@@ -803,7 +807,6 @@ def _parse_from_links(
803
807
  def _parse_from_attributes(
804
808
  otel_span_dto: OTelSpanDTO,
805
809
  ) -> Tuple[dict, dict, dict, dict, dict]:
806
-
807
810
  # DATA
808
811
  _data = _get_attributes(otel_span_dto.attributes, "data")
809
812
 
@@ -990,6 +993,7 @@ def parse_to_agenta_span_dto(
990
993
 
991
994
  return span_dto
992
995
 
996
+
993
997
  ### -------------------------------- ###
994
998
  ### apis.fastapi.observability.utils ###
995
999
  ########################################
@@ -1008,7 +1012,7 @@ def parse_inline_trace(
1008
1012
  ############################################################
1009
1013
  ### apis.fastapi.observability.api.otlp_collect_traces() ###
1010
1014
  ### ---------------------------------------------------- ###
1011
- span_dtos = [
1015
+ span_dtos = [
1012
1016
  parse_from_otel_span_dto(project_id, otel_span_dto)
1013
1017
  for otel_span_dto in otel_span_dtos
1014
1018
  ]
@@ -1033,13 +1037,15 @@ def parse_inline_trace(
1033
1037
  ### --------------------------------------- ###
1034
1038
  ### services.observability.service.ingest() ###
1035
1039
  ###############################################
1036
-
1040
+
1037
1041
  ##############################################
1038
1042
  ### services.observability.service.query() ###
1039
1043
  ### -------------------------------------- ###
1040
1044
  connect_children(span_id_tree, span_idx)
1041
- root_span_dtos = [span_dto for span_dto in span_idx.values()]
1042
- agenta_span_dtos = [parse_to_agenta_span_dto(span_dto) for span_dto in root_span_dtos]
1045
+ root_span_dtos = [span_idx[span_id] for span_id in span_id_tree.keys()]
1046
+ agenta_span_dtos = [
1047
+ parse_to_agenta_span_dto(span_dto) for span_dto in root_span_dtos
1048
+ ]
1043
1049
  ### -------------------------------------- ###
1044
1050
  ### services.observability.service.query() ###
1045
1051
  ##############################################
@@ -1048,17 +1054,25 @@ def parse_inline_trace(
1048
1054
  inline_trace = None
1049
1055
 
1050
1056
  if LEGACY:
1051
- legacy_spans = [_parse_to_legacy_span(span_dto) for span_dto in span_idx.values()]
1057
+ legacy_spans = [
1058
+ _parse_to_legacy_span(span_dto) for span_dto in span_idx.values()
1059
+ ]
1052
1060
 
1053
- root_span = root_span_dtos[0]
1061
+ root_span = agenta_span_dtos[0]
1054
1062
 
1055
1063
  trace_id = root_span.root.id.hex
1056
- latency = root_span.time.span
1064
+ latency = root_span.time.span / 1_000_000
1057
1065
  cost = root_span.metrics.get("acc", {}).get("costs", {}).get("total", 0.0)
1058
1066
  tokens = {
1059
- "prompt_tokens": root_span.metrics.get("acc", {}).get("tokens", {}).get("prompt", 0),
1060
- "completion_tokens": root_span.metrics.get("acc", {}).get("tokens", {}).get("completion", 0),
1061
- "total_tokens": root_span.metrics.get("acc", {}).get("tokens", {}).get("total", 0),
1067
+ "prompt_tokens": root_span.metrics.get("acc", {})
1068
+ .get("tokens", {})
1069
+ .get("prompt", 0),
1070
+ "completion_tokens": root_span.metrics.get("acc", {})
1071
+ .get("tokens", {})
1072
+ .get("completion", 0),
1073
+ "total_tokens": root_span.metrics.get("acc", {})
1074
+ .get("tokens", {})
1075
+ .get("total", 0),
1062
1076
  }
1063
1077
 
1064
1078
  spans = [
@@ -1072,13 +1086,14 @@ def parse_inline_trace(
1072
1086
  "tokens": tokens,
1073
1087
  "spans": spans,
1074
1088
  }
1075
-
1089
+
1076
1090
  else:
1077
1091
  spans = [
1078
- loads(span_dto.model_dump_json(exclude_none=True)) for span_dto in agenta_span_dtos
1092
+ loads(span_dto.model_dump_json(exclude_none=True))
1093
+ for span_dto in agenta_span_dtos
1079
1094
  ]
1080
1095
 
1081
- inline_trace = spans # turn into Agenta Model ?
1096
+ inline_trace = spans # turn into Agenta Model ?
1082
1097
 
1083
1098
  return inline_trace
1084
1099
 
@@ -1095,7 +1110,10 @@ def _parse_readable_spans(
1095
1110
  span_id=_int_to_hex(span.get_span_context().span_id, 64),
1096
1111
  ),
1097
1112
  name=span.name,
1098
- kind=OTelSpanKind("SPAN_KIND_" + (span.kind if isinstance(span.kind, str) else span.kind.name)),
1113
+ kind=OTelSpanKind(
1114
+ "SPAN_KIND_"
1115
+ + (span.kind if isinstance(span.kind, str) else span.kind.name)
1116
+ ),
1099
1117
  start_time=_timestamp_ns_to_datetime(span.start_time),
1100
1118
  end_time=_timestamp_ns_to_datetime(span.end_time),
1101
1119
  status_code=OTelStatusCode("STATUS_CODE_" + span.status.status_code.name),
@@ -1109,10 +1127,14 @@ def _parse_readable_spans(
1109
1127
  )
1110
1128
  for event in span.events
1111
1129
  ],
1112
- parent=OTelContextDTO(
1113
- trace_id=_int_to_hex(span.parent.trace_id, 128),
1114
- span_id=_int_to_hex(span.parent.span_id, 64)
1115
- ) if span.parent else None,
1130
+ parent=(
1131
+ OTelContextDTO(
1132
+ trace_id=_int_to_hex(span.parent.trace_id, 128),
1133
+ span_id=_int_to_hex(span.parent.span_id, 64),
1134
+ )
1135
+ if span.parent
1136
+ else None
1137
+ ),
1116
1138
  links=[
1117
1139
  OTelLinkDTO(
1118
1140
  context=OTelContextDTO(
@@ -1125,7 +1147,6 @@ def _parse_readable_spans(
1125
1147
  ],
1126
1148
  )
1127
1149
 
1128
-
1129
1150
  otel_span_dtos.append(otel_span_dto)
1130
1151
 
1131
1152
  return otel_span_dtos
@@ -1209,14 +1230,32 @@ def _parse_to_legacy_span(span: SpanDTO) -> CreateSpan:
1209
1230
  environment=span.meta.get("environment") if span.meta else None,
1210
1231
  config=span.meta.get("configuration") if span.meta else None,
1211
1232
  #
1212
- tokens=LlmTokens(
1213
- prompt_tokens=span.metrics.get("acc", {}).get("tokens", {}).get("prompt", 0.0),
1214
- completion_tokens=span.metrics.get("acc", {}).get("tokens", {}).get("completion", 0.0),
1215
- total_tokens=span.metrics.get("acc", {}).get("tokens", {}).get("total", 0.0),
1216
- ) if span.metrics else None,
1217
- cost=span.metrics.get("acc", {}).get("costs", {}).get("total", 0.0) if span.metrics else None,
1233
+ tokens=(
1234
+ LlmTokens(
1235
+ prompt_tokens=span.metrics.get("acc", {})
1236
+ .get("tokens", {})
1237
+ .get("prompt", 0.0),
1238
+ completion_tokens=span.metrics.get("acc", {})
1239
+ .get("tokens", {})
1240
+ .get("completion", 0.0),
1241
+ total_tokens=span.metrics.get("acc", {})
1242
+ .get("tokens", {})
1243
+ .get("total", 0.0),
1244
+ )
1245
+ if span.metrics
1246
+ else None
1247
+ ),
1248
+ cost=(
1249
+ span.metrics.get("acc", {}).get("costs", {}).get("total", 0.0)
1250
+ if span.metrics
1251
+ else None
1252
+ ),
1218
1253
  #
1219
- app_id=span.refs.get("application", {}).get("id", "missing-app-id") if span.refs else "missing-app-id",
1254
+ app_id=(
1255
+ span.refs.get("application", {}).get("id", "missing-app-id")
1256
+ if span.refs
1257
+ else "missing-app-id"
1258
+ ),
1220
1259
  #
1221
1260
  attributes=attributes,
1222
1261
  #
@@ -34,8 +34,7 @@ class Tracing(metaclass=Singleton):
34
34
  url: str,
35
35
  ) -> None:
36
36
  # ENDPOINT (OTLP)
37
- # self.otlp_url = url
38
- self.otlp_url = "http://127.0.0.1:8000/api/observability/v1/otlp/traces"
37
+ self.otlp_url = url
39
38
  # AUTHENTICATION (OTLP)
40
39
  self.project_id: Optional[str] = None
41
40
  # AUTHORIZATION (OTLP)
@@ -62,17 +61,20 @@ class Tracing(metaclass=Singleton):
62
61
  app_id: Optional[str] = None,
63
62
  ):
64
63
  # AUTHENTICATION (OTLP)
65
- # self.project_id = project_id
66
- self.project_id = "f7943e42-ec69-498e-bf58-8db034b9286e"
64
+ self.project_id = project_id # "f7943e42-ec69-498e-bf58-8db034b9286e"
65
+ self.app_id = app_id
67
66
  # AUTHORIZATION (OTLP)
68
67
  self.api_key = api_key
69
68
  # HEADERS (OTLP)
70
- self.headers = {"AG-PROJECT-ID": self.project_id}
69
+ self.headers = {}
70
+ if project_id:
71
+ self.headers.update(**{"AG-PROJECT-ID": project_id})
72
+ if app_id:
73
+ self.headers.update(**{"AG-APP-ID": app_id})
71
74
  if api_key:
72
- # self.headers.update(**{"Authorization": f"Api-Key {self.api_key}"})
73
75
  self.headers.update(**{"Authorization": self.api_key})
74
76
  # REFERENCES
75
- self.references = {"application.id": app_id}
77
+ self.references = {"application_id": app_id}
76
78
 
77
79
  # TRACER PROVIDER
78
80
  self.tracer_provider = TracerProvider(
@@ -94,7 +96,7 @@ class Tracing(metaclass=Singleton):
94
96
  try:
95
97
  log.info(f"Connecting to the remote trace receiver at {self.otlp_url}...")
96
98
 
97
- check(self.otlp_url, headers=self.headers)
99
+ check(self.otlp_url, headers=self.headers, timeout=1)
98
100
 
99
101
  log.info(f"Connection established.")
100
102
 
@@ -104,7 +106,8 @@ class Tracing(metaclass=Singleton):
104
106
  )
105
107
 
106
108
  self.tracer_provider.add_span_processor(_otlp)
107
- except:
109
+ except Exception as e:
110
+ log.error(e)
108
111
  log.warning(f"Connection failed.")
109
112
  log.warning(
110
113
  f"Warning: Your traces will not be exported since {self.otlp_url} is unreachable."
@@ -159,7 +162,7 @@ class Tracing(metaclass=Singleton):
159
162
  if not otel_spans:
160
163
  return {}
161
164
 
162
- inline_trace = parse_inline_trace(self.project_id, otel_spans)
165
+ inline_trace = parse_inline_trace(self.project_id or self.app_id, otel_spans)
163
166
 
164
167
  return inline_trace
165
168
 
@@ -14,5 +14,6 @@ class suppress(AbstractContextManager):
14
14
  if exc_type is None:
15
15
  return
16
16
  else:
17
+ print("Agenta SDK - Tracing Exception")
17
18
  log.error(f"{exc_type.__name__}: {exc_value}\n{format_exc()}")
18
19
  return
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "agenta"
3
- version = "0.25.3a1"
3
+ version = "0.25.4a1"
4
4
  description = "The SDK for agenta is an open-source LLMOps platform."
5
5
  readme = "README.md"
6
6
  authors = ["Mahmoud Mabrouk <mahmoud@agenta.ai>"]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes