Skip to content

Commit 09c2210

Browse files
feat(agent): add annotations field to AgentExecution
1 parent 48e0b49 commit 09c2210

6 files changed

Lines changed: 38 additions & 5 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 172
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-00ba82d543cfbd7d43712fb508d286a0a07b2aad1c6edf8084d794a903b09e3b.yml
3-
openapi_spec_hash: 381d9164ae462351125af601e9f5c951
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-e77dd932e4cfde041f712e0e130d6075754e2f5893bca0a03ee5cd0734b35089.yml
3+
openapi_spec_hash: faa844cfe771c3762e3a4d79b476cebf
44
config_hash: ad1db65b32248aecda41b64586aac9ce

src/gitpod/resources/agents.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Dict, Optional
66

77
import httpx
88

@@ -537,6 +537,7 @@ def start_execution(
537537
self,
538538
*,
539539
agent_id: str | Omit = omit,
540+
annotations: Dict[str, str] | Omit = omit,
540541
code_context: AgentCodeContextParam | Omit = omit,
541542
mode: AgentMode | Omit = omit,
542543
name: str | Omit = omit,
@@ -567,6 +568,10 @@ def start_execution(
567568
```
568569
569570
Args:
571+
annotations: annotations are key-value pairs for tracking external context (e.g., Linear
572+
session IDs, GitHub issue references). Keys should follow domain/name convention
573+
(e.g., "linear.app/session-id").
574+
570575
mode: mode specifies the operational mode for this agent execution If not specified,
571576
defaults to AGENT_MODE_EXECUTION
572577
@@ -590,6 +595,7 @@ def start_execution(
590595
body=maybe_transform(
591596
{
592597
"agent_id": agent_id,
598+
"annotations": annotations,
593599
"code_context": code_context,
594600
"mode": mode,
595601
"name": name,
@@ -1197,6 +1203,7 @@ async def start_execution(
11971203
self,
11981204
*,
11991205
agent_id: str | Omit = omit,
1206+
annotations: Dict[str, str] | Omit = omit,
12001207
code_context: AgentCodeContextParam | Omit = omit,
12011208
mode: AgentMode | Omit = omit,
12021209
name: str | Omit = omit,
@@ -1227,6 +1234,10 @@ async def start_execution(
12271234
```
12281235
12291236
Args:
1237+
annotations: annotations are key-value pairs for tracking external context (e.g., Linear
1238+
session IDs, GitHub issue references). Keys should follow domain/name convention
1239+
(e.g., "linear.app/session-id").
1240+
12301241
mode: mode specifies the operational mode for this agent execution If not specified,
12311242
defaults to AGENT_MODE_EXECUTION
12321243
@@ -1250,6 +1261,7 @@ async def start_execution(
12501261
body=await async_maybe_transform(
12511262
{
12521263
"agent_id": agent_id,
1264+
"annotations": annotations,
12531265
"code_context": code_context,
12541266
"mode": mode,
12551267
"name": name,

src/gitpod/types/agent_execution.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ class Metadata(BaseModel):
3131
parts of Gitpod to function
3232
"""
3333

34+
annotations: Optional[Dict[str, str]] = None
35+
"""annotations are key-value pairs for tracking external context."""
36+
3437
created_at: Optional[datetime] = FieldInfo(alias="createdAt", default=None)
3538
"""
3639
A Timestamp represents a point in time independent of any time zone or local

src/gitpod/types/agent_list_executions_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import List
5+
from typing import Dict, List
66
from typing_extensions import Literal, Annotated, TypedDict
77

88
from .._types import SequenceNotStr
@@ -24,6 +24,13 @@ class AgentListExecutionsParams(TypedDict, total=False):
2424
class Filter(TypedDict, total=False):
2525
agent_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="agentIds")]
2626

27+
annotations: Dict[str, str]
28+
"""annotations filters by key-value pairs.
29+
30+
Only executions containing all specified annotations (with matching values) are
31+
returned.
32+
"""
33+
2734
creator_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="creatorIds")]
2835

2936
environment_ids: Annotated[SequenceNotStr[str], PropertyInfo(alias="environmentIds")]

src/gitpod/types/agent_start_execution_params.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from __future__ import annotations
44

5-
from typing import Optional
5+
from typing import Dict, Optional
66
from typing_extensions import Annotated, TypedDict
77

88
from .._utils import PropertyInfo
@@ -15,6 +15,13 @@
1515
class AgentStartExecutionParams(TypedDict, total=False):
1616
agent_id: Annotated[str, PropertyInfo(alias="agentId")]
1717

18+
annotations: Dict[str, str]
19+
"""
20+
annotations are key-value pairs for tracking external context (e.g., Linear
21+
session IDs, GitHub issue references). Keys should follow domain/name convention
22+
(e.g., "linear.app/session-id").
23+
"""
24+
1825
code_context: Annotated[AgentCodeContextParam, PropertyInfo(alias="codeContext")]
1926

2027
mode: AgentMode

tests/api_resources/test_agents.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ def test_method_list_executions_with_all_params(self, client: Gitpod) -> None:
192192
page_size=0,
193193
filter={
194194
"agent_ids": ["b8a64cfa-43e2-4b9d-9fb3-07edc63f5971"],
195+
"annotations": {"foo": "string"},
195196
"creator_ids": ["string"],
196197
"environment_ids": ["string"],
197198
"project_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],
@@ -412,6 +413,7 @@ def test_method_start_execution(self, client: Gitpod) -> None:
412413
def test_method_start_execution_with_all_params(self, client: Gitpod) -> None:
413414
agent = client.agents.start_execution(
414415
agent_id="b8a64cfa-43e2-4b9d-9fb3-07edc63f5971",
416+
annotations={"foo": "string"},
415417
code_context={
416418
"context_url": {
417419
"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
@@ -718,6 +720,7 @@ async def test_method_list_executions_with_all_params(self, async_client: AsyncG
718720
page_size=0,
719721
filter={
720722
"agent_ids": ["b8a64cfa-43e2-4b9d-9fb3-07edc63f5971"],
723+
"annotations": {"foo": "string"},
721724
"creator_ids": ["string"],
722725
"environment_ids": ["string"],
723726
"project_ids": ["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"],
@@ -938,6 +941,7 @@ async def test_method_start_execution(self, async_client: AsyncGitpod) -> None:
938941
async def test_method_start_execution_with_all_params(self, async_client: AsyncGitpod) -> None:
939942
agent = await async_client.agents.start_execution(
940943
agent_id="b8a64cfa-43e2-4b9d-9fb3-07edc63f5971",
944+
annotations={"foo": "string"},
941945
code_context={
942946
"context_url": {
943947
"environment_class_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",

0 commit comments

Comments
 (0)