Skip to content

Commit b10e2ad

Browse files
feat: variables for observe
1 parent d6758da commit b10e2ad

File tree

10 files changed

+471
-15
lines changed

10 files changed

+471
-15
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 8
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-573d364768ac1902ee5ed8b2485d3b293bda0ea8ff7898aef1a3fd6be79b594a.yml
3-
openapi_spec_hash: 107ec840f4330885dd2232a05a66fed7
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/browserbase%2Fstagehand-975ca868b31b1e45fb00b31a53d9df1ceec8663f6c2851bf40fdaa84171afadc.yml
3+
openapi_spec_hash: 37891379e0f47e5c69769fbaa1064dab
44
config_hash: 0209737a4ab2a71afececb0ff7459998

stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionActParams.kt

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,8 @@ private constructor(
805805
fun timeout(): Optional<Double> = timeout.getOptional("timeout")
806806

807807
/**
808-
* Variables to substitute in the action instruction
808+
* Variables to substitute in the action instruction. Accepts flat primitives or { value,
809+
* description? } objects.
809810
*
810811
* @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if
811812
* the server responded with an unexpected value).
@@ -899,7 +900,10 @@ private constructor(
899900
*/
900901
fun timeout(timeout: JsonField<Double>) = apply { this.timeout = timeout }
901902

902-
/** Variables to substitute in the action instruction */
903+
/**
904+
* Variables to substitute in the action instruction. Accepts flat primitives or {
905+
* value, description? } objects.
906+
*/
903907
fun variables(variables: Variables) = variables(JsonField.of(variables))
904908

905909
/**
@@ -1144,7 +1148,10 @@ private constructor(
11441148
}
11451149
}
11461150

1147-
/** Variables to substitute in the action instruction */
1151+
/**
1152+
* Variables to substitute in the action instruction. Accepts flat primitives or { value,
1153+
* description? } objects.
1154+
*/
11481155
class Variables
11491156
@JsonCreator
11501157
private constructor(

stagehand-java-core/src/main/kotlin/com/browserbase/api/models/sessions/SessionExecuteParams.kt

Lines changed: 92 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1686,6 +1686,8 @@ private constructor(
16861686
private val instruction: JsonField<String>,
16871687
private val highlightCursor: JsonField<Boolean>,
16881688
private val maxSteps: JsonField<Double>,
1689+
private val toolTimeout: JsonField<Double>,
1690+
private val useSearch: JsonField<Boolean>,
16891691
private val additionalProperties: MutableMap<String, JsonValue>,
16901692
) {
16911693

@@ -1697,8 +1699,16 @@ private constructor(
16971699
@JsonProperty("highlightCursor")
16981700
@ExcludeMissing
16991701
highlightCursor: JsonField<Boolean> = JsonMissing.of(),
1700-
@JsonProperty("maxSteps") @ExcludeMissing maxSteps: JsonField<Double> = JsonMissing.of(),
1701-
) : this(instruction, highlightCursor, maxSteps, mutableMapOf())
1702+
@JsonProperty("maxSteps")
1703+
@ExcludeMissing
1704+
maxSteps: JsonField<Double> = JsonMissing.of(),
1705+
@JsonProperty("toolTimeout")
1706+
@ExcludeMissing
1707+
toolTimeout: JsonField<Double> = JsonMissing.of(),
1708+
@JsonProperty("useSearch")
1709+
@ExcludeMissing
1710+
useSearch: JsonField<Boolean> = JsonMissing.of(),
1711+
) : this(instruction, highlightCursor, maxSteps, toolTimeout, useSearch, mutableMapOf())
17021712

17031713
/**
17041714
* Natural language instruction for the agent
@@ -1724,6 +1734,22 @@ private constructor(
17241734
*/
17251735
fun maxSteps(): Optional<Double> = maxSteps.getOptional("maxSteps")
17261736

1737+
/**
1738+
* Timeout in milliseconds for each agent tool call
1739+
*
1740+
* @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if
1741+
* the server responded with an unexpected value).
1742+
*/
1743+
fun toolTimeout(): Optional<Double> = toolTimeout.getOptional("toolTimeout")
1744+
1745+
/**
1746+
* Whether to enable the web search tool powered by Browserbase Search API
1747+
*
1748+
* @throws StagehandInvalidDataException if the JSON field has an unexpected type (e.g. if
1749+
* the server responded with an unexpected value).
1750+
*/
1751+
fun useSearch(): Optional<Boolean> = useSearch.getOptional("useSearch")
1752+
17271753
/**
17281754
* Returns the raw JSON value of [instruction].
17291755
*
@@ -1750,6 +1776,22 @@ private constructor(
17501776
*/
17511777
@JsonProperty("maxSteps") @ExcludeMissing fun _maxSteps(): JsonField<Double> = maxSteps
17521778

1779+
/**
1780+
* Returns the raw JSON value of [toolTimeout].
1781+
*
1782+
* Unlike [toolTimeout], this method doesn't throw if the JSON field has an unexpected type.
1783+
*/
1784+
@JsonProperty("toolTimeout")
1785+
@ExcludeMissing
1786+
fun _toolTimeout(): JsonField<Double> = toolTimeout
1787+
1788+
/**
1789+
* Returns the raw JSON value of [useSearch].
1790+
*
1791+
* Unlike [useSearch], this method doesn't throw if the JSON field has an unexpected type.
1792+
*/
1793+
@JsonProperty("useSearch") @ExcludeMissing fun _useSearch(): JsonField<Boolean> = useSearch
1794+
17531795
@JsonAnySetter
17541796
private fun putAdditionalProperty(key: String, value: JsonValue) {
17551797
additionalProperties.put(key, value)
@@ -1781,13 +1823,17 @@ private constructor(
17811823
private var instruction: JsonField<String>? = null
17821824
private var highlightCursor: JsonField<Boolean> = JsonMissing.of()
17831825
private var maxSteps: JsonField<Double> = JsonMissing.of()
1826+
private var toolTimeout: JsonField<Double> = JsonMissing.of()
1827+
private var useSearch: JsonField<Boolean> = JsonMissing.of()
17841828
private var additionalProperties: MutableMap<String, JsonValue> = mutableMapOf()
17851829

17861830
@JvmSynthetic
17871831
internal fun from(executeOptions: ExecuteOptions) = apply {
17881832
instruction = executeOptions.instruction
17891833
highlightCursor = executeOptions.highlightCursor
17901834
maxSteps = executeOptions.maxSteps
1835+
toolTimeout = executeOptions.toolTimeout
1836+
useSearch = executeOptions.useSearch
17911837
additionalProperties = executeOptions.additionalProperties.toMutableMap()
17921838
}
17931839

@@ -1832,6 +1878,32 @@ private constructor(
18321878
*/
18331879
fun maxSteps(maxSteps: JsonField<Double>) = apply { this.maxSteps = maxSteps }
18341880

1881+
/** Timeout in milliseconds for each agent tool call */
1882+
fun toolTimeout(toolTimeout: Double) = toolTimeout(JsonField.of(toolTimeout))
1883+
1884+
/**
1885+
* Sets [Builder.toolTimeout] to an arbitrary JSON value.
1886+
*
1887+
* You should usually call [Builder.toolTimeout] with a well-typed [Double] value
1888+
* instead. This method is primarily for setting the field to an undocumented or not yet
1889+
* supported value.
1890+
*/
1891+
fun toolTimeout(toolTimeout: JsonField<Double>) = apply {
1892+
this.toolTimeout = toolTimeout
1893+
}
1894+
1895+
/** Whether to enable the web search tool powered by Browserbase Search API */
1896+
fun useSearch(useSearch: Boolean) = useSearch(JsonField.of(useSearch))
1897+
1898+
/**
1899+
* Sets [Builder.useSearch] to an arbitrary JSON value.
1900+
*
1901+
* You should usually call [Builder.useSearch] with a well-typed [Boolean] value
1902+
* instead. This method is primarily for setting the field to an undocumented or not yet
1903+
* supported value.
1904+
*/
1905+
fun useSearch(useSearch: JsonField<Boolean>) = apply { this.useSearch = useSearch }
1906+
18351907
fun additionalProperties(additionalProperties: Map<String, JsonValue>) = apply {
18361908
this.additionalProperties.clear()
18371909
putAllAdditionalProperties(additionalProperties)
@@ -1868,6 +1940,8 @@ private constructor(
18681940
checkRequired("instruction", instruction),
18691941
highlightCursor,
18701942
maxSteps,
1943+
toolTimeout,
1944+
useSearch,
18711945
additionalProperties.toMutableMap(),
18721946
)
18731947
}
@@ -1882,6 +1956,8 @@ private constructor(
18821956
instruction()
18831957
highlightCursor()
18841958
maxSteps()
1959+
toolTimeout()
1960+
useSearch()
18851961
validated = true
18861962
}
18871963

@@ -1903,7 +1979,9 @@ private constructor(
19031979
internal fun validity(): Int =
19041980
(if (instruction.asKnown().isPresent) 1 else 0) +
19051981
(if (highlightCursor.asKnown().isPresent) 1 else 0) +
1906-
(if (maxSteps.asKnown().isPresent) 1 else 0)
1982+
(if (maxSteps.asKnown().isPresent) 1 else 0) +
1983+
(if (toolTimeout.asKnown().isPresent) 1 else 0) +
1984+
(if (useSearch.asKnown().isPresent) 1 else 0)
19071985

19081986
override fun equals(other: Any?): Boolean {
19091987
if (this === other) {
@@ -1914,17 +1992,26 @@ private constructor(
19141992
instruction == other.instruction &&
19151993
highlightCursor == other.highlightCursor &&
19161994
maxSteps == other.maxSteps &&
1995+
toolTimeout == other.toolTimeout &&
1996+
useSearch == other.useSearch &&
19171997
additionalProperties == other.additionalProperties
19181998
}
19191999

19202000
private val hashCode: Int by lazy {
1921-
Objects.hash(instruction, highlightCursor, maxSteps, additionalProperties)
2001+
Objects.hash(
2002+
instruction,
2003+
highlightCursor,
2004+
maxSteps,
2005+
toolTimeout,
2006+
useSearch,
2007+
additionalProperties,
2008+
)
19222009
}
19232010

19242011
override fun hashCode(): Int = hashCode
19252012

19262013
override fun toString() =
1927-
"ExecuteOptions{instruction=$instruction, highlightCursor=$highlightCursor, maxSteps=$maxSteps, additionalProperties=$additionalProperties}"
2014+
"ExecuteOptions{instruction=$instruction, highlightCursor=$highlightCursor, maxSteps=$maxSteps, toolTimeout=$toolTimeout, useSearch=$useSearch, additionalProperties=$additionalProperties}"
19282015
}
19292016

19302017
/** Whether to stream the response via SSE */

0 commit comments

Comments
 (0)