@looopy-ai/core 2.1.2 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/core/agent.js
CHANGED
|
@@ -184,6 +184,7 @@ export class Agent {
|
|
|
184
184
|
switch (event.kind) {
|
|
185
185
|
case 'content-complete':
|
|
186
186
|
if (event.content || event.toolCalls) {
|
|
187
|
+
logger.debug({ event }, 'Saving content-complete to message store');
|
|
187
188
|
await this.config.messageStore.append(this.config.contextId, [
|
|
188
189
|
{
|
|
189
190
|
role: 'assistant',
|
|
@@ -201,6 +202,7 @@ export class Agent {
|
|
|
201
202
|
}
|
|
202
203
|
break;
|
|
203
204
|
case 'tool-complete': {
|
|
205
|
+
logger.debug({ event }, 'Saving tool-complete to message store');
|
|
204
206
|
const message = {
|
|
205
207
|
role: 'tool',
|
|
206
208
|
content: JSON.stringify({
|
|
@@ -210,12 +212,11 @@ export class Agent {
|
|
|
210
212
|
}),
|
|
211
213
|
toolCallId: event.toolCallId,
|
|
212
214
|
};
|
|
213
|
-
logger.debug({ message }, 'Saving tool message to message store');
|
|
214
215
|
await this.config.messageStore.append(this.config.contextId, [message]);
|
|
215
216
|
break;
|
|
216
217
|
}
|
|
217
218
|
case 'internal:tool-message':
|
|
218
|
-
logger.debug({
|
|
219
|
+
logger.debug({ event }, 'Saving internal:tool-message to message store');
|
|
219
220
|
await this.config.messageStore.append(this.config.contextId, [event.message]);
|
|
220
221
|
break;
|
|
221
222
|
default:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { consumeSSEStream } from '@geee-be/sse-stream-parser';
|
|
2
|
+
import { trace } from '@opentelemetry/api';
|
|
2
3
|
import { Observable } from 'rxjs';
|
|
3
4
|
import z from 'zod';
|
|
4
5
|
import { getLogger } from '../core';
|
|
@@ -96,11 +97,13 @@ export class AgentToolProvider {
|
|
|
96
97
|
subscriber.complete();
|
|
97
98
|
return;
|
|
98
99
|
}
|
|
100
|
+
const span = trace.getSpan(context.parentContext);
|
|
101
|
+
span?.updateName(`agent.invoke[${toolCall.function.name}]`);
|
|
99
102
|
const res = await fetch(`${this.card.url}/invocations?qualifier=DEFAULT`, {
|
|
100
103
|
method: 'POST',
|
|
101
104
|
headers: {
|
|
102
105
|
Accept: 'text/event-stream',
|
|
103
|
-
'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id': context.contextId
|
|
106
|
+
'X-Amzn-Bedrock-AgentCore-Runtime-Session-Id': `${context.contextId}-${this.agentName}`,
|
|
104
107
|
...(await this.getHeaders?.(context, this.card)),
|
|
105
108
|
},
|
|
106
109
|
body: JSON.stringify({ prompt }),
|