Skip to content

Commit 8061ee8

Browse files
committed
feat(core): Add shared GenAI agent attribute constants
1 parent 0d2e3b1 commit 8061ee8

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

packages/core/src/index.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,22 @@ export { instrumentStateGraphCompile, instrumentLangGraph } from './tracing/lang
156156
export { LANGGRAPH_INTEGRATION_NAME } from './tracing/langgraph/constants';
157157
export type { LangGraphOptions, LangGraphIntegration, CompiledGraph } from './tracing/langgraph/types';
158158
export type { OpenAiClient, OpenAiOptions, InstrumentedMethod } from './tracing/openai/types';
159+
export { setTokenUsageAttributes } from './tracing/ai/utils';
160+
export {
161+
GEN_AI_AGENT_NAME_ATTRIBUTE,
162+
GEN_AI_OPERATION_NAME_ATTRIBUTE,
163+
GEN_AI_REQUEST_MESSAGES_ATTRIBUTE,
164+
GEN_AI_REQUEST_MODEL_ATTRIBUTE,
165+
GEN_AI_RESPONSE_ID_ATTRIBUTE,
166+
GEN_AI_RESPONSE_MODEL_ATTRIBUTE,
167+
GEN_AI_RESPONSE_TEXT_ATTRIBUTE,
168+
GEN_AI_RESPONSE_TOOL_CALLS_ATTRIBUTE,
169+
GEN_AI_SYSTEM_ATTRIBUTE,
170+
GEN_AI_TOOL_INPUT_ATTRIBUTE,
171+
GEN_AI_TOOL_NAME_ATTRIBUTE,
172+
GEN_AI_TOOL_OUTPUT_ATTRIBUTE,
173+
GEN_AI_TOOL_TYPE_ATTRIBUTE,
174+
} from './tracing/ai/gen-ai-attributes';
159175
export type {
160176
AnthropicAiClient,
161177
AnthropicAiOptions,

packages/core/src/tracing/ai/gen-ai-attributes.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,35 @@ export const GEN_AI_USAGE_INPUT_TOKENS_CACHED_ATTRIBUTE = 'gen_ai.usage.input_to
179179
*/
180180
export const GEN_AI_INVOKE_AGENT_OPERATION_ATTRIBUTE = 'gen_ai.invoke_agent';
181181

182+
// =============================================================================
183+
// AI AGENT ATTRIBUTES
184+
// =============================================================================
185+
186+
/**
187+
* The name of the AI agent
188+
*/
189+
export const GEN_AI_AGENT_NAME_ATTRIBUTE = 'gen_ai.agent.name';
190+
191+
/**
192+
* The name of the tool being executed
193+
*/
194+
export const GEN_AI_TOOL_NAME_ATTRIBUTE = 'gen_ai.tool.name';
195+
196+
/**
197+
* The type of the tool: 'function', 'extension', or 'datastore'
198+
*/
199+
export const GEN_AI_TOOL_TYPE_ATTRIBUTE = 'gen_ai.tool.type';
200+
201+
/**
202+
* The input parameters for a tool call
203+
*/
204+
export const GEN_AI_TOOL_INPUT_ATTRIBUTE = 'gen_ai.tool.input';
205+
206+
/**
207+
* The output/result of a tool call
208+
*/
209+
export const GEN_AI_TOOL_OUTPUT_ATTRIBUTE = 'gen_ai.tool.output';
210+
182211
// =============================================================================
183212
// OPENAI-SPECIFIC ATTRIBUTES
184213
// =============================================================================

0 commit comments

Comments
 (0)