kubiya-control-plane-api 0.1.0__py3-none-any.whl → 0.3.4__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.
Potentially problematic release.
This version of kubiya-control-plane-api might be problematic. Click here for more details.
- control_plane_api/README.md +266 -0
- control_plane_api/__init__.py +0 -0
- control_plane_api/__version__.py +1 -0
- control_plane_api/alembic/README +1 -0
- control_plane_api/alembic/env.py +98 -0
- control_plane_api/alembic/script.py.mako +28 -0
- control_plane_api/alembic/versions/1382bec74309_initial_migration_with_all_models.py +251 -0
- control_plane_api/alembic/versions/1f54bc2a37e3_add_analytics_tables.py +162 -0
- control_plane_api/alembic/versions/2e4cb136dc10_rename_toolset_ids_to_skill_ids_in_teams.py +30 -0
- control_plane_api/alembic/versions/31cd69a644ce_add_skill_templates_table.py +28 -0
- control_plane_api/alembic/versions/89e127caa47d_add_jobs_and_job_executions_tables.py +161 -0
- control_plane_api/alembic/versions/add_llm_models_table.py +51 -0
- control_plane_api/alembic/versions/b0e10697f212_add_runtime_column_to_teams_simple.py +42 -0
- control_plane_api/alembic/versions/ce43b24b63bf_add_execution_trigger_source_and_fix_.py +155 -0
- control_plane_api/alembic/versions/d4eaf16e3f8d_rename_toolsets_to_skills.py +84 -0
- control_plane_api/alembic/versions/efa2dc427da1_rename_metadata_to_custom_metadata.py +32 -0
- control_plane_api/alembic/versions/f973b431d1ce_add_workflow_executor_to_skill_types.py +44 -0
- control_plane_api/alembic.ini +148 -0
- control_plane_api/api/index.py +12 -0
- control_plane_api/app/__init__.py +11 -0
- control_plane_api/app/activities/__init__.py +20 -0
- control_plane_api/app/activities/agent_activities.py +379 -0
- control_plane_api/app/activities/team_activities.py +410 -0
- control_plane_api/app/activities/temporal_cloud_activities.py +577 -0
- control_plane_api/app/config/__init__.py +35 -0
- control_plane_api/app/config/api_config.py +354 -0
- control_plane_api/app/config/model_pricing.py +318 -0
- control_plane_api/app/config.py +95 -0
- control_plane_api/app/database.py +135 -0
- control_plane_api/app/exceptions.py +408 -0
- control_plane_api/app/lib/__init__.py +11 -0
- control_plane_api/app/lib/job_executor.py +312 -0
- control_plane_api/app/lib/kubiya_client.py +235 -0
- control_plane_api/app/lib/litellm_pricing.py +166 -0
- control_plane_api/app/lib/planning_tools/__init__.py +22 -0
- control_plane_api/app/lib/planning_tools/agents.py +155 -0
- control_plane_api/app/lib/planning_tools/base.py +189 -0
- control_plane_api/app/lib/planning_tools/environments.py +214 -0
- control_plane_api/app/lib/planning_tools/resources.py +240 -0
- control_plane_api/app/lib/planning_tools/teams.py +198 -0
- control_plane_api/app/lib/policy_enforcer_client.py +939 -0
- control_plane_api/app/lib/redis_client.py +436 -0
- control_plane_api/app/lib/supabase.py +71 -0
- control_plane_api/app/lib/temporal_client.py +138 -0
- control_plane_api/app/lib/validation/__init__.py +20 -0
- control_plane_api/app/lib/validation/runtime_validation.py +287 -0
- control_plane_api/app/main.py +128 -0
- control_plane_api/app/middleware/__init__.py +8 -0
- control_plane_api/app/middleware/auth.py +513 -0
- control_plane_api/app/middleware/exception_handler.py +267 -0
- control_plane_api/app/middleware/rate_limiting.py +384 -0
- control_plane_api/app/middleware/request_id.py +202 -0
- control_plane_api/app/models/__init__.py +27 -0
- control_plane_api/app/models/agent.py +79 -0
- control_plane_api/app/models/analytics.py +206 -0
- control_plane_api/app/models/associations.py +81 -0
- control_plane_api/app/models/environment.py +63 -0
- control_plane_api/app/models/execution.py +93 -0
- control_plane_api/app/models/job.py +179 -0
- control_plane_api/app/models/llm_model.py +75 -0
- control_plane_api/app/models/presence.py +49 -0
- control_plane_api/app/models/project.py +47 -0
- control_plane_api/app/models/session.py +38 -0
- control_plane_api/app/models/team.py +66 -0
- control_plane_api/app/models/workflow.py +55 -0
- control_plane_api/app/policies/README.md +121 -0
- control_plane_api/app/policies/approved_users.rego +62 -0
- control_plane_api/app/policies/business_hours.rego +51 -0
- control_plane_api/app/policies/rate_limiting.rego +100 -0
- control_plane_api/app/policies/tool_restrictions.rego +86 -0
- control_plane_api/app/routers/__init__.py +4 -0
- control_plane_api/app/routers/agents.py +364 -0
- control_plane_api/app/routers/agents_v2.py +1260 -0
- control_plane_api/app/routers/analytics.py +1014 -0
- control_plane_api/app/routers/context_manager.py +562 -0
- control_plane_api/app/routers/environment_context.py +270 -0
- control_plane_api/app/routers/environments.py +715 -0
- control_plane_api/app/routers/execution_environment.py +517 -0
- control_plane_api/app/routers/executions.py +1911 -0
- control_plane_api/app/routers/health.py +92 -0
- control_plane_api/app/routers/health_v2.py +326 -0
- control_plane_api/app/routers/integrations.py +274 -0
- control_plane_api/app/routers/jobs.py +1344 -0
- control_plane_api/app/routers/models.py +82 -0
- control_plane_api/app/routers/models_v2.py +361 -0
- control_plane_api/app/routers/policies.py +639 -0
- control_plane_api/app/routers/presence.py +234 -0
- control_plane_api/app/routers/projects.py +902 -0
- control_plane_api/app/routers/runners.py +379 -0
- control_plane_api/app/routers/runtimes.py +172 -0
- control_plane_api/app/routers/secrets.py +155 -0
- control_plane_api/app/routers/skills.py +1001 -0
- control_plane_api/app/routers/skills_definitions.py +140 -0
- control_plane_api/app/routers/task_planning.py +1256 -0
- control_plane_api/app/routers/task_queues.py +654 -0
- control_plane_api/app/routers/team_context.py +270 -0
- control_plane_api/app/routers/teams.py +1400 -0
- control_plane_api/app/routers/worker_queues.py +1545 -0
- control_plane_api/app/routers/workers.py +935 -0
- control_plane_api/app/routers/workflows.py +204 -0
- control_plane_api/app/runtimes/__init__.py +6 -0
- control_plane_api/app/runtimes/validation.py +344 -0
- control_plane_api/app/schemas/job_schemas.py +295 -0
- control_plane_api/app/services/__init__.py +1 -0
- control_plane_api/app/services/agno_service.py +619 -0
- control_plane_api/app/services/litellm_service.py +190 -0
- control_plane_api/app/services/policy_service.py +525 -0
- control_plane_api/app/services/temporal_cloud_provisioning.py +150 -0
- control_plane_api/app/skills/__init__.py +44 -0
- control_plane_api/app/skills/base.py +229 -0
- control_plane_api/app/skills/business_intelligence.py +189 -0
- control_plane_api/app/skills/data_visualization.py +154 -0
- control_plane_api/app/skills/docker.py +104 -0
- control_plane_api/app/skills/file_generation.py +94 -0
- control_plane_api/app/skills/file_system.py +110 -0
- control_plane_api/app/skills/python.py +92 -0
- control_plane_api/app/skills/registry.py +65 -0
- control_plane_api/app/skills/shell.py +102 -0
- control_plane_api/app/skills/workflow_executor.py +469 -0
- control_plane_api/app/utils/workflow_executor.py +354 -0
- control_plane_api/app/workflows/__init__.py +11 -0
- control_plane_api/app/workflows/agent_execution.py +507 -0
- control_plane_api/app/workflows/agent_execution_with_skills.py +222 -0
- control_plane_api/app/workflows/namespace_provisioning.py +326 -0
- control_plane_api/app/workflows/team_execution.py +399 -0
- control_plane_api/scripts/seed_models.py +239 -0
- control_plane_api/worker/__init__.py +0 -0
- control_plane_api/worker/activities/__init__.py +0 -0
- control_plane_api/worker/activities/agent_activities.py +1241 -0
- control_plane_api/worker/activities/approval_activities.py +234 -0
- control_plane_api/worker/activities/runtime_activities.py +388 -0
- control_plane_api/worker/activities/skill_activities.py +267 -0
- control_plane_api/worker/activities/team_activities.py +1217 -0
- control_plane_api/worker/config/__init__.py +31 -0
- control_plane_api/worker/config/worker_config.py +275 -0
- control_plane_api/worker/control_plane_client.py +529 -0
- control_plane_api/worker/examples/analytics_integration_example.py +362 -0
- control_plane_api/worker/models/__init__.py +1 -0
- control_plane_api/worker/models/inputs.py +89 -0
- control_plane_api/worker/runtimes/__init__.py +31 -0
- control_plane_api/worker/runtimes/base.py +789 -0
- control_plane_api/worker/runtimes/claude_code_runtime.py +1443 -0
- control_plane_api/worker/runtimes/default_runtime.py +617 -0
- control_plane_api/worker/runtimes/factory.py +173 -0
- control_plane_api/worker/runtimes/validation.py +93 -0
- control_plane_api/worker/services/__init__.py +1 -0
- control_plane_api/worker/services/agent_executor.py +422 -0
- control_plane_api/worker/services/agent_executor_v2.py +383 -0
- control_plane_api/worker/services/analytics_collector.py +457 -0
- control_plane_api/worker/services/analytics_service.py +464 -0
- control_plane_api/worker/services/approval_tools.py +310 -0
- control_plane_api/worker/services/approval_tools_agno.py +207 -0
- control_plane_api/worker/services/cancellation_manager.py +177 -0
- control_plane_api/worker/services/data_visualization.py +827 -0
- control_plane_api/worker/services/jira_tools.py +257 -0
- control_plane_api/worker/services/runtime_analytics.py +328 -0
- control_plane_api/worker/services/session_service.py +194 -0
- control_plane_api/worker/services/skill_factory.py +175 -0
- control_plane_api/worker/services/team_executor.py +574 -0
- control_plane_api/worker/services/team_executor_v2.py +465 -0
- control_plane_api/worker/services/workflow_executor_tools.py +1418 -0
- control_plane_api/worker/tests/__init__.py +1 -0
- control_plane_api/worker/tests/e2e/__init__.py +0 -0
- control_plane_api/worker/tests/e2e/test_execution_flow.py +571 -0
- control_plane_api/worker/tests/integration/__init__.py +0 -0
- control_plane_api/worker/tests/integration/test_control_plane_integration.py +308 -0
- control_plane_api/worker/tests/unit/__init__.py +0 -0
- control_plane_api/worker/tests/unit/test_control_plane_client.py +401 -0
- control_plane_api/worker/utils/__init__.py +1 -0
- control_plane_api/worker/utils/chunk_batcher.py +305 -0
- control_plane_api/worker/utils/retry_utils.py +60 -0
- control_plane_api/worker/utils/streaming_utils.py +373 -0
- control_plane_api/worker/worker.py +753 -0
- control_plane_api/worker/workflows/__init__.py +0 -0
- control_plane_api/worker/workflows/agent_execution.py +589 -0
- control_plane_api/worker/workflows/team_execution.py +429 -0
- kubiya_control_plane_api-0.3.4.dist-info/METADATA +229 -0
- kubiya_control_plane_api-0.3.4.dist-info/RECORD +182 -0
- kubiya_control_plane_api-0.3.4.dist-info/entry_points.txt +2 -0
- kubiya_control_plane_api-0.3.4.dist-info/top_level.txt +1 -0
- kubiya_control_plane_api-0.1.0.dist-info/METADATA +0 -66
- kubiya_control_plane_api-0.1.0.dist-info/RECORD +0 -5
- kubiya_control_plane_api-0.1.0.dist-info/top_level.txt +0 -1
- {kubiya_control_plane_api-0.1.0.dist-info/licenses → control_plane_api}/LICENSE +0 -0
- {kubiya_control_plane_api-0.1.0.dist-info → kubiya_control_plane_api-0.3.4.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Pydantic schemas for Jobs API.
|
|
3
|
+
|
|
4
|
+
This module defines request/response schemas for the Jobs CRUD API.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from pydantic import BaseModel, Field, field_validator, model_validator
|
|
8
|
+
from typing import Optional, Dict, List, Any
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
from croniter import croniter
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ExecutionEnvironment(BaseModel):
|
|
14
|
+
"""Execution environment configuration for jobs"""
|
|
15
|
+
env_vars: Dict[str, str] = Field(default_factory=dict, description="Environment variables (key-value pairs)")
|
|
16
|
+
secrets: List[str] = Field(default_factory=list, description="Secret names from Kubiya vault")
|
|
17
|
+
integration_ids: List[str] = Field(default_factory=list, description="Integration UUIDs for delegated credentials")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class JobCreate(BaseModel):
|
|
21
|
+
"""Schema for creating a new job"""
|
|
22
|
+
name: str = Field(..., description="Job name", min_length=1, max_length=255)
|
|
23
|
+
description: Optional[str] = Field(None, description="Job description")
|
|
24
|
+
enabled: bool = Field(True, description="Whether the job is enabled")
|
|
25
|
+
|
|
26
|
+
# Trigger configuration
|
|
27
|
+
trigger_type: str = Field(..., description="Trigger type: 'cron', 'webhook', or 'manual'")
|
|
28
|
+
|
|
29
|
+
# Cron configuration (required if trigger_type is 'cron')
|
|
30
|
+
cron_schedule: Optional[str] = Field(None, description="Cron expression (e.g., '0 17 * * *' for daily at 5pm)")
|
|
31
|
+
cron_timezone: Optional[str] = Field("UTC", description="Timezone for cron schedule (e.g., 'America/New_York')")
|
|
32
|
+
|
|
33
|
+
# Planning and execution configuration
|
|
34
|
+
planning_mode: str = Field(
|
|
35
|
+
default="predefined_agent",
|
|
36
|
+
description="Planning mode: 'on_the_fly', 'predefined_agent', 'predefined_team', or 'predefined_workflow'"
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Entity to execute (required for predefined modes)
|
|
40
|
+
entity_type: Optional[str] = Field(None, description="Entity type: 'agent', 'team', or 'workflow'")
|
|
41
|
+
entity_id: Optional[str] = Field(None, description="Entity ID (agent_id, team_id, or workflow_id)")
|
|
42
|
+
|
|
43
|
+
# Prompt configuration
|
|
44
|
+
prompt_template: str = Field(..., description="Prompt template (can include {{variables}} for dynamic params)")
|
|
45
|
+
system_prompt: Optional[str] = Field(None, description="Optional system prompt")
|
|
46
|
+
|
|
47
|
+
# Executor routing configuration
|
|
48
|
+
executor_type: str = Field(
|
|
49
|
+
default="auto",
|
|
50
|
+
description="Executor routing: 'auto', 'specific_queue', or 'environment'"
|
|
51
|
+
)
|
|
52
|
+
worker_queue_name: Optional[str] = Field(None, description="Worker queue name for 'specific_queue' executor type")
|
|
53
|
+
environment_name: Optional[str] = Field(None, description="Environment name for 'environment' executor type")
|
|
54
|
+
|
|
55
|
+
# Execution configuration
|
|
56
|
+
config: Dict[str, Any] = Field(default_factory=dict, description="Additional execution config (timeout, retry, etc.)")
|
|
57
|
+
execution_environment: Optional[ExecutionEnvironment] = Field(
|
|
58
|
+
None,
|
|
59
|
+
description="Execution environment: env vars, secrets, integrations"
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
@field_validator("trigger_type")
|
|
63
|
+
@classmethod
|
|
64
|
+
def validate_trigger_type(cls, v):
|
|
65
|
+
valid_types = ["cron", "webhook", "manual"]
|
|
66
|
+
if v not in valid_types:
|
|
67
|
+
raise ValueError(f"trigger_type must be one of {valid_types}")
|
|
68
|
+
return v
|
|
69
|
+
|
|
70
|
+
@field_validator("planning_mode")
|
|
71
|
+
@classmethod
|
|
72
|
+
def validate_planning_mode(cls, v):
|
|
73
|
+
valid_modes = ["on_the_fly", "predefined_agent", "predefined_team", "predefined_workflow"]
|
|
74
|
+
if v not in valid_modes:
|
|
75
|
+
raise ValueError(f"planning_mode must be one of {valid_modes}")
|
|
76
|
+
return v
|
|
77
|
+
|
|
78
|
+
@field_validator("executor_type")
|
|
79
|
+
@classmethod
|
|
80
|
+
def validate_executor_type(cls, v):
|
|
81
|
+
valid_types = ["auto", "specific_queue", "environment"]
|
|
82
|
+
if v not in valid_types:
|
|
83
|
+
raise ValueError(f"executor_type must be one of {valid_types}")
|
|
84
|
+
return v
|
|
85
|
+
|
|
86
|
+
@field_validator("cron_schedule")
|
|
87
|
+
@classmethod
|
|
88
|
+
def validate_cron_schedule(cls, v):
|
|
89
|
+
if v is not None:
|
|
90
|
+
# Validate cron expression
|
|
91
|
+
try:
|
|
92
|
+
croniter(v)
|
|
93
|
+
except Exception as e:
|
|
94
|
+
raise ValueError(f"Invalid cron expression: {str(e)}")
|
|
95
|
+
return v
|
|
96
|
+
|
|
97
|
+
@model_validator(mode='after')
|
|
98
|
+
def validate_cross_field_dependencies(self):
|
|
99
|
+
# Validate cron_schedule required for cron trigger
|
|
100
|
+
if self.trigger_type == "cron" and not self.cron_schedule:
|
|
101
|
+
raise ValueError("cron_schedule is required when trigger_type is 'cron'")
|
|
102
|
+
|
|
103
|
+
# Validate entity_id required for predefined modes
|
|
104
|
+
if self.planning_mode in ["predefined_agent", "predefined_team", "predefined_workflow"] and not self.entity_id:
|
|
105
|
+
raise ValueError(f"entity_id is required when planning_mode is '{self.planning_mode}'")
|
|
106
|
+
|
|
107
|
+
# Validate worker_queue_name for specific_queue executor
|
|
108
|
+
if self.executor_type == "specific_queue" and not self.worker_queue_name:
|
|
109
|
+
raise ValueError("worker_queue_name is required when executor_type is 'specific_queue'")
|
|
110
|
+
|
|
111
|
+
# Validate environment_name for environment executor
|
|
112
|
+
if self.executor_type == "environment" and not self.environment_name:
|
|
113
|
+
raise ValueError("environment_name is required when executor_type is 'environment'")
|
|
114
|
+
|
|
115
|
+
return self
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class JobUpdate(BaseModel):
|
|
119
|
+
"""Schema for updating an existing job"""
|
|
120
|
+
name: Optional[str] = Field(None, min_length=1, max_length=255)
|
|
121
|
+
description: Optional[str] = None
|
|
122
|
+
enabled: Optional[bool] = None
|
|
123
|
+
|
|
124
|
+
# Trigger configuration
|
|
125
|
+
trigger_type: Optional[str] = None
|
|
126
|
+
cron_schedule: Optional[str] = None
|
|
127
|
+
cron_timezone: Optional[str] = None
|
|
128
|
+
|
|
129
|
+
# Planning and execution configuration
|
|
130
|
+
planning_mode: Optional[str] = None
|
|
131
|
+
entity_type: Optional[str] = None
|
|
132
|
+
entity_id: Optional[str] = None
|
|
133
|
+
|
|
134
|
+
# Prompt configuration
|
|
135
|
+
prompt_template: Optional[str] = None
|
|
136
|
+
system_prompt: Optional[str] = None
|
|
137
|
+
|
|
138
|
+
# Executor routing configuration
|
|
139
|
+
executor_type: Optional[str] = None
|
|
140
|
+
worker_queue_name: Optional[str] = None
|
|
141
|
+
environment_name: Optional[str] = None
|
|
142
|
+
|
|
143
|
+
# Execution configuration
|
|
144
|
+
config: Optional[Dict[str, Any]] = None
|
|
145
|
+
execution_environment: Optional[ExecutionEnvironment] = None
|
|
146
|
+
|
|
147
|
+
@field_validator("trigger_type")
|
|
148
|
+
@classmethod
|
|
149
|
+
def validate_trigger_type(cls, v):
|
|
150
|
+
if v is not None:
|
|
151
|
+
valid_types = ["cron", "webhook", "manual"]
|
|
152
|
+
if v not in valid_types:
|
|
153
|
+
raise ValueError(f"trigger_type must be one of {valid_types}")
|
|
154
|
+
return v
|
|
155
|
+
|
|
156
|
+
@field_validator("planning_mode")
|
|
157
|
+
@classmethod
|
|
158
|
+
def validate_planning_mode(cls, v):
|
|
159
|
+
if v is not None:
|
|
160
|
+
valid_modes = ["on_the_fly", "predefined_agent", "predefined_team", "predefined_workflow"]
|
|
161
|
+
if v not in valid_modes:
|
|
162
|
+
raise ValueError(f"planning_mode must be one of {valid_modes}")
|
|
163
|
+
return v
|
|
164
|
+
|
|
165
|
+
@field_validator("executor_type")
|
|
166
|
+
@classmethod
|
|
167
|
+
def validate_executor_type(cls, v):
|
|
168
|
+
if v is not None:
|
|
169
|
+
valid_types = ["auto", "specific_queue", "environment"]
|
|
170
|
+
if v not in valid_types:
|
|
171
|
+
raise ValueError(f"executor_type must be one of {valid_types}")
|
|
172
|
+
return v
|
|
173
|
+
|
|
174
|
+
@field_validator("cron_schedule")
|
|
175
|
+
@classmethod
|
|
176
|
+
def validate_cron_schedule(cls, v):
|
|
177
|
+
if v is not None:
|
|
178
|
+
try:
|
|
179
|
+
croniter(v)
|
|
180
|
+
except Exception as e:
|
|
181
|
+
raise ValueError(f"Invalid cron expression: {str(e)}")
|
|
182
|
+
return v
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
class JobResponse(BaseModel):
|
|
186
|
+
"""Schema for job response"""
|
|
187
|
+
id: str
|
|
188
|
+
organization_id: str
|
|
189
|
+
name: str
|
|
190
|
+
description: Optional[str]
|
|
191
|
+
enabled: bool
|
|
192
|
+
status: str
|
|
193
|
+
|
|
194
|
+
# Trigger configuration
|
|
195
|
+
trigger_type: str
|
|
196
|
+
cron_schedule: Optional[str]
|
|
197
|
+
cron_timezone: Optional[str]
|
|
198
|
+
webhook_url: Optional[str] = Field(None, description="Full webhook URL (generated from webhook_url_path)")
|
|
199
|
+
webhook_secret: Optional[str] = Field(None, description="Webhook HMAC secret for signature verification")
|
|
200
|
+
temporal_schedule_id: Optional[str]
|
|
201
|
+
|
|
202
|
+
# Planning and execution configuration
|
|
203
|
+
planning_mode: str
|
|
204
|
+
entity_type: Optional[str]
|
|
205
|
+
entity_id: Optional[str]
|
|
206
|
+
entity_name: Optional[str]
|
|
207
|
+
|
|
208
|
+
# Prompt configuration
|
|
209
|
+
prompt_template: str
|
|
210
|
+
system_prompt: Optional[str]
|
|
211
|
+
|
|
212
|
+
# Executor routing configuration
|
|
213
|
+
executor_type: str
|
|
214
|
+
worker_queue_name: Optional[str]
|
|
215
|
+
environment_name: Optional[str]
|
|
216
|
+
|
|
217
|
+
# Execution configuration
|
|
218
|
+
config: Dict[str, Any]
|
|
219
|
+
execution_environment: Optional[ExecutionEnvironment]
|
|
220
|
+
|
|
221
|
+
# Execution tracking
|
|
222
|
+
last_execution_id: Optional[str]
|
|
223
|
+
last_execution_at: Optional[datetime]
|
|
224
|
+
next_execution_at: Optional[datetime]
|
|
225
|
+
total_executions: int
|
|
226
|
+
successful_executions: int
|
|
227
|
+
failed_executions: int
|
|
228
|
+
execution_history: List[Dict[str, Any]]
|
|
229
|
+
|
|
230
|
+
# Audit fields
|
|
231
|
+
created_by: Optional[str]
|
|
232
|
+
updated_by: Optional[str]
|
|
233
|
+
|
|
234
|
+
# Timestamps
|
|
235
|
+
created_at: datetime
|
|
236
|
+
updated_at: datetime
|
|
237
|
+
last_triggered_at: Optional[datetime]
|
|
238
|
+
|
|
239
|
+
class Config:
|
|
240
|
+
from_attributes = True
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class JobTriggerRequest(BaseModel):
|
|
244
|
+
"""Schema for manually triggering a job"""
|
|
245
|
+
parameters: Dict[str, Any] = Field(
|
|
246
|
+
default_factory=dict,
|
|
247
|
+
description="Parameters to substitute in prompt template (e.g., {{param_name}})"
|
|
248
|
+
)
|
|
249
|
+
config_override: Optional[Dict[str, Any]] = Field(
|
|
250
|
+
None,
|
|
251
|
+
description="Optional config overrides for this execution"
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class JobTriggerResponse(BaseModel):
|
|
256
|
+
"""Schema for job trigger response"""
|
|
257
|
+
job_id: str
|
|
258
|
+
execution_id: str
|
|
259
|
+
workflow_id: str
|
|
260
|
+
status: str
|
|
261
|
+
message: str
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
class JobExecutionHistoryItem(BaseModel):
|
|
265
|
+
"""Schema for a single job execution history item"""
|
|
266
|
+
execution_id: str
|
|
267
|
+
trigger_type: str
|
|
268
|
+
status: str
|
|
269
|
+
started_at: Optional[datetime]
|
|
270
|
+
completed_at: Optional[datetime]
|
|
271
|
+
duration_ms: Optional[int]
|
|
272
|
+
error_message: Optional[str]
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class JobExecutionHistoryResponse(BaseModel):
|
|
276
|
+
"""Schema for job execution history response"""
|
|
277
|
+
job_id: str
|
|
278
|
+
total_count: int
|
|
279
|
+
executions: List[JobExecutionHistoryItem]
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
class WebhookPayload(BaseModel):
|
|
283
|
+
"""Schema for webhook trigger payload"""
|
|
284
|
+
parameters: Dict[str, Any] = Field(
|
|
285
|
+
default_factory=dict,
|
|
286
|
+
description="Parameters to substitute in prompt template"
|
|
287
|
+
)
|
|
288
|
+
config_override: Optional[Dict[str, Any]] = Field(
|
|
289
|
+
None,
|
|
290
|
+
description="Optional config overrides for this execution"
|
|
291
|
+
)
|
|
292
|
+
metadata: Optional[Dict[str, Any]] = Field(
|
|
293
|
+
None,
|
|
294
|
+
description="Additional metadata for this webhook trigger"
|
|
295
|
+
)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Services
|