target_url
parameter and structuring multi-step workflows.
Using target_url
for Initial Context (Optional)
Both the start_task
method and individual steps within a create_workflow
definition accept an optional target_url
parameter (either a single string URL or a list of string URLs).
Purpose: When provided, target_url
gives the automation agent a specific web page (or pages) to load as the initial context for that task or workflow step. Think of it as telling the agent, “Start your work on this exact page.”
Agent Navigation: The agent is not restricted to the target_url
. The instructions
you provide will always guide the agent’s subsequent actions, including navigating away from the target_url
, clicking links, interacting with elements, and visiting other sites.
Alternative: Instruction-Based Navigation:
If you omit the target_url
parameter, the agent relies entirely on your instructions
to determine where to navigate first. You can provide natural language descriptions of the destination.
- Example Instructions (without
target_url
):"Go to google.com and search for the latest news about AI."
"Navigate to our company's internal dashboard login page, then sign in."
"Open Example CRM and find the contact record for 'John Doe'."
target_url
is generally more reliable for ensuring the agent starts exactly where you intend, but instruction-based navigation offers flexibility when a precise starting URL is unknown or unnecessary.
Example: Starting a Task on a Specific Page (Using target_url
)
Use target_url
for reliability when you know the exact starting point, like a specific login page.
Example: Starting a Task with Instruction-Based Navigation (No target_url
)
Rely on instructions when the starting point is general or can be described.
Advanced Usage: Providing Multiple target_url
s
For more complex scenarios, target_url
can also accept a list of strings (URLs). This instructs the agent to open multiple tabs, one for each URL provided, at the start of the task or workflow step.
Use Cases:
- Comparative Analysis: Open multiple product pages on different e-commerce sites simultaneously to compare prices or features within a single task.
- Multi-Source Data Gathering: Open several specific report pages or dashboards to collect related data points efficiently in one go.
- Cross-System Interaction: Initiate actions on multiple related web applications or systems within a single task or workflow step (e.g., checking order status across e-commerce, shipping, and payment systems simultaneously).
target_url
s, the agent typically processes the instructions
sequentially, acting on one tab then the next as directed. This isn’t true parallel processing in terms of simultaneous execution of complex logic, but rather concurrent access to multiple systems within a single automated process. You need to structure your instructions clearly to guide the agent’s interaction across the different tabs (e.g., “On the first tab (Site A), find X. On the second tab (Site B), find Y. Report both.”).
Example: start_task
with Multiple URLs
target_url
s to open multiple competitor product pages and extract prices for comparison.
Workflows with Multiple Steps and Context
Workflows shine when you need to perform a sequence of actions, potentially across different websites or involving data transfer. Implicit Context: The agent maintains context between workflow steps based on theinstructions
. For example, if Step 1 instructs the agent to “copy the email address,” Step 2 can often instruct it to “paste the email address” without needing to explicitly pass the data.
Using target_url
in Workflow Steps: You can provide a target_url
for each step if you want to explicitly define the starting point for that phase of the workflow. This is useful when steps involve distinct websites or specific deep links.
Example: Data Transfer Between Sites
This workflow copies a product price from one site and pastes it into a spreadsheet.target_url
directs the agent to the starting point for each distinct action (finding the product, accessing the specific spreadsheet). The agent handles copying the price in step 1 and using it in step 2 based on the instructions.
Example: Multi-Site Action Sequence
This workflow finds an order tracking number on one site and inputs it on another.target_url
provides the starting context for each step, while the instructions guide the agent’s actions, including the implicit transfer of the “tracking number” context from Step 1 to Step 2.