Skip to content

Commit 9675b1f

Browse files
feat(api): add goal field to agent execution status
1 parent 8c14eb0 commit 9675b1f

2 files changed

Lines changed: 57 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: 193
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod/gitpod-b9c1a7558d4dda4b0e58729d1c14b130d19262615d63ce6c78340daeca76188e.yml
3-
openapi_spec_hash: a91da1453dbfb8aceccb085665b3b21d
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod/gitpod-c98c46c0408dfba7bdd2887afe0c58542113d05999d7ea1c34519f513e9a5fdf.yml
3+
openapi_spec_hash: 6a9e3377c0df786e5e88be2dfad93f66
44
config_hash: 9052d3b03d620cf6871184b15487e020

agent.go

Lines changed: 55 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -911,9 +911,11 @@ type AgentExecutionStatus struct {
911911
// failure_message contains the reason the agent run failed to operate.
912912
FailureMessage string `json:"failureMessage"`
913913
// failure_reason contains a structured reason code for the failure.
914-
FailureReason AgentExecutionStatusFailureReason `json:"failureReason"`
915-
InputTokensUsed string `json:"inputTokensUsed"`
916-
Iterations string `json:"iterations"`
914+
FailureReason AgentExecutionStatusFailureReason `json:"failureReason"`
915+
// goal projects the current native Codex thread goal, if any.
916+
Goal AgentExecutionStatusGoal `json:"goal"`
917+
InputTokensUsed string `json:"inputTokensUsed"`
918+
Iterations string `json:"iterations"`
917919
// judgement is the judgement of the agent run produced by the judgement prompt.
918920
Judgement string `json:"judgement"`
919921
// mcp_integration_statuses contains the status of all MCP integrations used by
@@ -957,6 +959,7 @@ type agentExecutionStatusJSON struct {
957959
CurrentOperation apijson.Field
958960
FailureMessage apijson.Field
959961
FailureReason apijson.Field
962+
Goal apijson.Field
960963
InputTokensUsed apijson.Field
961964
Iterations apijson.Field
962965
Judgement apijson.Field
@@ -1076,6 +1079,55 @@ func (r AgentExecutionStatusFailureReason) IsKnown() bool {
10761079
return false
10771080
}
10781081

1082+
// goal projects the current native Codex thread goal, if any.
1083+
type AgentExecutionStatusGoal struct {
1084+
// objective is the current goal text tracked by the native Codex thread-goal
1085+
// subsystem.
1086+
Objective string `json:"objective"`
1087+
// status is the lifecycle state of the current goal.
1088+
Status AgentExecutionStatusGoalStatus `json:"status"`
1089+
// updated_at is the most recent native goal update timestamp, when available.
1090+
UpdatedAt time.Time `json:"updatedAt" format:"date-time"`
1091+
JSON agentExecutionStatusGoalJSON `json:"-"`
1092+
}
1093+
1094+
// agentExecutionStatusGoalJSON contains the JSON metadata for the struct
1095+
// [AgentExecutionStatusGoal]
1096+
type agentExecutionStatusGoalJSON struct {
1097+
Objective apijson.Field
1098+
Status apijson.Field
1099+
UpdatedAt apijson.Field
1100+
raw string
1101+
ExtraFields map[string]apijson.Field
1102+
}
1103+
1104+
func (r *AgentExecutionStatusGoal) UnmarshalJSON(data []byte) (err error) {
1105+
return apijson.UnmarshalRoot(data, r)
1106+
}
1107+
1108+
func (r agentExecutionStatusGoalJSON) RawJSON() string {
1109+
return r.raw
1110+
}
1111+
1112+
// status is the lifecycle state of the current goal.
1113+
type AgentExecutionStatusGoalStatus string
1114+
1115+
const (
1116+
AgentExecutionStatusGoalStatusGoalStatusUnspecified AgentExecutionStatusGoalStatus = "GOAL_STATUS_UNSPECIFIED"
1117+
AgentExecutionStatusGoalStatusGoalStatusActive AgentExecutionStatusGoalStatus = "GOAL_STATUS_ACTIVE"
1118+
AgentExecutionStatusGoalStatusGoalStatusPaused AgentExecutionStatusGoalStatus = "GOAL_STATUS_PAUSED"
1119+
AgentExecutionStatusGoalStatusGoalStatusCompleted AgentExecutionStatusGoalStatus = "GOAL_STATUS_COMPLETED"
1120+
AgentExecutionStatusGoalStatusGoalStatusBudgetExhausted AgentExecutionStatusGoalStatus = "GOAL_STATUS_BUDGET_EXHAUSTED"
1121+
)
1122+
1123+
func (r AgentExecutionStatusGoalStatus) IsKnown() bool {
1124+
switch r {
1125+
case AgentExecutionStatusGoalStatusGoalStatusUnspecified, AgentExecutionStatusGoalStatusGoalStatusActive, AgentExecutionStatusGoalStatusGoalStatusPaused, AgentExecutionStatusGoalStatusGoalStatusCompleted, AgentExecutionStatusGoalStatusGoalStatusBudgetExhausted:
1126+
return true
1127+
}
1128+
return false
1129+
}
1130+
10791131
// MCPIntegrationStatus represents the status of a single MCP integration within an
10801132
// agent execution context
10811133
type AgentExecutionStatusMcpIntegrationStatus struct {

0 commit comments

Comments
 (0)