Skip to content

Commit 99b8057

Browse files
feat: Enhance AuthAgentInvocation with step and last activity tracking
1 parent 73e0e46 commit 99b8057

File tree

5 files changed

+20
-17
lines changed

5 files changed

+20
-17
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: 89
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-13214b99e392aab631aa1ca99b6a51a58df81e34156d21b8d639bea779566123.yml
3-
openapi_spec_hash: a88d175fc3980de3097ac1411d8dcbff
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-2cf104c4b88159c6a50713b019188f83983748b9cacec598089cf9068dc5b1cd.yml
3+
openapi_spec_hash: 84ea30ae65ad7ebcc04d2f3907d1e73b
44
config_hash: 179f33af31ece83563163d5b3d751d13

src/kernel/resources/agents/auth/invocations.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,10 +116,9 @@ def retrieve(
116116
extra_body: Body | None = None,
117117
timeout: float | httpx.Timeout | None | NotGiven = not_given,
118118
) -> AgentAuthInvocationResponse:
119-
"""Returns invocation details including app_name and target_domain.
120-
121-
Uses the JWT
122-
returned by the exchange endpoint, or standard API key or JWT authentication.
119+
"""
120+
Returns invocation details including status, app_name, and target_domain.
121+
Supports both API key and JWT (from exchange endpoint) authentication.
123122
124123
Args:
125124
extra_headers: Send extra headers
@@ -155,7 +154,7 @@ def discover(
155154
"""
156155
Inspects the target site to detect logged-in state or discover required fields.
157156
Returns 200 with success: true when fields are found, or 4xx/5xx for failures.
158-
Requires the JWT returned by the exchange endpoint.
157+
Supports both API key and JWT (from exchange endpoint) authentication.
159158
160159
Args:
161160
login_url: Optional login page URL. If provided, will override the stored login URL for
@@ -233,7 +232,8 @@ def submit(
233232
) -> AgentAuthSubmitResponse:
234233
"""
235234
Submits field values for the discovered login form and may return additional
236-
auth fields or success. Requires the JWT returned by the exchange endpoint.
235+
auth fields or success. Supports both API key and JWT (from exchange endpoint)
236+
authentication.
237237
238238
Args:
239239
field_values: Values for the discovered login fields
@@ -342,10 +342,9 @@ async def retrieve(
342342
extra_body: Body | None = None,
343343
timeout: float | httpx.Timeout | None | NotGiven = not_given,
344344
) -> AgentAuthInvocationResponse:
345-
"""Returns invocation details including app_name and target_domain.
346-
347-
Uses the JWT
348-
returned by the exchange endpoint, or standard API key or JWT authentication.
345+
"""
346+
Returns invocation details including status, app_name, and target_domain.
347+
Supports both API key and JWT (from exchange endpoint) authentication.
349348
350349
Args:
351350
extra_headers: Send extra headers
@@ -381,7 +380,7 @@ async def discover(
381380
"""
382381
Inspects the target site to detect logged-in state or discover required fields.
383382
Returns 200 with success: true when fields are found, or 4xx/5xx for failures.
384-
Requires the JWT returned by the exchange endpoint.
383+
Supports both API key and JWT (from exchange endpoint) authentication.
385384
386385
Args:
387386
login_url: Optional login page URL. If provided, will override the stored login URL for
@@ -461,7 +460,8 @@ async def submit(
461460
) -> AgentAuthSubmitResponse:
462461
"""
463462
Submits field values for the discovered login form and may return additional
464-
auth fields or success. Requires the JWT returned by the exchange endpoint.
463+
auth fields or success. Supports both API key and JWT (from exchange endpoint)
464+
authentication.
465465
466466
Args:
467467
field_values: Values for the discovered login fields

src/kernel/types/agents/agent_auth_invocation_response.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@ class AgentAuthInvocationResponse(BaseModel):
2020
status: Literal["IN_PROGRESS", "SUCCESS", "EXPIRED", "CANCELED"]
2121
"""Invocation status"""
2222

23+
step: Literal["initialized", "discovering", "awaiting_input", "submitting", "completed", "expired"]
24+
"""Current step in the invocation workflow"""
25+
2326
target_domain: str
2427
"""Target domain for authentication"""

src/kernel/types/agents/auth_agent_invocation_create_response.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class AuthAgentAlreadyAuthenticated(BaseModel):
1414
"""Response when the agent is already authenticated."""
1515

16-
status: Literal["already_authenticated"]
16+
status: Literal["ALREADY_AUTHENTICATED"]
1717
"""Indicates the agent is already authenticated and no invocation was created."""
1818

1919

@@ -32,7 +32,7 @@ class AuthAgentInvocationCreated(BaseModel):
3232
invocation_id: str
3333
"""Unique identifier for the invocation."""
3434

35-
status: Literal["invocation_created"]
35+
status: Literal["INVOCATION_CREATED"]
3636
"""Indicates an invocation was created."""
3737

3838

src/kernel/types/agents/reauth_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class ReauthResponse(BaseModel):
1212
"""Response from triggering re-authentication"""
1313

14-
status: Literal["reauth_started", "already_authenticated", "cannot_reauth"]
14+
status: Literal["REAUTH_STARTED", "ALREADY_AUTHENTICATED", "CANNOT_REAUTH"]
1515
"""Result of the re-authentication attempt"""
1616

1717
invocation_id: Optional[str] = None

0 commit comments

Comments
 (0)