Skip to content

Commit 2e5e9ef

Browse files
author
Andrei Bratu
committed
overload log for agents
1 parent 213b4de commit 2e5e9ef

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

src/humanloop.client.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { NodeTracerProvider } from "@opentelemetry/sdk-trace-node";
88
import { AnthropicInstrumentation } from "@traceloop/instrumentation-anthropic";
99
import { CohereInstrumentation } from "@traceloop/instrumentation-cohere";
1010
import { OpenAIInstrumentation } from "@traceloop/instrumentation-openai";
11+
import { Agents } from "api/resources/agents/client/Client";
1112

1213
import { HumanloopClient as BaseHumanloopClient } from "./Client";
1314
import { ChatMessage } from "./api";
@@ -216,6 +217,7 @@ export class HumanloopClient extends BaseHumanloopClient {
216217
protected readonly _flows_overloaded: Flows;
217218
protected readonly _tools_overloaded: Tools;
218219
protected readonly _evaluators_overloaded: Evaluators;
220+
protected readonly _agents_overloaded: Agents;
219221
protected readonly instrumentProviders: {
220222
OpenAI?: any;
221223
Anthropic?: any;
@@ -276,6 +278,8 @@ export class HumanloopClient extends BaseHumanloopClient {
276278

277279
this._evaluators_overloaded = overloadLog(super.evaluators);
278280

281+
this._agents_overloaded = overloadLog(super.agents);
282+
279283
this._evaluations = new ExtendedEvaluations(_options, this);
280284

281285
// Initialize the tracer singleton
@@ -571,6 +575,10 @@ ${RESET}`,
571575
return this._evaluations;
572576
}
573577

578+
public get agents(): Agents {
579+
return this._agents_overloaded;
580+
}
581+
574582
public get prompts(): Prompts {
575583
return this._prompts_overloaded;
576584
}

src/overload.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Agents } from "api/resources/agents/client/Client";
12
import {
23
CreateEvaluatorLogRequest,
34
FlowLogRequest,
@@ -12,7 +13,7 @@ import { Tools } from "./api/resources/tools/client/Client";
1213
import { getDecoratorContext, getEvaluationContext, getTraceId } from "./context";
1314
import { HumanloopRuntimeError } from "./error";
1415

15-
export function overloadLog<T extends Flows | Prompts | Tools | Evaluators>(
16+
export function overloadLog<T extends Flows | Prompts | Tools | Evaluators | Agents>(
1617
client: T,
1718
): T {
1819
const originalLog = client.log.bind(client);
@@ -35,7 +36,9 @@ export function overloadLog<T extends Flows | Prompts | Tools | Evaluators>(
3536
? Tools.RequestOptions
3637
: T extends Evaluators
3738
? Evaluators.RequestOptions
38-
: never,
39+
: T extends Agents
40+
? Agents.RequestOptions
41+
: never,
3942
) => {
4043
const traceId = getTraceId();
4144
if (traceId !== undefined && client instanceof Flows) {

0 commit comments

Comments
 (0)