Skip to content

Commit 691abcc

Browse files
committed
Merge branch 'master' into p_sync/pull
2 parents 8ac8a87 + 21c7be1 commit 691abcc

10 files changed

Lines changed: 69 additions & 49 deletions

File tree

reference.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6267,7 +6267,7 @@ to the original messages in the log.
62676267
<dd>
62686268

62696269
```typescript
6270-
await client.agents.continue({
6270+
await client.agents.continueCall({
62716271
logId: "log_id",
62726272
messages: [
62736273
{

src/api/resources/agents/client/Client.ts

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ export class Agents {
156156
logId: string,
157157
request: Humanloop.UpdateAgentLogRequest = {},
158158
requestOptions?: Agents.RequestOptions,
159-
): Promise<Humanloop.LogResponse> {
159+
): Promise<Humanloop.AgentLogResponse> {
160160
const _response = await (this._options.fetcher ?? core.fetcher)({
161161
url: urlJoin(
162162
(await core.Supplier.get(this._options.baseUrl)) ??
@@ -183,7 +183,7 @@ export class Agents {
183183
abortSignal: requestOptions?.abortSignal,
184184
});
185185
if (_response.ok) {
186-
return serializers.LogResponse.parseOrThrow(_response.body, {
186+
return serializers.AgentLogResponse.parseOrThrow(_response.body, {
187187
unrecognizedObjectKeys: "passthrough",
188188
allowUnrecognizedUnionMembers: true,
189189
allowUnrecognizedEnumValues: true,
@@ -230,18 +230,21 @@ export class Agents {
230230
}
231231

232232
/**
233-
* Call an Agent.
233+
* Call an Agent. The Agent will run on the Humanloop runtime and return a completed Agent Log.
234234
*
235-
* Calling an Agent calls the model provider before logging
236-
* the request, responses and metadata to Humanloop.
235+
* If the Agent requires a tool call that cannot be ran by Humanloop, execution will halt. To continue,
236+
* pass the ID of the incomplete Log and the required tool call to the /agents/continue endpoint.
237+
*
238+
* The agent will run for the maximum number of iterations, or until it encounters a stop condition,
239+
* according to its configuration.
237240
*
238241
* You can use query parameters `version_id`, or `environment`, to target
239242
* an existing version of the Agent. Otherwise the default deployed version will be chosen.
240243
*
241244
* Instead of targeting an existing version explicitly, you can instead pass in
242-
* Agent details in the request body. In this case, we will check if the details correspond
243-
* to an existing version of the Agent. If they do not, we will create a new version. This is helpful
244-
* in the case where you are storing or deriving your Agent details in code.
245+
* Agent details in the request body. A new version is created if it does not match
246+
* any existing ones. This is helpful in the case where you are storing or deriving
247+
* your Agent details in code.
245248
*/
246249
public async callStream(
247250
request: Humanloop.AgentsCallStreamRequest,
@@ -343,18 +346,21 @@ export class Agents {
343346
}
344347

345348
/**
346-
* Call an Agent.
349+
* Call an Agent. The Agent will run on the Humanloop runtime and return a completed Agent Log.
350+
*
351+
* If the Agent requires a tool call that cannot be ran by Humanloop, execution will halt. To continue,
352+
* pass the ID of the incomplete Log and the required tool call to the /agents/continue endpoint.
347353
*
348-
* Calling an Agent calls the model provider before logging
349-
* the request, responses and metadata to Humanloop.
354+
* The agent will run for the maximum number of iterations, or until it encounters a stop condition,
355+
* according to its configuration.
350356
*
351357
* You can use query parameters `version_id`, or `environment`, to target
352358
* an existing version of the Agent. Otherwise the default deployed version will be chosen.
353359
*
354360
* Instead of targeting an existing version explicitly, you can instead pass in
355-
* Agent details in the request body. In this case, we will check if the details correspond
356-
* to an existing version of the Agent. If they do not, we will create a new version. This is helpful
357-
* in the case where you are storing or deriving your Agent details in code.
361+
* Agent details in the request body. A new version is created if it does not match
362+
* any existing ones. This is helpful in the case where you are storing or deriving
363+
* your Agent details in code.
358364
*
359365
* @param {Humanloop.AgentsCallRequest} request
360366
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
@@ -455,16 +461,16 @@ export class Agents {
455461
/**
456462
* Continue an incomplete Agent call.
457463
*
458-
* This endpoint allows continuing an existing incomplete Agent call, using the context
459-
* from the previous interaction. The Agent will resume processing from where it left off.
464+
* This endpoint allows continuing an existing incomplete Agent call, by passing the tool call
465+
* requested by the Agent. The Agent will resume processing from where it left off.
460466
*
461-
* The original log must be in an incomplete state to be continued.
467+
* The messages in the request will be appended to the original messages in the Log. You do not
468+
* have to provide the previous conversation history.
462469
*
463-
* The messages in the request will be appended
464-
* to the original messages in the log.
470+
* The original log must be in an incomplete state to be continued.
465471
*/
466-
public async continueStream(
467-
request: Humanloop.AgentsContinueStreamRequest,
472+
public async continueCallStream(
473+
request: Humanloop.AgentsContinueCallStreamRequest,
468474
requestOptions?: Agents.RequestOptions,
469475
): Promise<core.Stream<Humanloop.AgentContinueStreamResponse>> {
470476
const _response = await (this._options.fetcher ?? core.fetcher)<stream.Readable>({
@@ -488,7 +494,9 @@ export class Agents {
488494
contentType: "application/json",
489495
requestType: "json",
490496
body: {
491-
...serializers.AgentsContinueStreamRequest.jsonOrThrow(request, { unrecognizedObjectKeys: "strip" }),
497+
...serializers.AgentsContinueCallStreamRequest.jsonOrThrow(request, {
498+
unrecognizedObjectKeys: "strip",
499+
}),
492500
stream: true,
493501
},
494502
responseType: "sse",
@@ -554,29 +562,29 @@ export class Agents {
554562
/**
555563
* Continue an incomplete Agent call.
556564
*
557-
* This endpoint allows continuing an existing incomplete Agent call, using the context
558-
* from the previous interaction. The Agent will resume processing from where it left off.
565+
* This endpoint allows continuing an existing incomplete Agent call, by passing the tool call
566+
* requested by the Agent. The Agent will resume processing from where it left off.
559567
*
560-
* The original log must be in an incomplete state to be continued.
568+
* The messages in the request will be appended to the original messages in the Log. You do not
569+
* have to provide the previous conversation history.
561570
*
562-
* The messages in the request will be appended
563-
* to the original messages in the log.
571+
* The original log must be in an incomplete state to be continued.
564572
*
565-
* @param {Humanloop.AgentsContinueRequest} request
573+
* @param {Humanloop.AgentsContinueCallRequest} request
566574
* @param {Agents.RequestOptions} requestOptions - Request-specific configuration.
567575
*
568576
* @throws {@link Humanloop.UnprocessableEntityError}
569577
*
570578
* @example
571-
* await client.agents.continue({
579+
* await client.agents.continueCall({
572580
* logId: "log_id",
573581
* messages: [{
574582
* role: "user"
575583
* }]
576584
* })
577585
*/
578-
public async continue(
579-
request: Humanloop.AgentsContinueRequest,
586+
public async continueCall(
587+
request: Humanloop.AgentsContinueCallRequest,
580588
requestOptions?: Agents.RequestOptions,
581589
): Promise<Humanloop.AgentContinueResponse> {
582590
const _response = await (this._options.fetcher ?? core.fetcher)({

src/api/resources/agents/client/requests/AgentsContinueStreamRequest.ts renamed to src/api/resources/agents/client/requests/AgentsContinueCallRequest.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import * as Humanloop from "../../../../index";
1313
* }]
1414
* }
1515
*/
16-
export interface AgentsContinueStreamRequest {
16+
export interface AgentsContinueCallRequest {
1717
/** This identifies the Agent Log to continue. */
1818
logId: string;
1919
/** The additional messages with which to continue the Agent Log. Often, these should start with the Tool messages with results for the previous Assistant message's tool calls. */

src/api/types/AgentResponse.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,6 @@ export interface AgentResponse {
100100
evaluators?: Humanloop.MonitoringEvaluatorResponse[];
101101
/** Aggregation of Evaluator results for the Agent Version. */
102102
evaluatorAggregates?: Humanloop.EvaluatorAggregate[];
103+
/** The raw content of the Agent. Corresponds to the .agent file. */
104+
rawFileContent?: string;
103105
}

src/api/types/PopulateTemplateResponse.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ export interface PopulateTemplateResponse {
9494
evaluators?: Humanloop.MonitoringEvaluatorResponse[];
9595
/** Aggregation of Evaluator results for the Prompt Version. */
9696
evaluatorAggregates?: Humanloop.EvaluatorAggregate[];
97+
/** The raw content of the Prompt. Corresponds to the .prompt file. */
98+
rawFileContent?: string;
9799
/** The template populated with the input values you provided in the request. Returns None if no template exists. */
98100
populatedTemplate?: Humanloop.PopulateTemplateResponsePopulatedTemplate;
99101
}

src/api/types/PromptResponse.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,6 @@ export interface PromptResponse {
9494
evaluators?: Humanloop.MonitoringEvaluatorResponse[];
9595
/** Aggregation of Evaluator results for the Prompt Version. */
9696
evaluatorAggregates?: Humanloop.EvaluatorAggregate[];
97+
/** The raw content of the Prompt. Corresponds to the .prompt file. */
98+
rawFileContent?: string;
9799
}

src/serialization/types/AgentResponse.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export const AgentResponse: core.serialization.ObjectSchema<serializers.AgentRes
6868
"evaluator_aggregates",
6969
core.serialization.list(EvaluatorAggregate).optional(),
7070
),
71+
rawFileContent: core.serialization.property("raw_file_content", core.serialization.string().optional()),
7172
});
7273

7374
export declare namespace AgentResponse {
@@ -115,5 +116,6 @@ export declare namespace AgentResponse {
115116
inputs: InputResponse.Raw[];
116117
evaluators?: serializers.MonitoringEvaluatorResponse.Raw[] | null;
117118
evaluator_aggregates?: EvaluatorAggregate.Raw[] | null;
119+
raw_file_content?: string | null;
118120
}
119121
}

src/serialization/types/PopulateTemplateResponse.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const PopulateTemplateResponse: core.serialization.ObjectSchema<
7272
"evaluator_aggregates",
7373
core.serialization.list(EvaluatorAggregate).optional(),
7474
),
75+
rawFileContent: core.serialization.property("raw_file_content", core.serialization.string().optional()),
7576
populatedTemplate: core.serialization.property(
7677
"populated_template",
7778
PopulateTemplateResponsePopulatedTemplate.optional(),
@@ -120,6 +121,7 @@ export declare namespace PopulateTemplateResponse {
120121
inputs: InputResponse.Raw[];
121122
evaluators?: serializers.MonitoringEvaluatorResponse.Raw[] | null;
122123
evaluator_aggregates?: EvaluatorAggregate.Raw[] | null;
124+
raw_file_content?: string | null;
123125
populated_template?: PopulateTemplateResponsePopulatedTemplate.Raw | null;
124126
}
125127
}

src/serialization/types/PromptResponse.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ export const PromptResponse: core.serialization.ObjectSchema<serializers.PromptR
6969
"evaluator_aggregates",
7070
core.serialization.list(EvaluatorAggregate).optional(),
7171
),
72+
rawFileContent: core.serialization.property("raw_file_content", core.serialization.string().optional()),
7273
});
7374

7475
export declare namespace PromptResponse {
@@ -113,5 +114,6 @@ export declare namespace PromptResponse {
113114
inputs: InputResponse.Raw[];
114115
evaluators?: serializers.MonitoringEvaluatorResponse.Raw[] | null;
115116
evaluator_aggregates?: EvaluatorAggregate.Raw[] | null;
117+
raw_file_content?: string | null;
116118
}
117119
}

yarn.lock

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -559,10 +559,10 @@
559559
js-tokens "^4.0.0"
560560
picocolors "^1.1.1"
561561

562-
"@babel/compat-data@^7.27.1":
563-
version "7.27.1"
564-
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.27.1.tgz#db7cf122745e0a332c44e847ddc4f5e5221a43f6"
565-
integrity sha512-Q+E+rd/yBzNQhXkG+zQnF58e4zoZfBedaxwzPmicKsiK3nt8iJYrSrDbjwFFDGC4f+rPafqRaPH6TsDoSvMf7A==
562+
"@babel/compat-data@^7.27.2":
563+
version "7.27.2"
564+
resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.27.2.tgz#4183f9e642fd84e74e3eea7ffa93a412e3b102c9"
565+
integrity sha512-TUtMJYRPyUb/9aU8f3K0mjmjf6M9N5Woshn2CS6nqJSeJtTtQcpLUXjGt9vbF8ZGff0El99sWkLgzwW3VXnxZQ==
566566

567567
"@babel/core@^7.11.6", "@babel/core@^7.12.3", "@babel/core@^7.23.9":
568568
version "7.27.1"
@@ -606,11 +606,11 @@
606606
jsesc "^3.0.2"
607607

608608
"@babel/helper-compilation-targets@^7.27.1":
609-
version "7.27.1"
610-
resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.1.tgz#eac1096c7374f161e4f33fc8ae38f4ddf122087a"
611-
integrity sha512-2YaDd/Rd9E598B5+WIc8wJPmWETiiJXFYVE60oX8FDohv7rAUU3CQj+A1MgeEmcsk2+dQuEjIe/GDvig0SqL4g==
609+
version "7.27.2"
610+
resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.27.2.tgz#46a0f6efab808d51d29ce96858dd10ce8732733d"
611+
integrity sha512-2+1thGUUWWjLTYTHZWK1n8Yga0ijBz1XAhUXcKy81rd5g6yh7hGqMp45v7cadSbEHc9G3OTv45SyneRN3ps4DQ==
612612
dependencies:
613-
"@babel/compat-data" "^7.27.1"
613+
"@babel/compat-data" "^7.27.2"
614614
"@babel/helper-validator-option" "^7.27.1"
615615
browserslist "^4.24.0"
616616
lru-cache "^5.1.1"
@@ -690,10 +690,10 @@
690690
"@babel/template" "^7.27.1"
691691
"@babel/types" "^7.27.1"
692692

693-
"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.5", "@babel/parser@^7.20.7", "@babel/parser@^7.23.0", "@babel/parser@^7.23.9", "@babel/parser@^7.27.1":
694-
version "7.27.1"
695-
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.1.tgz#c55d5bed74449d1223701f1869b9ee345cc94cc9"
696-
integrity sha512-I0dZ3ZpCrJ1c04OqlNsQcKiZlsrXf/kkE4FXzID9rIOYICsAbA8mMDzhW/luRNAHdCNt7os/u8wenklZDlUVUQ==
693+
"@babel/parser@^7.1.0", "@babel/parser@^7.14.7", "@babel/parser@^7.20.5", "@babel/parser@^7.20.7", "@babel/parser@^7.23.0", "@babel/parser@^7.23.9", "@babel/parser@^7.27.1", "@babel/parser@^7.27.2":
694+
version "7.27.2"
695+
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.27.2.tgz#577518bedb17a2ce4212afd052e01f7df0941127"
696+
integrity sha512-QYLs8299NA7WM/bZAdp+CviYYkVoYXlDW2rzliy3chxd1PQjej7JORuMJDJXJUb9g0TT+B99EwaVLKmX+sPXWw==
697697
dependencies:
698698
"@babel/types" "^7.27.1"
699699

@@ -817,12 +817,12 @@
817817
"@babel/helper-plugin-utils" "^7.27.1"
818818

819819
"@babel/template@^7.24.7", "@babel/template@^7.27.1", "@babel/template@^7.3.3":
820-
version "7.27.1"
821-
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.1.tgz#b9e4f55c17a92312774dfbdde1b3c01c547bbae2"
822-
integrity sha512-Fyo3ghWMqkHHpHQCoBs2VnYjR4iWFFjguTDEqA5WgZDOrFesVjMhMM2FSqTKSoUSDO1VQtavj8NFpdRBEvJTtg==
820+
version "7.27.2"
821+
resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.27.2.tgz#fa78ceed3c4e7b63ebf6cb39e5852fca45f6809d"
822+
integrity sha512-LPDZ85aEJyYSd18/DkjNh4/y1ntkE5KwUHWTiqgRxruuZL2F1yuHligVHLvcHY2vMHXttKFpJn6LwfI7cw7ODw==
823823
dependencies:
824824
"@babel/code-frame" "^7.27.1"
825-
"@babel/parser" "^7.27.1"
825+
"@babel/parser" "^7.27.2"
826826
"@babel/types" "^7.27.1"
827827

828828
"@babel/traverse@7.23.2":

0 commit comments

Comments
 (0)