diff --git a/surfsense_backend/app/automations/schemas/__init__.py b/surfsense_backend/app/automations/schemas/__init__.py index 23f0232fb..2bb0060ba 100644 --- a/surfsense_backend/app/automations/schemas/__init__.py +++ b/surfsense_backend/app/automations/schemas/__init__.py @@ -1,8 +1,8 @@ -"""Pydantic schemas for the automation definition and per-type configs.""" +"""Schemas for the automation definition and per-type configs.""" from __future__ import annotations -from .actions import AgentTaskActionConfig +from .actions import AgentTaskActionParams from .definition import ( AutomationDefinition, ExecutionBlock, @@ -11,16 +11,16 @@ from .definition import ( PlanStep, TriggerSpec, ) -from .triggers import ManualTriggerConfig, ScheduleTriggerConfig +from .triggers import ManualTriggerParams, ScheduleTriggerParams __all__ = [ - "AgentTaskActionConfig", + "AgentTaskActionParams", "AutomationDefinition", "ExecutionBlock", "InputsBlock", - "ManualTriggerConfig", + "ManualTriggerParams", "MetadataBlock", "PlanStep", - "ScheduleTriggerConfig", + "ScheduleTriggerParams", "TriggerSpec", ] diff --git a/surfsense_backend/app/automations/schemas/actions/__init__.py b/surfsense_backend/app/automations/schemas/actions/__init__.py index 4149206d7..c51d33b6a 100644 --- a/surfsense_backend/app/automations/schemas/actions/__init__.py +++ b/surfsense_backend/app/automations/schemas/actions/__init__.py @@ -1,9 +1,9 @@ -"""Per-action config schemas, one per action type.""" +"""Per-action params schemas, one per action type.""" from __future__ import annotations -from .agent_task import AgentTaskActionConfig +from .agent_task import AgentTaskActionParams __all__ = [ - "AgentTaskActionConfig", + "AgentTaskActionParams", ] diff --git a/surfsense_backend/app/automations/schemas/actions/agent_task.py b/surfsense_backend/app/automations/schemas/actions/agent_task.py index fe9d5fcef..348db8095 100644 --- a/surfsense_backend/app/automations/schemas/actions/agent_task.py +++ b/surfsense_backend/app/automations/schemas/actions/agent_task.py @@ -1,4 +1,4 @@ -"""``AgentTaskActionConfig`` — config for the ``agent_task`` action type.""" +"""``AgentTaskActionParams`` — params for the ``agent_task`` action type.""" from __future__ import annotations @@ -7,21 +7,21 @@ from typing import Any from pydantic import BaseModel, ConfigDict, Field -class AgentTaskActionConfig(BaseModel): - """Run a LangGraph Deep Agent restricted to a scoped capability list.""" +class AgentTaskActionParams(BaseModel): + """Run an agent task with a scoped tool allowlist.""" model_config = ConfigDict(extra="forbid") - prompt: str = Field(..., min_length=1, description="Task prompt; Jinja-rendered.") + prompt: str = Field(..., min_length=1, description="Task prompt; rendered at execute time.") tools: list[str] = Field( default_factory=list, - description="Capability IDs the agent may call. Empty = no tool access.", + description="Tool identifiers the agent may call. Empty = no tool access.", ) model: str | None = Field( default=None, - description="LiteLLM model id. Defaults to the search space's agent_llm_id.", + description="Model identifier. Defaults to the search space's agent_llm_id.", ) output_schema: dict[str, Any] | None = Field( default=None, - description="JSON Schema the agent must return. Recommended.", + description="JSON Schema (draft 2020-12) the agent must return. Recommended.", ) diff --git a/surfsense_backend/app/automations/schemas/definition/execution.py b/surfsense_backend/app/automations/schemas/definition/execution.py index 2fcbc611e..d5f31364c 100644 --- a/surfsense_backend/app/automations/schemas/definition/execution.py +++ b/surfsense_backend/app/automations/schemas/definition/execution.py @@ -16,9 +16,6 @@ class ExecutionBlock(BaseModel): max_retries: int = Field(default=2, ge=0, description="Per-step retry budget.") retry_backoff: Literal["exponential", "linear", "none"] = "exponential" concurrency: Literal["drop_if_running", "queue", "always"] = "drop_if_running" - budget_cap_usd: float | None = Field( - default=None, gt=0, description="Kill the run when accumulated cost exceeds this." - ) on_failure: list[PlanStep] = Field( default_factory=list, description="Steps run when the main plan fails after retries.", diff --git a/surfsense_backend/app/automations/schemas/definition/inputs.py b/surfsense_backend/app/automations/schemas/definition/inputs.py index 52aed4e90..b0b1a9414 100644 --- a/surfsense_backend/app/automations/schemas/definition/inputs.py +++ b/surfsense_backend/app/automations/schemas/definition/inputs.py @@ -17,5 +17,5 @@ class InputsBlock(BaseModel): schema_: dict[str, Any] = Field( ..., alias="schema", - description="JSON Schema (draft-07) for accepted inputs.", + description="JSON Schema (draft 2020-12) for accepted inputs.", ) diff --git a/surfsense_backend/app/automations/schemas/definition/metadata.py b/surfsense_backend/app/automations/schemas/definition/metadata.py index 61d7af390..9b3722430 100644 --- a/surfsense_backend/app/automations/schemas/definition/metadata.py +++ b/surfsense_backend/app/automations/schemas/definition/metadata.py @@ -9,6 +9,3 @@ class MetadataBlock(BaseModel): model_config = ConfigDict(extra="allow") tags: list[str] = Field(default_factory=list) - created_from_nl: bool = Field( - default=False, description="True when produced by the NL generator." - ) diff --git a/surfsense_backend/app/automations/schemas/definition/plan_step.py b/surfsense_backend/app/automations/schemas/definition/plan_step.py index 6a0bf9a1b..5d16f1f3e 100644 --- a/surfsense_backend/app/automations/schemas/definition/plan_step.py +++ b/surfsense_backend/app/automations/schemas/definition/plan_step.py @@ -14,11 +14,11 @@ class PlanStep(BaseModel): action: str = Field(..., min_length=1, description="Action type; resolved via registry.") when: str | None = Field( default=None, - description="Optional Jinja expression; step is skipped when falsy.", + description="Optional predicate; step is skipped when falsy.", ) - config: dict[str, Any] = Field( + params: dict[str, Any] = Field( default_factory=dict, - description="Action-type-specific config; Jinja-rendered at execute time.", + description="Action-type-specific params; rendered at execute time.", ) output_as: str | None = Field( default=None, diff --git a/surfsense_backend/app/automations/schemas/definition/trigger_spec.py b/surfsense_backend/app/automations/schemas/definition/trigger_spec.py index 0fdf1f35a..a359a2f63 100644 --- a/surfsense_backend/app/automations/schemas/definition/trigger_spec.py +++ b/surfsense_backend/app/automations/schemas/definition/trigger_spec.py @@ -11,7 +11,7 @@ class TriggerSpec(BaseModel): model_config = ConfigDict(extra="forbid") type: str = Field(..., min_length=1, description="Trigger type; resolved via registry.") - config: dict[str, Any] = Field( + params: dict[str, Any] = Field( default_factory=dict, - description="Type-specific config; validated against the trigger's schema.", + description="Type-specific params; validated against the trigger's schema.", ) diff --git a/surfsense_backend/app/automations/schemas/triggers/__init__.py b/surfsense_backend/app/automations/schemas/triggers/__init__.py index 0cd8bc38e..3ddd26f95 100644 --- a/surfsense_backend/app/automations/schemas/triggers/__init__.py +++ b/surfsense_backend/app/automations/schemas/triggers/__init__.py @@ -1,11 +1,11 @@ -"""Per-trigger config schemas, one per trigger type.""" +"""Per-trigger params schemas, one per trigger type.""" from __future__ import annotations -from .manual import ManualTriggerConfig -from .schedule import ScheduleTriggerConfig +from .manual import ManualTriggerParams +from .schedule import ScheduleTriggerParams __all__ = [ - "ManualTriggerConfig", - "ScheduleTriggerConfig", + "ManualTriggerParams", + "ScheduleTriggerParams", ] diff --git a/surfsense_backend/app/automations/schemas/triggers/manual.py b/surfsense_backend/app/automations/schemas/triggers/manual.py index bf14f80b6..577655086 100644 --- a/surfsense_backend/app/automations/schemas/triggers/manual.py +++ b/surfsense_backend/app/automations/schemas/triggers/manual.py @@ -1,9 +1,9 @@ -"""``ManualTriggerConfig`` — config for the ``manual`` trigger (empty in v1).""" +"""``ManualTriggerParams`` — params for the ``manual`` trigger (empty in v1).""" from __future__ import annotations from pydantic import BaseModel, ConfigDict -class ManualTriggerConfig(BaseModel): +class ManualTriggerParams(BaseModel): model_config = ConfigDict(extra="forbid") diff --git a/surfsense_backend/app/automations/schemas/triggers/schedule.py b/surfsense_backend/app/automations/schemas/triggers/schedule.py index 9d8c7d38d..0418bd1d9 100644 --- a/surfsense_backend/app/automations/schemas/triggers/schedule.py +++ b/surfsense_backend/app/automations/schemas/triggers/schedule.py @@ -1,11 +1,11 @@ -"""``ScheduleTriggerConfig`` — config for the ``schedule`` trigger type.""" +"""``ScheduleTriggerParams`` — params for the ``schedule`` trigger type.""" from __future__ import annotations from pydantic import BaseModel, ConfigDict, Field -class ScheduleTriggerConfig(BaseModel): +class ScheduleTriggerParams(BaseModel): model_config = ConfigDict(extra="forbid") cron: str = Field(..., description="Five-field cron expression.", examples=["0 9 * * 1-5"])