agentops-rpc 0.7.1__tar.gz → 0.7.2__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.
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/PKG-INFO +1 -1
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/pyproject.toml +1 -1
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/__init__.py +14 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/agent_create.py +26 -5
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/agent_settings.py +3 -3
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/agents.py +3 -1
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/deployment.py +28 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/hosted_agents.py +10 -6
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/worker_catalog.py +2 -2
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/eval/grader.py +19 -1
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/runs.py +12 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/types.py +26 -1
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/wire/koperator.py +96 -10
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc.egg-info/PKG-INFO +1 -1
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_agent_create_models.py +28 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_criterion_definition.py +8 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_hosted_agent_scaling_models.py +10 -2
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/LICENSE +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/README.md +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/setup.cfg +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/capabilities.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/constants.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/roster.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/run_settings.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/skill_resource.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/tools.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/triggers.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/agents/types.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/base/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/base/build_stamp.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/base/protocol.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/config/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/config/worker_config.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/cost/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/cost/budgets.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/cost/usage.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/eval/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/eval/kb_pages.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/eval/knowledge_base.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/eval/quality.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/eval/scores.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/gateway/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/gateway/alerts.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/gateway/schedules.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/gateway/triggers.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/identity/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/identity/credentials.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/identity/integrations.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/incidents/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/incidents/insights.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/incidents/issues.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/memory/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/memory/agent/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/memory/agent/worker.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/model/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/model/discovery.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/model/gateway.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/onboarding/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/onboarding/checklist.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/rules/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/rules/types.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/a2a.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/artifacts.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/capture.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/events.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/replay.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/security.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/session.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/runs/titles.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/wire/__init__.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/wire/frame_registry.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/wire/frames.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/wire/koperator_contract.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/wire/outpost.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/wire/outpost_contract.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/wire/outpost_fingerprint.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc/wire/resolve.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc.egg-info/SOURCES.txt +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc.egg-info/dependency_links.txt +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc.egg-info/requires.txt +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/src/agentops_rpc.egg-info/top_level.txt +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_agent_tools.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_agent_version.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_build_stamp.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_call_usage.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_domain_layout.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_frame_schema.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_hosted_agent_mcp_servers.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_integrations_schemas.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_koperator_contract.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_label_rules.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_outpost_contract.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_pair_grader_models.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_platform_base_evaluator.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_replay_models.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_run_titles.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_security_signals.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_use_case_model.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_worker_catalog_schema.py +0 -0
- {agentops_rpc-0.7.1 → agentops_rpc-0.7.2}/tests/test_worker_config_ops.py +0 -0
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
3
|
from .agents.agent_create import (
|
|
4
|
+
OBSERVE_ONLY_CLIENT,
|
|
4
5
|
CreateAgentAutoscaling,
|
|
5
6
|
CreateAgentCapabilities,
|
|
6
7
|
CreateAgentKedaAutoscaling,
|
|
@@ -11,6 +12,7 @@ from .agents.agent_create import (
|
|
|
11
12
|
CreateAgentSkillRef,
|
|
12
13
|
CreateWorkerTokenRequest,
|
|
13
14
|
CreateWorkerTokenResponse,
|
|
15
|
+
ObserveOnlyConnect,
|
|
14
16
|
WorkerTokenStatusResponse,
|
|
15
17
|
WorkerTokenSummaryResponse,
|
|
16
18
|
)
|
|
@@ -125,7 +127,9 @@ from .agents.deployment import (
|
|
|
125
127
|
AgentDeploymentCheckResponse,
|
|
126
128
|
AgentDeploymentResponse,
|
|
127
129
|
AgentDeploymentSpec,
|
|
130
|
+
BypassRevision,
|
|
128
131
|
DeploymentChange,
|
|
132
|
+
DeploymentConflictCode,
|
|
129
133
|
DeploymentSource,
|
|
130
134
|
DeployRefusalCode,
|
|
131
135
|
DeployWarning,
|
|
@@ -133,6 +137,7 @@ from .agents.deployment import (
|
|
|
133
137
|
PendingDeploymentChange,
|
|
134
138
|
PutAgentDeploymentRequest,
|
|
135
139
|
QuotaResource,
|
|
140
|
+
RevisionRequiredRefusal,
|
|
136
141
|
SavedConfigState,
|
|
137
142
|
)
|
|
138
143
|
from .agents.hosted_agents import (
|
|
@@ -432,6 +437,7 @@ from .runs.runs import (
|
|
|
432
437
|
RUN_ORIGIN_SURFACE_KEY,
|
|
433
438
|
RUN_OUTPUT_SCHEMA_KEY,
|
|
434
439
|
RUN_OUTPUT_VALIDATION_KEY,
|
|
440
|
+
RUN_PROMPT_CACHE_KEY,
|
|
435
441
|
RUN_PROMPT_LAYERS_APPLIED_DIAGNOSTIC,
|
|
436
442
|
RUN_REPLAY_INPUT_KEY,
|
|
437
443
|
RUN_REPLAY_METADATA_KEY,
|
|
@@ -466,6 +472,7 @@ from .runs.runs import (
|
|
|
466
472
|
RunOrigin,
|
|
467
473
|
RunOriginRefs,
|
|
468
474
|
RunOrigins,
|
|
475
|
+
RunPromptCache,
|
|
469
476
|
RunSkipReason,
|
|
470
477
|
RunSummary,
|
|
471
478
|
RunUsage,
|
|
@@ -596,6 +603,8 @@ __all__ = [
|
|
|
596
603
|
"RUN_DIAGNOSTICS_KEY",
|
|
597
604
|
"RUN_ORIGIN_SURFACE_KEY",
|
|
598
605
|
"RUN_OUTPUT_SCHEMA_KEY",
|
|
606
|
+
"RUN_PROMPT_CACHE_KEY",
|
|
607
|
+
"RunPromptCache",
|
|
599
608
|
"RUN_UNTRUSTED_CONTENT_KEY",
|
|
600
609
|
"MAX_SECURITY_SIGNALS",
|
|
601
610
|
"SECURITY_SIGNALS_OUTPUT_KEY",
|
|
@@ -655,6 +664,8 @@ __all__ = [
|
|
|
655
664
|
"CreateAgentMcpServer",
|
|
656
665
|
"CreateAgentRequest",
|
|
657
666
|
"CreateAgentResponse",
|
|
667
|
+
"OBSERVE_ONLY_CLIENT",
|
|
668
|
+
"ObserveOnlyConnect",
|
|
658
669
|
"CreateAgentSkill",
|
|
659
670
|
"CreateAgentSkillRef",
|
|
660
671
|
"CreateAgentTrigger",
|
|
@@ -974,7 +985,9 @@ __all__ = [
|
|
|
974
985
|
"AdoptionRefusal",
|
|
975
986
|
"AgentDeploymentResponse",
|
|
976
987
|
"AgentDeploymentSpec",
|
|
988
|
+
"BypassRevision",
|
|
977
989
|
"DeploymentChange",
|
|
990
|
+
"DeploymentConflictCode",
|
|
978
991
|
"DeploymentSource",
|
|
979
992
|
"DeployRefusalCode",
|
|
980
993
|
"DeployWarning",
|
|
@@ -982,6 +995,7 @@ __all__ = [
|
|
|
982
995
|
"PendingDeploymentChange",
|
|
983
996
|
"QuotaResource",
|
|
984
997
|
"PutAgentDeploymentRequest",
|
|
998
|
+
"RevisionRequiredRefusal",
|
|
985
999
|
"SavedConfigState",
|
|
986
1000
|
"AdoptAgentRequest",
|
|
987
1001
|
]
|
|
@@ -200,7 +200,7 @@ class RuntimeMode(StrEnum):
|
|
|
200
200
|
|
|
201
201
|
class CreateAgentRequest(_Camel):
|
|
202
202
|
agent_id: str
|
|
203
|
-
instructions: str
|
|
203
|
+
instructions: str | None = None
|
|
204
204
|
display_name: str = ""
|
|
205
205
|
model: str = "claude-sonnet-5"
|
|
206
206
|
# Operator-declared capabilities — see CreateAgentCapabilities. Rendered into the returned
|
|
@@ -250,8 +250,8 @@ class CreateAgentRequest(_Camel):
|
|
|
250
250
|
|
|
251
251
|
@field_validator("instructions")
|
|
252
252
|
@classmethod
|
|
253
|
-
def _not_blank(cls, v: str) -> str:
|
|
254
|
-
if not v.strip():
|
|
253
|
+
def _not_blank(cls, v: str | None) -> str | None:
|
|
254
|
+
if v is not None and not v.strip():
|
|
255
255
|
raise ValueError("must not be blank")
|
|
256
256
|
return v
|
|
257
257
|
|
|
@@ -268,6 +268,12 @@ class CreateAgentRequest(_Camel):
|
|
|
268
268
|
# below and create a keyless agent with no real source binding.
|
|
269
269
|
return v.strip() if v and v.strip() else None
|
|
270
270
|
|
|
271
|
+
@model_validator(mode="after")
|
|
272
|
+
def _runtime_needs_instructions(self) -> CreateAgentRequest:
|
|
273
|
+
if self.runtime_mode is RuntimeMode.RUNTIME and self.instructions is None:
|
|
274
|
+
raise ValueError("instructions is required for a runtime agent")
|
|
275
|
+
return self
|
|
276
|
+
|
|
271
277
|
@model_validator(mode="after")
|
|
272
278
|
def _exactly_one_llm_mode(self) -> CreateAgentRequest:
|
|
273
279
|
if self.runtime_mode is RuntimeMode.OBSERVE_ONLY:
|
|
@@ -332,11 +338,26 @@ class CreateAgentRequest(_Camel):
|
|
|
332
338
|
# only force an operator migrating a fixed-replica agent to edit an unrelated field first.
|
|
333
339
|
|
|
334
340
|
|
|
341
|
+
OBSERVE_ONLY_CLIENT = "komodor_agentops.ObserveOnlyClient"
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
class ObserveOnlyConnect(BaseModel):
|
|
345
|
+
model_config = ConfigDict(populate_by_name=True)
|
|
346
|
+
|
|
347
|
+
client: str
|
|
348
|
+
# A distinct title: a third identical inline `Env` schema makes the client generator drop the other two.
|
|
349
|
+
env: dict[str, str] = Field(title="ObserveOnlyConnectEnv")
|
|
350
|
+
worker_token_hint: str = Field(serialization_alias="workerTokenHint", validation_alias="workerTokenHint")
|
|
351
|
+
expires_at: str | None = Field(default=None, serialization_alias="expiresAt", validation_alias="expiresAt")
|
|
352
|
+
|
|
353
|
+
|
|
335
354
|
class CreateAgentResponse(BaseModel):
|
|
336
355
|
model_config = ConfigDict(populate_by_name=True)
|
|
337
356
|
|
|
338
|
-
|
|
339
|
-
|
|
357
|
+
# Both are null for an observe-only agent: it has nothing to deploy, and `connect` carries its credentials.
|
|
358
|
+
command: str | None = None
|
|
359
|
+
values: str | None = None
|
|
360
|
+
connect: ObserveOnlyConnect | None = None
|
|
340
361
|
agent_id: str = Field(serialization_alias="agentId", validation_alias="agentId")
|
|
341
362
|
worker_token_hint: str = Field(serialization_alias="workerTokenHint", validation_alias="workerTokenHint")
|
|
342
363
|
expires_at: str | None = Field(default=None, serialization_alias="expiresAt", validation_alias="expiresAt")
|
|
@@ -293,7 +293,7 @@ class SelfHostedAgentDeclareRequest(_Camel):
|
|
|
293
293
|
|
|
294
294
|
|
|
295
295
|
_OBSERVE_ONLY_SETTINGS_FIELDS = frozenset({"labels", "notification_sink_ids", "time_budget_seconds", "time_limit_notification_sink_ids"})
|
|
296
|
-
_OBSERVE_ONLY_UNBIND_FIELDS = frozenset({"mcp_group_id", "mcp_server_id"})
|
|
296
|
+
_OBSERVE_ONLY_UNBIND_FIELDS = frozenset({"mcp_group_id", "mcp_server_id", "outpost_id", "worker_allowlist"})
|
|
297
297
|
|
|
298
298
|
|
|
299
299
|
def observe_only_refused_settings_fields(settings: AgentSettings | None) -> list[str]:
|
|
@@ -303,9 +303,9 @@ def observe_only_refused_settings_fields(settings: AgentSettings | None) -> list
|
|
|
303
303
|
for name in sorted(settings.model_fields_set):
|
|
304
304
|
if name in _OBSERVE_ONLY_SETTINGS_FIELDS:
|
|
305
305
|
continue
|
|
306
|
-
if name in _OBSERVE_ONLY_UNBIND_FIELDS and getattr(settings, name)
|
|
306
|
+
if name in _OBSERVE_ONLY_UNBIND_FIELDS and not getattr(settings, name):
|
|
307
307
|
continue
|
|
308
|
-
if name == "mcp_tools" and settings.mcp_tools
|
|
308
|
+
if name == "mcp_tools" and not (settings.mcp_tools or settings.mcp_server_id):
|
|
309
309
|
continue
|
|
310
310
|
refused.append(_camel(name))
|
|
311
311
|
return refused
|
|
@@ -14,7 +14,7 @@ from .agent_create import validate_agent_id, validate_one_mcp_scope
|
|
|
14
14
|
from .capabilities import AgentCardCapability
|
|
15
15
|
from .constants import MAX_FLEET_AGENT_IDS as MAX_FLEET_AGENT_IDS # re-exported: definition lives in the leaf
|
|
16
16
|
from .constants import USE_CASE_INPUT_KEY as USE_CASE_INPUT_KEY # re-exported: definition moved to a leaf
|
|
17
|
-
from .deployment import SavedConfigState
|
|
17
|
+
from .deployment import BypassRevision, SavedConfigState
|
|
18
18
|
from .run_settings import (
|
|
19
19
|
DEFAULT_HOLD_TIMEOUT_SECONDS,
|
|
20
20
|
DEFAULT_MAX_REPLICAS,
|
|
@@ -1292,6 +1292,8 @@ class UpdateSelfHostedAgentConfigRequest(BaseModel):
|
|
|
1292
1292
|
run_behaviour: RequestedRunBehaviour = None
|
|
1293
1293
|
max_replicas: RequestedMaxReplicas = None
|
|
1294
1294
|
hold_timeout_seconds: RequestedHoldTimeoutSeconds = None
|
|
1295
|
+
# A break-glass edit of the LLM choice of an agent on a `revision_required` target: needs `agent_deploy_target.promote` there.
|
|
1296
|
+
bypass_revision: BypassRevision | None = None
|
|
1295
1297
|
|
|
1296
1298
|
@model_validator(mode="after")
|
|
1297
1299
|
def _one_mcp_scope(self) -> UpdateSelfHostedAgentConfigRequest:
|
|
@@ -119,6 +119,7 @@ class DeploymentAgentValues(_ChartValues):
|
|
|
119
119
|
labels: dict[str, str] | None = Field(default=None, title="Deployment Agent Labels")
|
|
120
120
|
instructions: str | None = None
|
|
121
121
|
instructions_filename: str | None = None
|
|
122
|
+
judge_rules: str | None = None
|
|
122
123
|
skills: list[dict[str, Any]] | None = None
|
|
123
124
|
agents: list[dict[str, Any]] | None = None
|
|
124
125
|
mcp_servers: list[dict[str, Any]] | None = None
|
|
@@ -181,6 +182,19 @@ class SavedConfigState(StrEnum):
|
|
|
181
182
|
UNKNOWN = "unknown"
|
|
182
183
|
|
|
183
184
|
|
|
185
|
+
class BypassRevision(BaseModel):
|
|
186
|
+
model_config = ConfigDict(extra="forbid")
|
|
187
|
+
|
|
188
|
+
# Why the change cannot wait for a revision; stored in the audit record.
|
|
189
|
+
reason: str = Field(..., min_length=1, max_length=1000)
|
|
190
|
+
|
|
191
|
+
@model_validator(mode="after")
|
|
192
|
+
def _reason_not_blank(self) -> BypassRevision:
|
|
193
|
+
if not self.reason.strip():
|
|
194
|
+
raise ValueError("reason must say why the change cannot wait for a revision")
|
|
195
|
+
return self
|
|
196
|
+
|
|
197
|
+
|
|
184
198
|
class PutAgentDeploymentRequest(BaseModel):
|
|
185
199
|
model_config = ConfigDict(extra="forbid")
|
|
186
200
|
|
|
@@ -200,6 +214,8 @@ class PutAgentDeploymentRequest(BaseModel):
|
|
|
200
214
|
action_deadline_seconds: RequestedActionDeadlineSeconds = None
|
|
201
215
|
# Set by the chat card the co-pilot proposed; the audit record names that run's agent and session.
|
|
202
216
|
copilot_run_id: str | None = Field(default=None, max_length=128)
|
|
217
|
+
# A break-glass edit on a `revision_required` target: needs `agent_deploy_target.promote` on it.
|
|
218
|
+
bypass_revision: BypassRevision | None = None
|
|
203
219
|
|
|
204
220
|
@model_validator(mode="after")
|
|
205
221
|
def _spec_matches_source(self) -> PutAgentDeploymentRequest:
|
|
@@ -211,6 +227,18 @@ class PutAgentDeploymentRequest(BaseModel):
|
|
|
211
227
|
return self
|
|
212
228
|
|
|
213
229
|
|
|
230
|
+
# `detail.code` of a 409 from `PUT .../deployment` that the target's change policy refused.
|
|
231
|
+
class DeploymentConflictCode(StrEnum):
|
|
232
|
+
REVISION_REQUIRED = "revision_required"
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
# `detail` of a 409 `revision_required`: the spec fields that need a revision on this target.
|
|
236
|
+
class RevisionRequiredRefusal(BaseModel):
|
|
237
|
+
code: Literal[DeploymentConflictCode.REVISION_REQUIRED] = DeploymentConflictCode.REVISION_REQUIRED
|
|
238
|
+
message: str
|
|
239
|
+
fields: list[str]
|
|
240
|
+
|
|
241
|
+
|
|
214
242
|
class AdoptAgentRequest(BaseModel):
|
|
215
243
|
model_config = ConfigDict(extra="forbid")
|
|
216
244
|
|
|
@@ -26,6 +26,7 @@ _INSTRUCTIONS_FILENAME_RE = re.compile(r"[A-Za-z0-9][A-Za-z0-9._-]{0,62}")
|
|
|
26
26
|
class AgentConfigKey(StrEnum):
|
|
27
27
|
MODEL = "model"
|
|
28
28
|
DISPLAY_NAME = "display_name"
|
|
29
|
+
DESCRIPTION = "description"
|
|
29
30
|
CAPABILITIES = "capabilities"
|
|
30
31
|
LABELS = "labels"
|
|
31
32
|
|
|
@@ -147,8 +148,8 @@ class HostedAgentCreateRequest(_Camel):
|
|
|
147
148
|
description: str = Field(
|
|
148
149
|
"",
|
|
149
150
|
description=(
|
|
150
|
-
"A free-text description of what the agent does,
|
|
151
|
-
"
|
|
151
|
+
"A free-text description of what the agent does, published on the agent's card, which is what rosters "
|
|
152
|
+
"and tool listings read. Changing it rolls the agent's pods."
|
|
152
153
|
),
|
|
153
154
|
)
|
|
154
155
|
instructions: str = Field(
|
|
@@ -255,13 +256,16 @@ class HostedAgentCreateRequest(_Camel):
|
|
|
255
256
|
),
|
|
256
257
|
)
|
|
257
258
|
# Always-warm floor and autoscaling ceiling. min == max is a fixed size; min < max scales on queued runs
|
|
258
|
-
# on an operator-delivered agent. max is capped by the `hosted_agent_max_replicas` flag.
|
|
259
|
+
# on an operator-delivered agent; min 0 scales to zero. max is capped by the `hosted_agent_max_replicas` flag.
|
|
259
260
|
min_replicas: int = Field(
|
|
260
261
|
default=1,
|
|
261
|
-
ge=
|
|
262
|
+
ge=0,
|
|
262
263
|
serialization_alias="minReplicas",
|
|
263
264
|
validation_alias="minReplicas",
|
|
264
|
-
description=
|
|
265
|
+
description=(
|
|
266
|
+
"The number of agent pods always kept running, no more than maxReplicas. 0 scales the agent to zero "
|
|
267
|
+
"when no runs are queued: a run then waits while a pod starts. 0 needs scale to zero enabled for the account."
|
|
268
|
+
),
|
|
265
269
|
)
|
|
266
270
|
max_replicas: int = Field(
|
|
267
271
|
default=1,
|
|
@@ -440,7 +444,7 @@ class HostedAgentUpdateRequest(_Camel):
|
|
|
440
444
|
description="A judge's rules as JSON, mounted at /etc/agentops/agent/judge.json. Set by a judge revision.",
|
|
441
445
|
)
|
|
442
446
|
# None ⇒ keep the stored value. Setting only one leaves the other as stored.
|
|
443
|
-
min_replicas: int | None = Field(default=None, ge=
|
|
447
|
+
min_replicas: int | None = Field(default=None, ge=0, serialization_alias="minReplicas", validation_alias="minReplicas")
|
|
444
448
|
max_replicas: int | None = Field(default=None, ge=1, serialization_alias="maxReplicas", validation_alias="maxReplicas")
|
|
445
449
|
replica_count: int | None = Field(
|
|
446
450
|
default=None,
|
|
@@ -269,8 +269,8 @@ class WorkerCatalogDeployRequest(_Camel):
|
|
|
269
269
|
# while the other describes the chart.
|
|
270
270
|
settings: AgentSettings | None = None
|
|
271
271
|
# Same meaning as on the hosted create: an always-warm floor and an autoscaling ceiling, unset ⇒ 1 / 1.
|
|
272
|
-
# min == max is a fixed size; min < max autoscales on queued runs.
|
|
273
|
-
min_replicas: int | None = Field(default=None, ge=
|
|
272
|
+
# min == max is a fixed size; min < max autoscales on queued runs; min 0 scales to zero (flag-gated).
|
|
273
|
+
min_replicas: int | None = Field(default=None, ge=0, serialization_alias="minReplicas", validation_alias="minReplicas")
|
|
274
274
|
max_replicas: int | None = Field(default=None, ge=1, serialization_alias="maxReplicas", validation_alias="maxReplicas")
|
|
275
275
|
|
|
276
276
|
@model_validator(mode="after")
|
|
@@ -15,6 +15,16 @@ GRADER_CUSTOM_CRITERIA_CAPABILITY = AgentCardCapability.GRADER_CUSTOM_CRITERIA.v
|
|
|
15
15
|
GRADER_RULES_FILE_CAPABILITY = AgentCardCapability.GRADER_RULES_FILE.value
|
|
16
16
|
GRADER_OUTCOME_MATCH_CAPABILITY = AgentCardCapability.GRADER_OUTCOME_MATCH.value
|
|
17
17
|
|
|
18
|
+
CRITERION_DESCRIPTION_MAX = 500
|
|
19
|
+
# The Base Evaluator puts this note and a space before a must-pass criterion's description, and the sum must fit
|
|
20
|
+
# CriterionDefinition. Set to 0 once no pinned Base Evaluator predates agentops-workers#1075.
|
|
21
|
+
MUST_PASS_NOTE = "[Must pass: if this is not met the whole grade fails.]"
|
|
22
|
+
MUST_PASS_NOTE_COST = len(MUST_PASS_NOTE) + 1
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def criterion_description_limit(*, must_pass: bool) -> int:
|
|
26
|
+
return CRITERION_DESCRIPTION_MAX - (MUST_PASS_NOTE_COST if must_pass else 0)
|
|
27
|
+
|
|
18
28
|
|
|
19
29
|
class CriterionDefinition(BaseModel):
|
|
20
30
|
name: str = Field(
|
|
@@ -24,7 +34,7 @@ class CriterionDefinition(BaseModel):
|
|
|
24
34
|
)
|
|
25
35
|
description: str = Field(
|
|
26
36
|
default="",
|
|
27
|
-
max_length=
|
|
37
|
+
max_length=CRITERION_DESCRIPTION_MAX,
|
|
28
38
|
description="What this criterion measures and how to judge it, in plain language, handed to the grader with the name.",
|
|
29
39
|
)
|
|
30
40
|
weight: int = Field(ge=1, le=100, description="How much this criterion counts toward the weighted overall score, from 1 to 100.")
|
|
@@ -61,6 +71,14 @@ class GradedRun(BaseModel):
|
|
|
61
71
|
class GradeTask(BaseModel):
|
|
62
72
|
agent_name: str | None = None
|
|
63
73
|
instructions: str | None = None
|
|
74
|
+
expected: Any = Field(
|
|
75
|
+
default=None,
|
|
76
|
+
description=(
|
|
77
|
+
"The reference the graded run is checked against, when the grade has one: a case's approved expected answer, "
|
|
78
|
+
"production's answer to the same request, or a person's review. It is never part of the graded run. "
|
|
79
|
+
"The instructions carry the same reference as text, for a grader that does not read this field."
|
|
80
|
+
),
|
|
81
|
+
)
|
|
64
82
|
criteria: list[CriterionDefinition] = Field(min_length=1)
|
|
65
83
|
runs: list[GradedRun] = Field(min_length=1, max_length=2)
|
|
66
84
|
insights_for: GradedRunLabel | None = Field(
|
|
@@ -85,6 +85,8 @@ class RunSummary(BaseModel):
|
|
|
85
85
|
stop_reason: RunStopReason | None = None
|
|
86
86
|
# The per-run spend cap copied onto the run at claim, in US dollars; None when it had none.
|
|
87
87
|
run_budget_cap_usd: float | None = None
|
|
88
|
+
# The version a self-reporting client stamped on the run; None for a run that did not report one.
|
|
89
|
+
agent_version: str | None = None
|
|
88
90
|
|
|
89
91
|
|
|
90
92
|
class CancelledRun(RunSummary):
|
|
@@ -358,6 +360,14 @@ DEDICATED_WORKER_METADATA_KEY = "dedicated_worker_id"
|
|
|
358
360
|
BENCHMARK_CASE_TOKEN_HEADER = "X-Benchmark-Case-Token"
|
|
359
361
|
|
|
360
362
|
RUN_OUTPUT_SCHEMA_KEY = "agentops_output_schema"
|
|
363
|
+
# Set on a grade run: it answers in one model call, so only the prompt's prefix is worth a cache write.
|
|
364
|
+
RUN_PROMPT_CACHE_KEY = "agentops_prompt_cache"
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
class RunPromptCache(StrEnum):
|
|
368
|
+
PREFIX = "prefix"
|
|
369
|
+
|
|
370
|
+
|
|
361
371
|
RUN_OUTPUT_VALIDATION_KEY = "agentops_output_validation"
|
|
362
372
|
# Stamped `True` by the platform when the run's account has the untrusted-content prompt section turned on; absent means off.
|
|
363
373
|
RUN_UNTRUSTED_CONTENT_KEY = "agentops_untrusted_content"
|
|
@@ -531,6 +541,8 @@ class RunDetail(BaseModel):
|
|
|
531
541
|
stop_reason: RunStopReason | None = None
|
|
532
542
|
#: See ``RunSummary.run_budget_cap_usd``.
|
|
533
543
|
run_budget_cap_usd: float | None = None
|
|
544
|
+
#: See ``RunSummary.agent_version``.
|
|
545
|
+
agent_version: str | None = None
|
|
534
546
|
#: ISO-8601 UTC time the run's time limit hard-stops it, stamped at claim; None when the run has no limit.
|
|
535
547
|
run_deadline: str | None = None
|
|
536
548
|
# True when a session snapshot exists for this run's thread, so it can be
|
|
@@ -38,6 +38,31 @@ class RunStopReason(StrEnum):
|
|
|
38
38
|
DEADLINE_EXCEEDED_IN_QUEUE = "deadline_exceeded_in_queue"
|
|
39
39
|
|
|
40
40
|
|
|
41
|
+
class RunFailureKind(StrEnum):
|
|
42
|
+
TIME_LIMIT = "time_limit"
|
|
43
|
+
BUDGET_LIMIT = "budget_limit"
|
|
44
|
+
RUN_BUDGET = "run_budget"
|
|
45
|
+
QUEUE_DEADLINE = "queue_deadline"
|
|
46
|
+
WORKER_UNREACHABLE = "worker_unreachable"
|
|
47
|
+
PROVIDER_AUTH = "provider_auth"
|
|
48
|
+
PROVIDER_BILLING = "provider_billing"
|
|
49
|
+
PROVIDER_RATE_LIMIT = "provider_rate_limit"
|
|
50
|
+
PROVIDER_TLS = "provider_tls"
|
|
51
|
+
BUDGET_BLOCKED = "budget_blocked"
|
|
52
|
+
WORKER_LOST = "worker_lost"
|
|
53
|
+
WALL_CLOCK = "wall_clock"
|
|
54
|
+
OUTPUT_INVALID = "output_invalid"
|
|
55
|
+
DEAD_LETTER = "dead_letter"
|
|
56
|
+
PARENT_FINISHED = "parent_finished"
|
|
57
|
+
CHANNEL_STOP = "channel_stop"
|
|
58
|
+
AGENT_STOPPED = "agent_stopped"
|
|
59
|
+
CANCELLED_BY_AGENT = "cancelled_by_agent"
|
|
60
|
+
CANCELLED_BY_SYSTEM = "cancelled_by_system"
|
|
61
|
+
CANCELLED_BY_USER = "cancelled_by_user"
|
|
62
|
+
CANCELLED = "cancelled"
|
|
63
|
+
AGENT_ERROR = "agent_error"
|
|
64
|
+
|
|
65
|
+
|
|
41
66
|
class RunBudgetStopper(StrEnum):
|
|
42
67
|
WORKER = "worker"
|
|
43
68
|
CONTROL_PLANE = "control_plane"
|
|
@@ -61,7 +86,7 @@ class MessageType(StrEnum):
|
|
|
61
86
|
|
|
62
87
|
|
|
63
88
|
RunTransport = Literal["polling", "api_sync", "api_sse", "a2a", "schedule"]
|
|
64
|
-
RunChannel = Literal["ui", "slack", "cron", "webhook", "api", "agent"]
|
|
89
|
+
RunChannel = Literal["ui", "slack", "msteams", "cron", "webhook", "api", "agent"]
|
|
65
90
|
|
|
66
91
|
|
|
67
92
|
class CancelSignal(StrEnum):
|
|
@@ -56,6 +56,8 @@ class ReasonCode(StrEnum):
|
|
|
56
56
|
deadline_exceeded = "deadline_exceeded"
|
|
57
57
|
drift_conflict = "drift_conflict"
|
|
58
58
|
adoption_refused = "adoption_refused"
|
|
59
|
+
image_digest_retrying = "image_digest_retrying"
|
|
60
|
+
autoscaler_error = "autoscaler_error"
|
|
59
61
|
|
|
60
62
|
|
|
61
63
|
class RunBehaviour(StrEnum):
|
|
@@ -94,18 +96,69 @@ class ModuleReport(BaseModel):
|
|
|
94
96
|
)
|
|
95
97
|
|
|
96
98
|
|
|
97
|
-
class
|
|
98
|
-
|
|
99
|
+
class ModuleGrant(BaseModel):
|
|
100
|
+
granted: bool
|
|
101
|
+
config: dict[str, Any] | None = Field(
|
|
102
|
+
default=None,
|
|
103
|
+
description=(
|
|
104
|
+
"The module's remote config: `logLevel` (a `LogLevel` value) when an"
|
|
105
|
+
" AgentOps admin set one. Absent while the module is not granted."
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
suspended: bool | None = Field(
|
|
109
|
+
default=None,
|
|
110
|
+
description=(
|
|
111
|
+
"True when an AgentOps admin turned the module off without revoking its"
|
|
112
|
+
" grant. `granted` is then false, so a koperator that does not know this"
|
|
113
|
+
" field stops the module too; one that knows it reports why."
|
|
114
|
+
),
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class LogLevel(StrEnum):
|
|
119
|
+
debug = "debug"
|
|
120
|
+
info = "info"
|
|
121
|
+
warn = "warn"
|
|
122
|
+
error = "error"
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class ConfigSource(StrEnum):
|
|
126
|
+
default = "default"
|
|
127
|
+
chart = "chart"
|
|
128
|
+
env = "env"
|
|
129
|
+
remote = "remote"
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class AppliedLogLevel(BaseModel):
|
|
133
|
+
value: str = Field(..., description="A `LogLevel` value.")
|
|
134
|
+
source: str = Field(..., description="A `ConfigSource` value.")
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class ConfigRefusal(BaseModel):
|
|
138
|
+
etag: str = Field(..., description="The `OperatorSyncResponse.etag` of the refused config.")
|
|
139
|
+
reason: str = Field(
|
|
99
140
|
...,
|
|
100
|
-
description="
|
|
141
|
+
description=("Why koperator refused it, truncated and redacted like `ModuleReport.last_error`."),
|
|
101
142
|
)
|
|
102
|
-
|
|
103
|
-
modules: list[ModuleReport]
|
|
143
|
+
at: str = Field(..., description="When koperator refused it.")
|
|
104
144
|
|
|
105
145
|
|
|
106
|
-
class
|
|
107
|
-
|
|
108
|
-
|
|
146
|
+
class ConfigStatus(BaseModel):
|
|
147
|
+
applied_etag: str | None = Field(
|
|
148
|
+
default=None,
|
|
149
|
+
description=("The etag of the remote config koperator applies now. Absent before the first apply."),
|
|
150
|
+
)
|
|
151
|
+
refused: ConfigRefusal | None = None
|
|
152
|
+
dropped: list[str] | None = Field(
|
|
153
|
+
default=None,
|
|
154
|
+
description=("Remote config paths koperator dropped because devops owns them (`forbidoverride`)."),
|
|
155
|
+
)
|
|
156
|
+
platform_log_level: AppliedLogLevel | None = None
|
|
157
|
+
module_log_levels: dict[str, AppliedLogLevel] | None = Field(default=None, description="Keyed by `ModuleName` value.")
|
|
158
|
+
debug_until: str | None = Field(
|
|
159
|
+
default=None,
|
|
160
|
+
description=("When the debug mode koperator applies ends. Absent when debug is off."),
|
|
161
|
+
)
|
|
109
162
|
|
|
110
163
|
|
|
111
164
|
class OperatorSyncResponse(BaseModel):
|
|
@@ -115,7 +168,15 @@ class OperatorSyncResponse(BaseModel):
|
|
|
115
168
|
description=("The lowest koperator version that may receive new changes. Absent when there is no floor."),
|
|
116
169
|
)
|
|
117
170
|
blocked_versions: list[str] = Field(..., description="Koperator versions that receive no new changes.")
|
|
118
|
-
platform_config: dict[str, Any] = Field(
|
|
171
|
+
platform_config: dict[str, Any] = Field(
|
|
172
|
+
...,
|
|
173
|
+
description=(
|
|
174
|
+
"The platform's remote config, in the chart's camelCase keys: `logLevel` (a"
|
|
175
|
+
" `LogLevel` value) and `debug.until` (an ISO-8601 time; koperator logs at"
|
|
176
|
+
" debug until then, at most 24 h after it receives it). A key absent here"
|
|
177
|
+
" falls back to its local value."
|
|
178
|
+
),
|
|
179
|
+
)
|
|
119
180
|
modules: dict[str, ModuleGrant] = Field(
|
|
120
181
|
...,
|
|
121
182
|
description="Keyed by `ModuleName` value. A module absent here is not granted.",
|
|
@@ -183,6 +244,16 @@ class DesiredAgent(BaseModel):
|
|
|
183
244
|
" supersedes the adopt. Absent from an older control plane."
|
|
184
245
|
),
|
|
185
246
|
)
|
|
247
|
+
revision_of: str | None = Field(
|
|
248
|
+
default=None,
|
|
249
|
+
description=(
|
|
250
|
+
"Set when this agent is an Agent Revision: the id slug of the primary agent"
|
|
251
|
+
" it is a revision of. Koperator writes it to the"
|
|
252
|
+
" `agentops.komodor.io/revision-of` label. Null or absent for a primary"
|
|
253
|
+
" agent, and from an older control plane. An older koperator ignores it and"
|
|
254
|
+
" deploys the revision as an ordinary agent."
|
|
255
|
+
),
|
|
256
|
+
)
|
|
186
257
|
|
|
187
258
|
|
|
188
259
|
class DesiredStateResponse(BaseModel):
|
|
@@ -214,7 +285,12 @@ class AgentStatus(BaseModel):
|
|
|
214
285
|
)
|
|
215
286
|
reason_code: str | None = Field(
|
|
216
287
|
default=None,
|
|
217
|
-
description=(
|
|
288
|
+
description=(
|
|
289
|
+
"A `ReasonCode` value. Set with `failed`, for a running agent that is"
|
|
290
|
+
" unhealthy (for example `quota_exceeded`, or `autoscaler_error` when KEDA"
|
|
291
|
+
" cannot read its queue depth), and for a change that waits on a retry"
|
|
292
|
+
" (`image_digest_retrying`), with no `step`."
|
|
293
|
+
),
|
|
218
294
|
)
|
|
219
295
|
message: str | None = Field(default=None, description="Human-readable detail for `reason_code`.")
|
|
220
296
|
pod_state: str | None = Field(
|
|
@@ -416,3 +492,13 @@ class SecretsResponse(BaseModel):
|
|
|
416
492
|
description=("The version these values are. Koperator stamps it on the pod template, so a newer version rolls the pods."),
|
|
417
493
|
)
|
|
418
494
|
secrets: list[SecretValue]
|
|
495
|
+
|
|
496
|
+
|
|
497
|
+
class OperatorSyncRequest(BaseModel):
|
|
498
|
+
version: str = Field(
|
|
499
|
+
...,
|
|
500
|
+
description="The koperator version, checked against the version gate (FR-19).",
|
|
501
|
+
)
|
|
502
|
+
cluster_uid: str = Field(..., description="The `kube-system` namespace UID.")
|
|
503
|
+
modules: list[ModuleReport]
|
|
504
|
+
config_status: ConfigStatus | None = None
|
|
@@ -11,6 +11,7 @@ from agentops_rpc import (
|
|
|
11
11
|
CreateWorkerTokenRequest,
|
|
12
12
|
HostedAgentCreateRequest,
|
|
13
13
|
HostedAgentUpdateRequest,
|
|
14
|
+
ObserveOnlyConnect,
|
|
14
15
|
)
|
|
15
16
|
|
|
16
17
|
|
|
@@ -56,6 +57,21 @@ def test_blank_instructions_rejected() -> None:
|
|
|
56
57
|
CreateAgentRequest(agentId="triage", instructions="", credentialRef="c")
|
|
57
58
|
|
|
58
59
|
|
|
60
|
+
def test_runtime_create_without_instructions_rejected() -> None:
|
|
61
|
+
with pytest.raises(ValidationError, match="instructions is required for a runtime agent"):
|
|
62
|
+
CreateAgentRequest(agentId="triage", credentialRef="c")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def test_observe_only_create_without_instructions_accepted() -> None:
|
|
66
|
+
req = CreateAgentRequest.model_validate({"agentId": "obs", "runtimeMode": "observe_only"})
|
|
67
|
+
assert req.instructions is None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_observe_only_create_with_blank_instructions_rejected() -> None:
|
|
71
|
+
with pytest.raises(ValidationError, match="must not be blank"):
|
|
72
|
+
CreateAgentRequest.model_validate({"agentId": "obs", "runtimeMode": "observe_only", "instructions": " "})
|
|
73
|
+
|
|
74
|
+
|
|
59
75
|
def test_negative_replica_count_rejected() -> None:
|
|
60
76
|
with pytest.raises(ValidationError):
|
|
61
77
|
CreateAgentRequest(agentId="triage", instructions="x", replicaCount=0, credentialRef="c")
|
|
@@ -325,3 +341,15 @@ def test_observe_only_create_allows_the_cleanup_and_self_report_settings() -> No
|
|
|
325
341
|
|
|
326
342
|
def test_runtime_create_may_declare_runtime_config() -> None:
|
|
327
343
|
CreateAgentRequest.model_validate({"agentId": "rt", "instructions": "x", "anthropicApiKey": "k", "replicaCount": 2})
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
def test_create_response_serializes_connect_by_alias_and_by_name() -> None:
|
|
347
|
+
connect = ObserveOnlyConnect(
|
|
348
|
+
client="komodor_agentops.ObserveOnlyClient", env={"AGENTOPS_URL": "u"}, workerTokenHint="wt_a...bcde", expiresAt=None
|
|
349
|
+
)
|
|
350
|
+
resp = CreateAgentResponse(agentId="a", workerTokenHint="wt_a...bcde", connect=connect)
|
|
351
|
+
|
|
352
|
+
assert resp.command is None and resp.values is None
|
|
353
|
+
assert set(resp.model_dump(by_alias=True)["connect"]) == {"client", "env", "workerTokenHint", "expiresAt"}
|
|
354
|
+
assert set(resp.model_dump()["connect"]) == {"client", "env", "worker_token_hint", "expires_at"}
|
|
355
|
+
assert CreateAgentResponse(agentId="a", workerTokenHint="h", command="c", values="v").connect is None
|
|
@@ -49,6 +49,14 @@ def test_grade_task_accepts_criteria() -> None:
|
|
|
49
49
|
assert task.criteria[0].name == "grounding"
|
|
50
50
|
|
|
51
51
|
|
|
52
|
+
def test_grade_task_carries_its_reference_apart_from_the_instructions() -> None:
|
|
53
|
+
criteria = [CriterionDefinition(name="outcome_match", weight=100)]
|
|
54
|
+
task = GradeTask(runs=[GradedRun(label="run")], criteria=criteria, expected={"answer": "Jeffrey Wright"})
|
|
55
|
+
|
|
56
|
+
assert GradeTask.model_validate(task.model_dump(mode="json")).expected == {"answer": "Jeffrey Wright"}
|
|
57
|
+
assert "expected" not in GradeTask(runs=[GradedRun(label="run")], criteria=criteria).model_dump(exclude_none=True)
|
|
58
|
+
|
|
59
|
+
|
|
52
60
|
def test_grade_task_requires_criteria() -> None:
|
|
53
61
|
with pytest.raises(ValidationError):
|
|
54
62
|
GradeTask(runs=[GradedRun(label="run")], criteria=[])
|
|
@@ -35,7 +35,7 @@ def test_create_serialises_min_and_max_under_their_camel_aliases() -> None:
|
|
|
35
35
|
assert "replicaCount" not in dumped
|
|
36
36
|
|
|
37
37
|
|
|
38
|
-
@pytest.mark.parametrize("field", ["
|
|
38
|
+
@pytest.mark.parametrize("field", ["maxReplicas", "replicaCount"])
|
|
39
39
|
def test_scaling_fields_must_be_at_least_one(field: str) -> None:
|
|
40
40
|
with pytest.raises(ValidationError):
|
|
41
41
|
_create(**{field: 0})
|
|
@@ -43,6 +43,14 @@ def test_scaling_fields_must_be_at_least_one(field: str) -> None:
|
|
|
43
43
|
HostedAgentUpdateRequest.model_validate({field: 0})
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
def test_min_replicas_may_be_zero_but_not_negative() -> None:
|
|
47
|
+
assert _create(minReplicas=0, maxReplicas=2).min_replicas == 0
|
|
48
|
+
assert HostedAgentUpdateRequest.model_validate({"minReplicas": 0}).min_replicas == 0
|
|
49
|
+
assert WorkerCatalogDeployRequest.model_validate({"minReplicas": 0, "maxReplicas": 2}).min_replicas == 0
|
|
50
|
+
with pytest.raises(ValidationError):
|
|
51
|
+
_create(minReplicas=-1)
|
|
52
|
+
|
|
53
|
+
|
|
46
54
|
def test_create_refuses_min_above_max() -> None:
|
|
47
55
|
with pytest.raises(ValidationError, match="minReplicas must not exceed maxReplicas"):
|
|
48
56
|
_create(minReplicas=3, maxReplicas=2)
|
|
@@ -91,7 +99,7 @@ def test_catalog_deploy_request_accepts_scaling_under_camel_aliases_and_leaves_i
|
|
|
91
99
|
assert req.model_dump(by_alias=True, exclude_unset=True) == {"minReplicas": 1, "maxReplicas": 4}
|
|
92
100
|
|
|
93
101
|
|
|
94
|
-
@pytest.mark.parametrize("fields", [{"minReplicas":
|
|
102
|
+
@pytest.mark.parametrize("fields", [{"minReplicas": -1}, {"maxReplicas": 0}, {"minReplicas": 4, "maxReplicas": 2}, {"replicaCount": 2}])
|
|
95
103
|
def test_catalog_deploy_request_refuses_bad_scaling(fields: dict[str, int]) -> None:
|
|
96
104
|
with pytest.raises(ValidationError):
|
|
97
105
|
WorkerCatalogDeployRequest.model_validate(fields)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|