Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added AI Agent Semantic Convention #1739

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

gyliu513
Copy link
Member

Fixes #1732

Changes

Please provide a brief description of the changes here.

Note: if the PR is touching an area that is not listed in the existing areas, or the area does not have sufficient domain experts coverage, the PR might be tagged as experts needed and move slowly until experts are identified.

Merge requirement checklist

@gyliu513 gyliu513 requested review from a team as code owners January 13, 2025 20:05
@gyliu513 gyliu513 marked this pull request as draft January 13, 2025 20:06
@gyliu513 gyliu513 force-pushed the agent-sc branch 8 times, most recently from e814811 to 7b7efce Compare January 15, 2025 21:06
@gyliu513 gyliu513 marked this pull request as ready for review January 15, 2025 21:12
Copy link
Contributor

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start!

.chloggen/1732.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/spans.yaml Outdated Show resolved Hide resolved
model/gen-ai/spans.yaml Outdated Show resolved Hide resolved
docs/gen-ai/gen-ai-agent-spans.md Outdated Show resolved Hide resolved
Copy link
Member Author

@gyliu513 gyliu513 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lmolkova thanks for all of your comments, most of them are addressed now, but I still need to check how to define the tool datastore, let me check more for this.

.chloggen/1732.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/spans.yaml Outdated Show resolved Hide resolved
model/gen-ai/spans.yaml Outdated Show resolved Hide resolved
docs/gen-ai/gen-ai-agent-spans.md Outdated Show resolved Hide resolved
@gyliu513 gyliu513 force-pushed the agent-sc branch 5 times, most recently from 5628dbe to 9904399 Compare January 17, 2025 03:45
Copy link
Contributor

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, it looks great, left a small comment

model/gen-ai/spans.yaml Outdated Show resolved Hide resolved
model/gen-ai/registry.yaml Outdated Show resolved Hide resolved
model/gen-ai/spans.yaml Outdated Show resolved Hide resolved
@github-actions github-actions bot added the enhancement New feature or request label Jan 23, 2025
---

`gen_ai.operation.name` has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used.

| Value | Description | Stability |
|---|---|---|
| `chat` | Chat completion operation such as [OpenAI Chat API](https://platform.openai.com/docs/api-reference/chat) | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| `create_agent` | Create GenAI agent | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to trace create_agent? not that I have a strong opinion about this. But, it may not be that valuable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karthikscale3 this is important if we have multiple agents, with multiple agents, the agents may have some strict sequence to create, to run etc.

Copy link
Contributor

@karthikscale3 karthikscale3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice first pass! thanks

@@ -17,6 +17,9 @@ This document defines the attributes used to describe telemetry in the context o

| Attribute | Type | Description | Examples | Stability |
|---|---|---|---|---|
| <a id="gen-ai-agent-description" href="#gen-ai-agent-description">`gen_ai.agent.description`</a> | string | Free-form description of the GenAI agent provided by the application. | `Helps with math problems`; `Generates fiction stories` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we also want the instruction given to the agent?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, usually the instruction will act as prompt for the models.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TaoChenOSU do you mean we need to add a new attribute for instruction?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, maybe in the create agent span. Some services embed the instruction into a large prompt, such as Bedrock agent.

@@ -33,6 +36,9 @@ This document defines the attributes used to describe telemetry in the context o
| <a id="gen-ai-response-model" href="#gen-ai-response-model">`gen_ai.response.model`</a> | string | The name of the model that generated the response. | `gpt-4-0613` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="gen-ai-system" href="#gen-ai-system">`gen_ai.system`</a> | string | The Generative AI product as identified by the client or server instrumentation. [3] | `openai` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="gen-ai-token-type" href="#gen-ai-token-type">`gen_ai.token.type`</a> | string | The type of token being counted. | `input`; `output` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="gen-ai-tool-call-id" href="#gen-ai-tool-call-id">`gen_ai.tool.call.id`</a> | string | The tool call identifier. | `call_mszuSIzqtI65i1wAUOE8w5H4` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="gen-ai-tool-name" href="#gen-ai-tool-name">`gen_ai.tool.name`</a> | string | Name of the tool utilized by the agent. | `Flights` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Models can sometimes call multiple tools in parallel. Maybe this needs to be a list?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, let me check how to update this to a list.

@@ -33,6 +36,9 @@ This document defines the attributes used to describe telemetry in the context o
| <a id="gen-ai-response-model" href="#gen-ai-response-model">`gen_ai.response.model`</a> | string | The name of the model that generated the response. | `gpt-4-0613` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="gen-ai-system" href="#gen-ai-system">`gen_ai.system`</a> | string | The Generative AI product as identified by the client or server instrumentation. [3] | `openai` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="gen-ai-token-type" href="#gen-ai-token-type">`gen_ai.token.type`</a> | string | The type of token being counted. | `input`; `output` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
| <a id="gen-ai-tool-call-id" href="#gen-ai-tool-call-id">`gen_ai.tool.call.id`</a> | string | The tool call identifier. | `call_mszuSIzqtI65i1wAUOE8w5H4` | ![Experimental](https://img.shields.io/badge/-experimental-blue) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we consider recording the tools available to the agents or simple the models? This is also requested in this issue: #1760

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should belong to event with https://github.com/open-telemetry/semantic-conventions/blob/main/docs/gen-ai/gen-ai-events.md#event-gen_aitoolmessage , we probably need to update event to reflect this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tool message event is different as it records the responses from invoking the tools. We currently don't have a way to record what tools are available to the model or agent to invoke.


## Spans

### Create Agent Span
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also consider a span for agent invocation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Needs More Approval
Development

Successfully merging this pull request may close these issues.

AI Agent Semantic Convention
4 participants