traigent-schema 4.1.0__py3-none-any.whl

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.
Files changed (148) hide show
  1. traigent_schema/__init__.py +37 -0
  2. traigent_schema/analytics_validators.py +226 -0
  3. traigent_schema/schemas/agents/agent_deployment_schema.json +221 -0
  4. traigent_schema/schemas/agents/agent_response_schema.json +188 -0
  5. traigent_schema/schemas/agents/agent_schema.json +152 -0
  6. traigent_schema/schemas/agents/agent_types_schema.json +31 -0
  7. traigent_schema/schemas/agents/agents_endpoints.json +232 -0
  8. traigent_schema/schemas/agents/model_parameters_schema.json +120 -0
  9. traigent_schema/schemas/agents/model_schema.json +224 -0
  10. traigent_schema/schemas/agents/retriever_schema.json +125 -0
  11. traigent_schema/schemas/analytics/analytics_endpoints.json +116 -0
  12. traigent_schema/schemas/analytics/dataset_quality_schema.json +159 -0
  13. traigent_schema/schemas/analytics/example_score_schema.json +124 -0
  14. traigent_schema/schemas/analytics/scoring_job_status_schema.json +87 -0
  15. traigent_schema/schemas/datasets/dataset_schema.json +12 -0
  16. traigent_schema/schemas/datasets/datasets_endpoints.json +123 -0
  17. traigent_schema/schemas/datasets/evaluation_set_schema.json +247 -0
  18. traigent_schema/schemas/datasets/evaluator_config_schema.json +131 -0
  19. traigent_schema/schemas/datasets/example_set_schema.json +69 -0
  20. traigent_schema/schemas/datasets/generator_config_schema.json +128 -0
  21. traigent_schema/schemas/evaluation/configuration_run_schema.json +182 -0
  22. traigent_schema/schemas/evaluation/evaluation_request_schema.json +39 -0
  23. traigent_schema/schemas/evaluation/evaluation_results_schema.json +135 -0
  24. traigent_schema/schemas/evaluation/evaluation_schema.json +137 -0
  25. traigent_schema/schemas/evaluation/experiment_run_schema.json +517 -0
  26. traigent_schema/schemas/evaluation/experiment_schema.json +246 -0
  27. traigent_schema/schemas/execution/dataset_storage_schema.json +233 -0
  28. traigent_schema/schemas/execution/execution_endpoints.json +458 -0
  29. traigent_schema/schemas/execution/execution_mode_schema.json +171 -0
  30. traigent_schema/schemas/execution/hybrid_session_schema.json +183 -0
  31. traigent_schema/schemas/execution/metric_submission_schema.json +135 -0
  32. traigent_schema/schemas/execution/saas_execution_schema.json +318 -0
  33. traigent_schema/schemas/execution/service_registration_schema.json +64 -0
  34. traigent_schema/schemas/execution/workflow_metadata_schema.json +140 -0
  35. traigent_schema/schemas/measures/measure_schema.json +249 -0
  36. traigent_schema/schemas/measures/measures_endpoints.json +95 -0
  37. traigent_schema/schemas/measures/score_schema.json +278 -0
  38. traigent_schema/schemas/mep.json +26 -0
  39. traigent_schema/schemas/mep_endpoints.json +51 -0
  40. traigent_schema/schemas/observability/annotation_queue_create_request_schema.json +27 -0
  41. traigent_schema/schemas/observability/annotation_queue_item_complete_result_schema.json +16 -0
  42. traigent_schema/schemas/observability/annotation_queue_item_create_request_schema.json +33 -0
  43. traigent_schema/schemas/observability/annotation_queue_item_create_result_schema.json +16 -0
  44. traigent_schema/schemas/observability/annotation_queue_item_list_response_schema.json +15 -0
  45. traigent_schema/schemas/observability/annotation_queue_item_schema.json +41 -0
  46. traigent_schema/schemas/observability/annotation_queue_list_response_schema.json +15 -0
  47. traigent_schema/schemas/observability/annotation_queue_schema.json +35 -0
  48. traigent_schema/schemas/observability/annotation_queue_update_request_schema.json +16 -0
  49. traigent_schema/schemas/observability/correlation_ids_schema.json +12 -0
  50. traigent_schema/schemas/observability/evaluator_backfill_result_schema.json +30 -0
  51. traigent_schema/schemas/observability/evaluator_definition_schema.json +47 -0
  52. traigent_schema/schemas/observability/evaluator_execute_request_schema.json +21 -0
  53. traigent_schema/schemas/observability/evaluator_list_response_schema.json +15 -0
  54. traigent_schema/schemas/observability/evaluator_run_list_response_schema.json +15 -0
  55. traigent_schema/schemas/observability/evaluator_run_schema.json +47 -0
  56. traigent_schema/schemas/observability/evaluator_update_request_schema.json +20 -0
  57. traigent_schema/schemas/observability/observability_endpoints.json +703 -0
  58. traigent_schema/schemas/observability/observability_ingest_request_schema.json +16 -0
  59. traigent_schema/schemas/observability/observation_schema.json +33 -0
  60. traigent_schema/schemas/observability/prompt_link_schema.json +20 -0
  61. traigent_schema/schemas/observability/prompt_reference_schema.json +18 -0
  62. traigent_schema/schemas/observability/review_measure_summary_schema.json +28 -0
  63. traigent_schema/schemas/observability/review_score_create_request_schema.json +103 -0
  64. traigent_schema/schemas/observability/review_score_list_response_schema.json +22 -0
  65. traigent_schema/schemas/observability/review_score_schema.json +48 -0
  66. traigent_schema/schemas/observability/session_list_response_schema.json +17 -0
  67. traigent_schema/schemas/observability/session_schema.json +21 -0
  68. traigent_schema/schemas/observability/trace_collaboration_state_schema.json +13 -0
  69. traigent_schema/schemas/observability/trace_collaboration_update_request_schema.json +15 -0
  70. traigent_schema/schemas/observability/trace_comment_create_request_schema.json +11 -0
  71. traigent_schema/schemas/observability/trace_comment_schema.json +17 -0
  72. traigent_schema/schemas/observability/trace_comments_response_schema.json +15 -0
  73. traigent_schema/schemas/observability/trace_feedback_response_schema.json +8 -0
  74. traigent_schema/schemas/observability/trace_feedback_schema.json +18 -0
  75. traigent_schema/schemas/observability/trace_feedback_upsert_request_schema.json +13 -0
  76. traigent_schema/schemas/observability/trace_list_response_schema.json +17 -0
  77. traigent_schema/schemas/observability/trace_observations_response_schema.json +15 -0
  78. traigent_schema/schemas/observability/trace_schema.json +41 -0
  79. traigent_schema/schemas/observability/trace_score_summary_schema.json +33 -0
  80. traigent_schema/schemas/observability/user_summary_schema.json +21 -0
  81. traigent_schema/schemas/optimization/config_space_schema.json +105 -0
  82. traigent_schema/schemas/optimization/exploration_config_schema.json +95 -0
  83. traigent_schema/schemas/optimization/objective_definition_schema.json +71 -0
  84. traigent_schema/schemas/optimization/optimization_endpoints.json +280 -0
  85. traigent_schema/schemas/optimization/promotion_policy_schema.json +82 -0
  86. traigent_schema/schemas/optimization/tunable_schema.json +50 -0
  87. traigent_schema/schemas/optimization/tvar_definition_schema.json +83 -0
  88. traigent_schema/schemas/optimization/typed_constraints_schema.json +26 -0
  89. traigent_schema/schemas/pagination_schema.json +46 -0
  90. traigent_schema/schemas/planned_projects_endpoints.json +865 -0
  91. traigent_schema/schemas/planner/planner_draft_schema.json +52 -0
  92. traigent_schema/schemas/projects/project_context_error_schema.json +28 -0
  93. traigent_schema/schemas/projects/project_create_request_schema.json +30 -0
  94. traigent_schema/schemas/projects/project_export_job_list_response_schema.json +46 -0
  95. traigent_schema/schemas/projects/project_export_job_schema.json +92 -0
  96. traigent_schema/schemas/projects/project_export_policy_schema.json +43 -0
  97. traigent_schema/schemas/projects/project_export_policy_update_request_schema.json +14 -0
  98. traigent_schema/schemas/projects/project_list_response_schema.json +19 -0
  99. traigent_schema/schemas/projects/project_membership_create_request_schema.json +25 -0
  100. traigent_schema/schemas/projects/project_membership_list_response_schema.json +21 -0
  101. traigent_schema/schemas/projects/project_membership_schema.json +71 -0
  102. traigent_schema/schemas/projects/project_membership_update_request_schema.json +21 -0
  103. traigent_schema/schemas/projects/project_rate_limit_policy_schema.json +59 -0
  104. traigent_schema/schemas/projects/project_rate_limit_policy_update_request_schema.json +27 -0
  105. traigent_schema/schemas/projects/project_retention_policy_schema.json +51 -0
  106. traigent_schema/schemas/projects/project_retention_policy_update_request_schema.json +21 -0
  107. traigent_schema/schemas/projects/project_schema.json +67 -0
  108. traigent_schema/schemas/projects/project_scoped_analytics_summary_schema.json +246 -0
  109. traigent_schema/schemas/projects/project_scoped_analytics_trend_schema.json +100 -0
  110. traigent_schema/schemas/projects/project_scoped_core_metrics_overview_schema.json +81 -0
  111. traigent_schema/schemas/projects/project_scoped_evaluator_quality_dashboard_schema.json +125 -0
  112. traigent_schema/schemas/projects/project_scoped_experiment_trend_schema.json +95 -0
  113. traigent_schema/schemas/projects/project_scoped_fine_tuning_export_query_schema.json +27 -0
  114. traigent_schema/schemas/projects/project_scoped_fine_tuning_manifest_schema.json +106 -0
  115. traigent_schema/schemas/projects/project_scoped_measure_distribution_schema.json +94 -0
  116. traigent_schema/schemas/projects/project_scoped_observability_summary_dashboard_schema.json +132 -0
  117. traigent_schema/schemas/projects/project_scoped_optimization_overview_dashboard_schema.json +146 -0
  118. traigent_schema/schemas/projects/project_scoped_pricing_catalog_schema.json +119 -0
  119. traigent_schema/schemas/projects/project_scoped_project_usage_dashboard_schema.json +122 -0
  120. traigent_schema/schemas/projects/project_update_request_schema.json +29 -0
  121. traigent_schema/schemas/prompts/chat_prompt_message_schema.json +13 -0
  122. traigent_schema/schemas/prompts/prompt_analytics_schema.json +24 -0
  123. traigent_schema/schemas/prompts/prompt_create_request_schema.json +82 -0
  124. traigent_schema/schemas/prompts/prompt_detail_schema.json +18 -0
  125. traigent_schema/schemas/prompts/prompt_labels_update_request_schema.json +21 -0
  126. traigent_schema/schemas/prompts/prompt_playground_request_schema.json +34 -0
  127. traigent_schema/schemas/prompts/prompt_playground_result_schema.json +29 -0
  128. traigent_schema/schemas/prompts/prompt_summary_schema.json +28 -0
  129. traigent_schema/schemas/prompts/prompt_version_create_request_schema.json +36 -0
  130. traigent_schema/schemas/prompts/prompt_version_schema.json +33 -0
  131. traigent_schema/schemas/prompts/prompts_endpoints.json +226 -0
  132. traigent_schema/schemas/prompts/resolved_prompt_schema.json +17 -0
  133. traigent_schema/schemas/results/comparison_schema.json +218 -0
  134. traigent_schema/schemas/results/report_request_schema.json +277 -0
  135. traigent_schema/schemas/results/report_schema.json +277 -0
  136. traigent_schema/schemas/results/results_endpoints.json +90 -0
  137. traigent_schema/schemas/results/visualization_request_schema.json +228 -0
  138. traigent_schema/schemas/results/visualization_schema.json +273 -0
  139. traigent_schema/schemas/sdk_tuning_endpoints.json +21 -0
  140. traigent_schema/schemas/status_schema.json +105 -0
  141. traigent_schema/utils.py +129 -0
  142. traigent_schema/validator.py +268 -0
  143. traigent_schema/version.py +3 -0
  144. traigent_schema-4.1.0.dist-info/METADATA +234 -0
  145. traigent_schema-4.1.0.dist-info/RECORD +148 -0
  146. traigent_schema-4.1.0.dist-info/WHEEL +4 -0
  147. traigent_schema-4.1.0.dist-info/licenses/LICENSE +661 -0
  148. traigent_schema-4.1.0.dist-info/licenses/NOTICE +19 -0
@@ -0,0 +1,37 @@
1
+ """
2
+ Traigent Schema Library
3
+
4
+ Provides JSON Schema definitions and validation utilities for the Traigent
5
+ AI optimization platform. This package serves as the single source of truth
6
+ for data contracts across all Traigent services.
7
+
8
+ Example:
9
+ from traigent_schema import SchemaValidator, get_schemas_dir
10
+
11
+ validator = SchemaValidator()
12
+ validator.validate_request('/api/v1/agents', 'POST', request_data)
13
+ """
14
+
15
+ from traigent_schema.analytics_validators import AnalyticsValidator
16
+ from traigent_schema.utils import (
17
+ get_all_schema_files,
18
+ get_contract_path,
19
+ get_openapi_path,
20
+ get_schema_path,
21
+ get_schemas_dir,
22
+ load_schema,
23
+ )
24
+ from traigent_schema.validator import SchemaValidator
25
+ from traigent_schema.version import __version__
26
+
27
+ __all__ = [
28
+ "AnalyticsValidator",
29
+ "SchemaValidator",
30
+ "get_schemas_dir",
31
+ "get_schema_path",
32
+ "get_all_schema_files",
33
+ "get_contract_path",
34
+ "get_openapi_path",
35
+ "load_schema",
36
+ "__version__",
37
+ ]
@@ -0,0 +1,226 @@
1
+ """Validation utilities for analytics schemas.
2
+
3
+ Provides helper functions and a validator class for validating
4
+ example scores, dataset quality, and scoring job status data
5
+ against their respective JSON schemas.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import re
11
+ from typing import Any
12
+
13
+ from traigent_schema.validator import SchemaValidator
14
+
15
+
16
+ class AnalyticsValidator:
17
+ """Validator for analytics-related schemas.
18
+
19
+ Provides convenience methods for validating ExampleScore, DatasetQuality,
20
+ and ScoringJobStatus data against their JSON schemas.
21
+
22
+ Example:
23
+ validator = AnalyticsValidator()
24
+ errors = validator.validate_example_score(score_data)
25
+ if not errors:
26
+ print("Score data is valid")
27
+ """
28
+
29
+ # Pre-compiled regex patterns for validation
30
+ _EXAMPLE_ID_PATTERN = re.compile(r'^ex_[a-f0-9]{8,12}_\d+$')
31
+ _JOB_ID_PATTERN = re.compile(r'^score_[a-zA-Z0-9_-]+_\d+$')
32
+ _ALGORITHM_VERSION_PATTERN = re.compile(r'^\d+\.\d+\.\d+$')
33
+
34
+ def __init__(self) -> None:
35
+ """Initialize the validator with schema validator."""
36
+ self._validator = SchemaValidator()
37
+
38
+ def validate_example_score(self, score_data: dict[str, Any]) -> list[str]:
39
+ """Validate ExampleScore data against schema.
40
+
41
+ Args:
42
+ score_data: Dictionary containing example score data
43
+
44
+ Returns:
45
+ List of validation error messages. Empty if valid.
46
+ """
47
+ return self._validator.validate_json(
48
+ score_data,
49
+ "example_score_schema"
50
+ )
51
+
52
+ def validate_dataset_quality(self, quality_data: dict[str, Any]) -> list[str]:
53
+ """Validate DatasetQuality data against schema.
54
+
55
+ Args:
56
+ quality_data: Dictionary containing dataset quality data
57
+
58
+ Returns:
59
+ List of validation error messages. Empty if valid.
60
+ """
61
+ return self._validator.validate_json(
62
+ quality_data,
63
+ "dataset_quality_schema"
64
+ )
65
+
66
+ def validate_scoring_job_status(self, status_data: dict[str, Any]) -> list[str]:
67
+ """Validate ScoringJobStatus data against schema.
68
+
69
+ Args:
70
+ status_data: Dictionary containing job status data
71
+
72
+ Returns:
73
+ List of validation error messages. Empty if valid.
74
+ """
75
+ return self._validator.validate_json(
76
+ status_data,
77
+ "scoring_job_status_schema"
78
+ )
79
+
80
+ def validate_example_metrics(self, data: dict[str, Any]) -> list[str]:
81
+ """Validate ExampleMetrics structure (nested example format).
82
+
83
+ Validates the nested structure used for per-example metrics where
84
+ example_id is separated from the numeric metrics.
85
+
86
+ Args:
87
+ data: Dictionary containing example metrics data with structure:
88
+ {"example_id": "ex_...", "metrics": {"score": 0.85, ...}}
89
+
90
+ Returns:
91
+ List of validation error messages. Empty if valid.
92
+
93
+ Example:
94
+ >>> validator.validate_example_metrics({
95
+ ... "example_id": "ex_abc12345_0",
96
+ ... "metrics": {"score": 0.85, "cost": 0.05}
97
+ ... })
98
+ []
99
+ """
100
+ errors = []
101
+
102
+ # Check required field: example_id
103
+ if "example_id" not in data:
104
+ errors.append("Missing required field: example_id")
105
+ elif not isinstance(data["example_id"], str):
106
+ errors.append("example_id must be a string")
107
+ elif not self.validate_example_id_format(data["example_id"]):
108
+ errors.append(f"Invalid example_id format: {data['example_id']}")
109
+
110
+ # Check required field: metrics
111
+ if "metrics" not in data:
112
+ errors.append("Missing required field: metrics")
113
+ elif not isinstance(data["metrics"], dict):
114
+ errors.append("metrics must be a dict")
115
+ elif len(data["metrics"]) > 50:
116
+ errors.append(f"Too many metrics ({len(data['metrics'])}): max 50 allowed")
117
+ else:
118
+ # Validate each metric value is numeric or null
119
+ for key, value in data["metrics"].items():
120
+ if value is not None and (
121
+ isinstance(value, bool) or not isinstance(value, (int, float))
122
+ ):
123
+ errors.append(
124
+ f"Metric '{key}' must be numeric or null, got {type(value).__name__}"
125
+ )
126
+
127
+ return errors
128
+
129
+ def validate_example_id_format(self, example_id: str) -> bool:
130
+ """Validate example ID follows the required pattern.
131
+
132
+ The pattern is: ex_{hash}_{index} where hash is 8-12 hex characters
133
+ and index is a non-negative integer.
134
+
135
+ Args:
136
+ example_id: Example ID string to validate
137
+
138
+ Returns:
139
+ True if valid format, False otherwise
140
+
141
+ Example:
142
+ >>> validator.validate_example_id_format("ex_abc12345_0")
143
+ True
144
+ >>> validator.validate_example_id_format("invalid")
145
+ False
146
+ """
147
+ return bool(self._EXAMPLE_ID_PATTERN.match(example_id))
148
+
149
+ def validate_job_id_format(self, job_id: str) -> bool:
150
+ """Validate job ID follows the required pattern.
151
+
152
+ The pattern is: score_{identifier}_{timestamp} where identifier
153
+ can contain alphanumeric characters, underscores, and hyphens.
154
+
155
+ Args:
156
+ job_id: Job ID string to validate
157
+
158
+ Returns:
159
+ True if valid format, False otherwise
160
+
161
+ Example:
162
+ >>> validator.validate_job_id_format("score_exp_run_abc123_1705320600")
163
+ True
164
+ >>> validator.validate_job_id_format("invalid_job")
165
+ False
166
+ """
167
+ return bool(self._JOB_ID_PATTERN.match(job_id))
168
+
169
+ def validate_score_range(self, score: float) -> bool:
170
+ """Validate score is in valid range [0, 1].
171
+
172
+ Args:
173
+ score: Score value to validate
174
+
175
+ Returns:
176
+ True if in range [0, 1], False otherwise
177
+ """
178
+ return 0.0 <= score <= 1.0
179
+
180
+ def validate_algorithm_version(self, version: str) -> bool:
181
+ """Validate algorithm version follows semver pattern.
182
+
183
+ Args:
184
+ version: Version string (e.g., '1.0.0')
185
+
186
+ Returns:
187
+ True if valid semver (MAJOR.MINOR.PATCH), False otherwise
188
+
189
+ Example:
190
+ >>> validator.validate_algorithm_version("1.0.0")
191
+ True
192
+ >>> validator.validate_algorithm_version("v1.0.0")
193
+ False
194
+ """
195
+ return bool(self._ALGORITHM_VERSION_PATTERN.match(version))
196
+
197
+ def validate_recommendation_type(self, rec_type: str) -> bool:
198
+ """Validate recommendation type is valid.
199
+
200
+ Args:
201
+ rec_type: Recommendation type string
202
+
203
+ Returns:
204
+ True if valid type (info, warning, critical), False otherwise
205
+ """
206
+ return rec_type in ("info", "warning", "critical")
207
+
208
+ def validate_recommendation_action(self, action: str | None) -> bool:
209
+ """Validate recommendation action is valid.
210
+
211
+ Args:
212
+ action: Action string or None
213
+
214
+ Returns:
215
+ True if valid action (remove, add_similar, review, None), False otherwise
216
+ """
217
+ return action in ("remove", "add_similar", "review", None)
218
+
219
+ @property
220
+ def available_schemas(self) -> list[str]:
221
+ """Get list of analytics schema names."""
222
+ return [
223
+ "example_score_schema",
224
+ "dataset_quality_schema",
225
+ "scoring_job_status_schema",
226
+ ]
@@ -0,0 +1,221 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "title": "Agent Deployment Schema",
5
+ "description": "Defines the deployment configuration and runtime state of an AI agent in the system",
6
+ "version": "1.0.0",
7
+ "definitions": {
8
+ "DeploymentStatus": {
9
+ "type": "string",
10
+ "enum": ["deployed", "undeployed", "pending_deployment", "deployment_failed"],
11
+ "description": "Possible deployment statuses for an agent"
12
+ },
13
+ "RuntimeStatus": {
14
+ "type": "string",
15
+ "enum": ["running", "stopped", "paused", "error"],
16
+ "description": "Possible runtime statuses for an agent"
17
+ },
18
+ "Environment": {
19
+ "type": "string",
20
+ "enum": ["development", "staging", "production", "testing"],
21
+ "description": "Deployment environments for an agent"
22
+ },
23
+ "LoggingLevel": {
24
+ "type": "string",
25
+ "enum": ["error", "warn", "info", "debug", "trace"],
26
+ "description": "Logging levels for monitoring"
27
+ }
28
+ },
29
+ "properties": {
30
+ "id": {
31
+ "type": "string",
32
+ "description": "Unique identifier for this specific agent deployment",
33
+ "x-identifier": true
34
+ },
35
+ "agent_id": {
36
+ "type": "string",
37
+ "description": "Reference to the agent definition this deployment is based on"
38
+ },
39
+ "name": {
40
+ "type": "string",
41
+ "description": "Human-readable name for this deployment instance"
42
+ },
43
+ "deployment_status": {
44
+ "$ref": "#/definitions/DeploymentStatus"
45
+ },
46
+ "runtime_status": {
47
+ "$ref": "#/definitions/RuntimeStatus"
48
+ },
49
+ "environment": {
50
+ "$ref": "#/definitions/Environment"
51
+ },
52
+ "endpoint_url": {
53
+ "type": "string",
54
+ "format": "uri",
55
+ "description": "The URL where this deployed agent can be accessed"
56
+ },
57
+ "version": {
58
+ "type": "string",
59
+ "description": "Version identifier for this deployment"
60
+ },
61
+ "resource_allocation": {
62
+ "type": "object",
63
+ "description": "Resources allocated to this deployment",
64
+ "properties": {
65
+ "cpu": {
66
+ "type": "string",
67
+ "description": "CPU allocation (e.g., '0.5', '1')"
68
+ },
69
+ "memory": {
70
+ "type": "string",
71
+ "description": "Memory allocation (e.g., '512M', '1G')"
72
+ },
73
+ "gpu": {
74
+ "type": "string",
75
+ "description": "GPU allocation if applicable"
76
+ },
77
+ "concurrency": {
78
+ "type": "integer",
79
+ "description": "Maximum number of concurrent requests"
80
+ }
81
+ }
82
+ },
83
+ "scaling_config": {
84
+ "type": "object",
85
+ "description": "Configuration for auto-scaling the deployment",
86
+ "properties": {
87
+ "min_instances": {
88
+ "type": "integer",
89
+ "description": "Minimum number of instances"
90
+ },
91
+ "max_instances": {
92
+ "type": "integer",
93
+ "description": "Maximum number of instances"
94
+ },
95
+ "target_concurrency": {
96
+ "type": "integer",
97
+ "description": "Target concurrency for scaling decisions"
98
+ }
99
+ }
100
+ },
101
+ "rate_limits": {
102
+ "type": "object",
103
+ "description": "Rate limiting configuration",
104
+ "properties": {
105
+ "requests_per_minute": {
106
+ "type": "integer",
107
+ "description": "Maximum requests per minute"
108
+ },
109
+ "burst_limit": {
110
+ "type": "integer",
111
+ "description": "Maximum burst of requests allowed"
112
+ }
113
+ }
114
+ },
115
+ "deployment_config": {
116
+ "type": "object",
117
+ "description": "Additional deployment-specific configuration",
118
+ "additionalProperties": true
119
+ },
120
+ "monitoring": {
121
+ "type": "object",
122
+ "description": "Monitoring configuration for this deployment",
123
+ "properties": {
124
+ "logging_level": {
125
+ "$ref": "#/definitions/LoggingLevel"
126
+ },
127
+ "metrics_enabled": {
128
+ "type": "boolean",
129
+ "description": "Whether metrics collection is enabled"
130
+ },
131
+ "alerting_enabled": {
132
+ "type": "boolean",
133
+ "description": "Whether alerting is enabled"
134
+ }
135
+ }
136
+ },
137
+ "timestamps": {
138
+ "type": "object",
139
+ "description": "Important timestamps for this deployment",
140
+ "properties": {
141
+ "created_at": {
142
+ "type": "string",
143
+ "format": "date-time",
144
+ "description": "When this deployment was created"
145
+ },
146
+ "updated_at": {
147
+ "type": "string",
148
+ "format": "date-time",
149
+ "description": "When this deployment was last updated"
150
+ },
151
+ "deployed_at": {
152
+ "type": "string",
153
+ "format": "date-time",
154
+ "description": "When this agent was last deployed"
155
+ },
156
+ "started_at": {
157
+ "type": "string",
158
+ "format": "date-time",
159
+ "description": "When this agent was last started"
160
+ },
161
+ "stopped_at": {
162
+ "type": "string",
163
+ "format": "date-time",
164
+ "description": "When this agent was last stopped"
165
+ }
166
+ }
167
+ },
168
+ "creator": {
169
+ "type": "string",
170
+ "description": "Identifier of the user who created this deployment"
171
+ },
172
+ "last_modified_by": {
173
+ "type": "string",
174
+ "description": "Identifier of the user who last modified this deployment"
175
+ },
176
+ "metadata": {
177
+ "type": "object",
178
+ "description": "Additional metadata for this deployment",
179
+ "additionalProperties": true
180
+ },
181
+ "health_check": {
182
+ "type": "object",
183
+ "description": "Health check configuration",
184
+ "properties": {
185
+ "enabled": {
186
+ "type": "boolean",
187
+ "description": "Whether health checking is enabled"
188
+ },
189
+ "path": {
190
+ "type": "string",
191
+ "description": "Path for health check requests"
192
+ },
193
+ "interval_seconds": {
194
+ "type": "integer",
195
+ "description": "Interval between health checks in seconds"
196
+ },
197
+ "timeout_seconds": {
198
+ "type": "integer",
199
+ "description": "Timeout for health check in seconds"
200
+ },
201
+ "healthy_threshold": {
202
+ "type": "integer",
203
+ "description": "Number of consecutive successful checks to be considered healthy"
204
+ },
205
+ "unhealthy_threshold": {
206
+ "type": "integer",
207
+ "description": "Number of consecutive failed checks to be considered unhealthy"
208
+ }
209
+ }
210
+ },
211
+ "tags": {
212
+ "type": "array",
213
+ "items": {
214
+ "type": "string"
215
+ },
216
+ "description": "Tags associated with this deployment"
217
+ }
218
+ },
219
+ "required": ["id", "agent_id", "deployment_status", "runtime_status", "environment", "timestamps", "creator"],
220
+ "additionalProperties": false
221
+ }
@@ -0,0 +1,188 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "title": "Agent Response Schema",
4
+ "description": "Schema for agent responses following OpenAI API format",
5
+ "version": "1.0.0",
6
+ "definitions": {
7
+ "NonStreamResponse": {
8
+ "type": "object",
9
+ "description": "A non-streaming response object following the format of the response object from the OpenAI API",
10
+ "properties": {
11
+ "id": {
12
+ "type": "string",
13
+ "description": "Unique identifier for the completion"
14
+ },
15
+ "object": {
16
+ "type": "string",
17
+ "description": "The object type (e.g., 'text_completion')"
18
+ },
19
+ "created": {
20
+ "type": "integer",
21
+ "description": "Unix timestamp of when the completion was created"
22
+ },
23
+ "model": {
24
+ "type": "string",
25
+ "description": "The model used for completion"
26
+ },
27
+ "system_fingerprint": {
28
+ "type": "string",
29
+ "description": "Fingerprint of the system configuration"
30
+ },
31
+ "choices": {
32
+ "type": "array",
33
+ "description": "Array of completion choices",
34
+ "items": {
35
+ "type": "object",
36
+ "properties": {
37
+ "text": {
38
+ "type": "string",
39
+ "description": "The completion text"
40
+ },
41
+ "index": {
42
+ "type": "integer",
43
+ "description": "Index of the choice in the array"
44
+ },
45
+ "logprobs": {
46
+ "type": ["object", "null"],
47
+ "description": "Log probabilities of tokens"
48
+ },
49
+ "finish_reason": {
50
+ "type": ["string", "null"],
51
+ "description": "Reason why the completion finished"
52
+ }
53
+ }
54
+ }
55
+ },
56
+ "usage": {
57
+ "type": "object",
58
+ "description": "Usage statistics for the completion",
59
+ "properties": {
60
+ "prompt_tokens": {
61
+ "type": "integer",
62
+ "description": "Number of tokens in the prompt"
63
+ },
64
+ "completion_tokens": {
65
+ "type": "integer",
66
+ "description": "Number of tokens in the completion"
67
+ },
68
+ "total_tokens": {
69
+ "type": "integer",
70
+ "description": "Total number of tokens used"
71
+ }
72
+ }
73
+ },
74
+ "metadata": {
75
+ "type": "object",
76
+ "description": "Additional metadata about the completion",
77
+ "additionalProperties": true
78
+ }
79
+ },
80
+ "additionalProperties": true
81
+ },
82
+ "StreamResponse": {
83
+ "type": "object",
84
+ "description": "A streaming response object following the format of the response object from the OpenAI API",
85
+ "properties": {
86
+ "id": {
87
+ "type": "string",
88
+ "description": "Unique identifier for the completion"
89
+ },
90
+ "object": {
91
+ "type": "string",
92
+ "description": "The object type (e.g., 'text_completion')"
93
+ },
94
+ "created": {
95
+ "type": "integer",
96
+ "description": "Unix timestamp of when the completion was created"
97
+ },
98
+ "choices": {
99
+ "type": "array",
100
+ "description": "Array of completion choices",
101
+ "items": {
102
+ "type": "object",
103
+ "properties": {
104
+ "text": {
105
+ "type": "string",
106
+ "description": "The completion text"
107
+ },
108
+ "index": {
109
+ "type": "integer",
110
+ "description": "Index of the choice in the array"
111
+ },
112
+ "logprobs": {
113
+ "type": ["object", "null"],
114
+ "description": "Log probabilities of tokens"
115
+ },
116
+ "finish_reason": {
117
+ "type": ["string", "null"],
118
+ "description": "Reason why the completion finished"
119
+ }
120
+ }
121
+ }
122
+ },
123
+ "model": {
124
+ "type": "string",
125
+ "description": "The model used for completion"
126
+ },
127
+ "system_fingerprint": {
128
+ "type": "string",
129
+ "description": "Fingerprint of the system configuration"
130
+ }
131
+ },
132
+ "additionalProperties": true
133
+ },
134
+ "AgentExecutionStatus": {
135
+ "type": "string",
136
+ "enum": ["success", "failed", "cancelled", "timeout"],
137
+ "description": "Status of the agent execution"
138
+ }
139
+ },
140
+ "type": "object",
141
+ "description": "Agent execution response containing input, output, and execution metadata",
142
+ "properties": {
143
+ "id": {
144
+ "type": "string",
145
+ "description": "Unique identifier for the execution response"
146
+ },
147
+ "input": {
148
+ "type": "object",
149
+ "description": "Input provided to the agent",
150
+ "additionalProperties": true
151
+ },
152
+ "expected_output": {
153
+ "type": ["string", "null"],
154
+ "description": "Expected output for evaluation purposes"
155
+ },
156
+ "status": {
157
+ "$ref": "#/definitions/AgentExecutionStatus",
158
+ "description": "Status of the agent execution"
159
+ },
160
+ "result": {
161
+ "oneOf": [
162
+ { "$ref": "#/definitions/NonStreamResponse" },
163
+ { "$ref": "#/definitions/StreamResponse" }
164
+ ],
165
+ "description": "Result of the agent execution"
166
+ },
167
+ "created_at": {
168
+ "type": "string",
169
+ "format": "date-time",
170
+ "description": "Timestamp when the execution was created"
171
+ },
172
+ "error": {
173
+ "type": ["string", "null"],
174
+ "description": "Error message if execution failed"
175
+ },
176
+ "message": {
177
+ "type": ["string", "null"],
178
+ "description": "Additional message about the execution"
179
+ },
180
+ "metadata": {
181
+ "type": "object",
182
+ "description": "Additional metadata about the execution",
183
+ "additionalProperties": true
184
+ }
185
+ },
186
+ "required": ["id", "input", "status", "result", "created_at"],
187
+ "additionalProperties": false
188
+ }