Skip to content

GenAI utils | Invoke Agent demo app#4340

Draft
etserend wants to merge 17 commits intoopen-telemetry:mainfrom
etserend:genai-utils/invoke-agent-demo
Draft

GenAI utils | Invoke Agent demo app#4340
etserend wants to merge 17 commits intoopen-telemetry:mainfrom
etserend:genai-utils/invoke-agent-demo

Conversation

@etserend
Copy link

@etserend etserend commented Mar 17, 2026

Description

Adds AgentInvocation type and agent() context manager to opentelemetry-util-genai, enabling instrumentation of agent invocation lifecycle events with OpenTelemetry spans following the GenAI agent semantic conventions.

This is the second in a series of PRs adding agent lifecycle telemetry (following create_agent in #4217).

Example trace output:

Trace (e71e16deb2ecd162e3f4fc67c240818b)
└── invoke_agent Currency Exchange Agent (4.16s, Client)
    ├── gen_ai.operation.name: invoke_agent
    ├── gen_ai.agent.name: Currency Exchange Agent
    ├── gen_ai.agent.description: Currency exchange agent demo
    ├── gen_ai.provider.name: gcp_vertex_ai
    ├── gen_ai.request.model: gemini-2.5-flash
    ├── gen_ai.response.finish_reasons: ["stop"]
    ├── gen_ai.usage.input_tokens: 12
    ├── gen_ai.usage.output_tokens: 87
    ├── server.address: us-central1-aiplatform.googleapis.com
    │
    └── chat gemini-2.5-flash (4.12s, Client)
        ├── gen_ai.operation.name: chat
        ├── gen_ai.system: vertex_ai
        ├── gen_ai.request.model: gemini-2.5-flash
        ├── gen_ai.response.model: gemini-2.5-flash
        ├── gen_ai.response.finish_reasons: ["stop"]
        ├── gen_ai.usage.input_tokens: 12
        ├── gen_ai.usage.output_tokens: 87
        ├── server.address: us-central1-aiplatform.googleapis.com
        └── server.port: 443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants