Skip to content

Automate browser based workflows with AI

Flag-gated ATS eligibility-defaults guidance for Task V3 (#8360)

pedrohsdb48bd76dd21fd
diff --git a/skyvern/forge/agent.py b/skyvern/forge/agent.py
index 2ba2ca150..ff7adfb7c 100644
--- a/skyvern/forge/agent.py
+++ b/skyvern/forge/agent.py
@@ -1958,6 +1958,19 @@ class ForgeAgent:
captcha_tools, captcha_guidance = build_captcha_tools(
task, _page_provider, organization_id=organization.organization_id
)
+ # Withheld in page-free mode: form-filling defaults must not bias a data-only judgment.
+ ats_guidance = None
+ if not page_free_validation:
+ try:
+ ats_guidance = await app.AGENT_FUNCTION.resolve_task_v3_extra_guidance(
+ task=task, organization=organization
+ )
+ except Exception:
+ LOG.warning(
+ "resolve_task_v3_extra_guidance failed; continuing without it",
+ task_id=task.task_id,
+ exc_info=True,
+ )
outcome = await run_task_v3_agent_loop(
page_provider=_page_provider,
resolve_typed_text=resolve_typed_text,
@@ -1994,8 +2007,14 @@ class ForgeAgent:
on_action_round=_on_action_round,
on_pre_action=pre_submit_ring.capture if pre_submit_ring is not None else None,
extra_tools=auth_tools + captcha_tools,
+ # ats_guidance before workflow_system_prompt keeps the customer's own text later in
+ # the message; position in one system message is a weak signal, not precedence — the
+ # real contract is the guidance's own scoping prose (its NEVER list and the explicit
+ # link to the base stop-don't-guess rule).
extra_system_guidance="\n\n".join(
- part for part in (auth_guidance, captcha_guidance, task.workflow_system_prompt) if part
+ part
+ for part in (auth_guidance, captcha_guidance, ats_guidance, task.workflow_system_prompt)
+ if part
),
completion_probe=completion_probe,
completion_blocker=completion_blocker,
diff --git a/skyvern/forge/agent_functions.py b/skyvern/forge/agent_functions.py
index 9307d3bea..3629fb34f 100644
--- a/skyvern/forge/agent_functions.py
+++ b/skyvern/forge/agent_functions.py
@@ -897,6 +897,11 @@ class AgentFunction:
) -> AutoObserveDecision:
return auto_observe_from_setting()
+ # OSS has no ATS-scoped guidance; cloud overrides to supply pre-authorized eligibility defaults
+ # behind a flag when the task targets a gated application-tracking-system host.
+ async def resolve_task_v3_extra_guidance(self, *, task: Task, organization: Organization) -> str | None:
+ return None
+
async def record_run_duration(
self,
run_type: str,
diff --git a/tests/unit/force_stub_app.py b/tests/unit/force_stub_app.py
index 4006a8d1d..3010f7077 100644
--- a/tests/unit/force_stub_app.py
+++ b/tests/unit/force_stub_app.py
@@ -47,6 +47,9 @@ def create_forge_stub_app() -> ForgeApp:
fake_app_module.AGENT_FUNCTION.MAGIC_LINK_CLOSE_SIGNALS = base_agent_function.MAGIC_LINK_CLOSE_SIGNALS
# Auto-mocked, its truthy MagicMock decision would switch auto-observe on for every engine test.
fake_app_module.AGENT_FUNCTION.resolve_task_v3_auto_observe = base_agent_function.resolve_task_v3_auto_observe
+ # Same footgun: _LazyNamespace's truthy AsyncMock would inject extra guidance text into every
+ # v3 task's extra_system_guidance join.
+ fake_app_module.AGENT_FUNCTION.resolve_task_v3_extra_guidance = base_agent_function.resolve_task_v3_extra_guidance
fake_app_module.AGENT_FUNCTION.serialize_codeblock_parameters = base_agent_function.serialize_codeblock_parameters
fake_app_module.AGENT_FUNCTION.redact_codeblock_parameter_values = (
base_agent_function.redact_codeblock_parameter_values