Skip to content

Automate browser based workflows with AI

add dataSchema to task v2 UI (#1966)

Shuchang Zheng0b8e688d7b63
diff --git a/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx b/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx
index a3c8e7de8..21d8c4668 100644
--- a/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx
+++ b/skyvern-frontend/src/routes/tasks/create/PromptBox.tsx
@@ -25,6 +25,7 @@ import {
import { Switch } from "@/components/ui/switch";
import { toast } from "@/components/ui/use-toast";
import { useCredentialGetter } from "@/hooks/useCredentialGetter";
+import { CodeEditor } from "@/routes/workflows/components/CodeEditor";
import {
FileTextIcon,
GearIcon,
@@ -153,6 +154,7 @@ function PromptBox() {
const [totpIdentifier, setTotpIdentifier] = useState("");
const [maxStepsOverride, setMaxStepsOverride] = useState<string | null>(null);
const [showAdvancedSettings, setShowAdvancedSettings] = useState(false);
+ const [dataSchema, setDataSchema] = useState<string | null>(null);
const startObserverCruiseMutation = useMutation({
mutationFn: async (prompt: string) => {
@@ -165,6 +167,15 @@ function PromptBox() {
proxy_location: proxyLocation,
totp_identifier: totpIdentifier,
publish_workflow: publishWorkflow,
+ extracted_information_schema: dataSchema
+ ? (() => {
+ try {
+ return JSON.parse(dataSchema);
+ } catch (e) {
+ return dataSchema;
+ }
+ })()
+ : null,
},
{
headers: {
@@ -409,6 +420,24 @@ function PromptBox() {
}}
/>
</div>
+ <div className="flex gap-16">
+ <div className="w-48 shrink-0">
+ <div className="text-sm">Data Schema</div>
+ <div className="text-xs text-slate-400">
+ Specify the output data schema in JSON format
+ </div>
+ </div>
+ <div className="flex-1">
+ <CodeEditor
+ value={dataSchema ?? ""}
+ onChange={(value) => setDataSchema(value || null)}
+ language="json"
+ minHeight="100px"
+ maxHeight="500px"
+ fontSize={8}
+ />
+ </div>
+ </div>
</div>
</div>
) : null}
diff --git a/skyvern/forge/sdk/routes/agent_protocol.py b/skyvern/forge/sdk/routes/agent_protocol.py
index 38ade3a10..a053b926c 100644
--- a/skyvern/forge/sdk/routes/agent_protocol.py
+++ b/skyvern/forge/sdk/routes/agent_protocol.py
@@ -839,7 +839,7 @@ async def delete_workflow(
@base_router.get("/workflows", response_model=list[Workflow])
-@base_router.get("/workflows/", response_model=list[Workflow])
+@base_router.get("/workflows/", response_model=list[Workflow], include_in_schema=False)
async def get_workflows(
page: int = Query(1, ge=1),
page_size: int = Query(10, ge=1),