Skip to content

Commit 77ad9c8

Browse files
authored
Sync updates from stainless branch: main (#12)
1 parent 4330796 commit 77ad9c8

File tree

11 files changed

+329
-36
lines changed

11 files changed

+329
-36
lines changed

src/resources/agents/agents.ts

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,16 @@ export class Agents extends APIResource {
3333
steps: StepsAPI.Steps = new StepsAPI.Steps(this._client);
3434
turn: TurnAPI.TurnResource = new TurnAPI.TurnResource(this._client);
3535

36+
/**
37+
* Create an agent with the given configuration.
38+
*/
3639
create(body: AgentCreateParams, options?: Core.RequestOptions): Core.APIPromise<AgentCreateResponse> {
3740
return this._client.post('/v1/agents', { body, ...options });
3841
}
3942

43+
/**
44+
* Delete an agent by its ID.
45+
*/
4046
delete(agentId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
4147
return this._client.delete(`/v1/agents/${agentId}`, {
4248
...options,
@@ -45,69 +51,141 @@ export class Agents extends APIResource {
4551
}
4652
}
4753

54+
/**
55+
* An inference step in an agent turn.
56+
*/
4857
export interface InferenceStep {
4958
/**
50-
* A message containing the model's (assistant) response in a chat conversation.
59+
* The response from the LLM.
5160
*/
5261
model_response: Shared.CompletionMessage;
5362

63+
/**
64+
* The ID of the step.
65+
*/
5466
step_id: string;
5567

5668
step_type: 'inference';
5769

70+
/**
71+
* The ID of the turn.
72+
*/
5873
turn_id: string;
5974

75+
/**
76+
* The time the step completed.
77+
*/
6078
completed_at?: string;
6179

80+
/**
81+
* The time the step started.
82+
*/
6283
started_at?: string;
6384
}
6485

86+
/**
87+
* A memory retrieval step in an agent turn.
88+
*/
6589
export interface MemoryRetrievalStep {
6690
/**
67-
* A image content item
91+
* The context retrieved from the vector databases.
6892
*/
6993
inserted_context: Shared.InterleavedContent;
7094

95+
/**
96+
* The ID of the step.
97+
*/
7198
step_id: string;
7299

73100
step_type: 'memory_retrieval';
74101

102+
/**
103+
* The ID of the turn.
104+
*/
75105
turn_id: string;
76106

107+
/**
108+
* The IDs of the vector databases to retrieve context from.
109+
*/
77110
vector_db_ids: string;
78111

112+
/**
113+
* The time the step completed.
114+
*/
79115
completed_at?: string;
80116

117+
/**
118+
* The time the step started.
119+
*/
81120
started_at?: string;
82121
}
83122

123+
/**
124+
* A shield call step in an agent turn.
125+
*/
84126
export interface ShieldCallStep {
127+
/**
128+
* The ID of the step.
129+
*/
85130
step_id: string;
86131

87132
step_type: 'shield_call';
88133

134+
/**
135+
* The ID of the turn.
136+
*/
89137
turn_id: string;
90138

139+
/**
140+
* The time the step completed.
141+
*/
91142
completed_at?: string;
92143

144+
/**
145+
* The time the step started.
146+
*/
93147
started_at?: string;
94148

149+
/**
150+
* The violation from the shield call.
151+
*/
95152
violation?: Shared.SafetyViolation;
96153
}
97154

155+
/**
156+
* A tool execution step in an agent turn.
157+
*/
98158
export interface ToolExecutionStep {
159+
/**
160+
* The ID of the step.
161+
*/
99162
step_id: string;
100163

101164
step_type: 'tool_execution';
102165

166+
/**
167+
* The tool calls to execute.
168+
*/
103169
tool_calls: Array<Shared.ToolCall>;
104170

171+
/**
172+
* The tool responses from the tool calls.
173+
*/
105174
tool_responses: Array<ToolResponse>;
106175

176+
/**
177+
* The ID of the turn.
178+
*/
107179
turn_id: string;
108180

181+
/**
182+
* The time the step completed.
183+
*/
109184
completed_at?: string;
110185

186+
/**
187+
* The time the step started.
188+
*/
111189
started_at?: string;
112190
}
113191

@@ -129,6 +207,9 @@ export interface AgentCreateResponse {
129207
}
130208

131209
export interface AgentCreateParams {
210+
/**
211+
* The configuration for the agent.
212+
*/
132213
agent_config: Shared.AgentConfig;
133214
}
134215

src/resources/agents/session.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import * as Core from '../../core';
66
import * as TurnAPI from './turn';
77

88
export class SessionResource extends APIResource {
9+
/**
10+
* Create a new session for an agent.
11+
*/
912
create(
1013
agentId: string,
1114
body: SessionCreateParams,
@@ -14,6 +17,9 @@ export class SessionResource extends APIResource {
1417
return this._client.post(`/v1/agents/${agentId}/session`, { body, ...options });
1518
}
1619

20+
/**
21+
* Retrieve an agent session by its ID.
22+
*/
1723
retrieve(
1824
agentId: string,
1925
sessionId: string,
@@ -33,6 +39,9 @@ export class SessionResource extends APIResource {
3339
return this._client.get(`/v1/agents/${agentId}/session/${sessionId}`, { query, ...options });
3440
}
3541

42+
/**
43+
* Delete an agent session by its ID.
44+
*/
3645
delete(agentId: string, sessionId: string, options?: Core.RequestOptions): Core.APIPromise<void> {
3746
return this._client.delete(`/v1/agents/${agentId}/session/${sessionId}`, {
3847
...options,
@@ -59,10 +68,16 @@ export interface SessionCreateResponse {
5968
}
6069

6170
export interface SessionCreateParams {
71+
/**
72+
* The name of the session to create.
73+
*/
6274
session_name: string;
6375
}
6476

6577
export interface SessionRetrieveParams {
78+
/**
79+
* (Optional) List of turn IDs to filter the session by.
80+
*/
6681
turn_ids?: Array<string>;
6782
}
6883

src/resources/agents/steps.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ import * as Core from '../../core';
55
import * as AgentsAPI from './agents';
66

77
export class Steps extends APIResource {
8+
/**
9+
* Retrieve an agent step by its ID.
10+
*/
811
retrieve(
912
agentId: string,
1013
sessionId: string,
@@ -20,6 +23,9 @@ export class Steps extends APIResource {
2023
}
2124

2225
export interface StepRetrieveResponse {
26+
/**
27+
* An inference step in an agent turn.
28+
*/
2329
step:
2430
| AgentsAPI.InferenceStep
2531
| AgentsAPI.ToolExecutionStep

0 commit comments

Comments
 (0)