Repository navigation
Replies: 1 comment
|
Im need too |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Prerequisites
Background / Description
AgentScope v2 already has OpenTelemetry-based tracing primitives through
TracingMiddleware. The v2 tracking issues also indicate that OpenTelemetry tracing support was considered implemented:However, the current integration surface is still difficult to use from the application/service layer. In practice, users need to manually configure an OpenTelemetry exporter and manually inject
TracingMiddlewareinto agents or service-level middleware factories.My concrete problem is that I wanted to send real AgentScope v2 service traces to a local Langfuse instance via OTLP. To make this work, I had to add a local adapter file,
src/agentscope/app/_observability.py, and patchcreate_app()to wrapextra_agent_middlewaresso thatTracingMiddlewareis automatically injected when tracing is enabled.That feels like a framework-level concern rather than something every application should implement independently. A user who wants observability should not have to write an
_observability.pyadapter just to activate the tracing capability that already exists in AgentScope.Current Behavior
In AgentScope v2:
TracingMiddlewarecan generate spans for agent replies, model calls, and tool execution.ChatServiceonly appends caller-providedextra_agent_middlewares.create_app()does not expose a first-class observability/tracing option.agentscope.init(studio_url=..., tracing_url=...).As a result, users currently need to know internal assembly details and write custom glue code similar to:
They also need separate code to configure the OpenTelemetry
TracerProviderand OTLP exporter. This is surprising because the tracing middleware already exists and the changelog says OpenTelemetry-based tracing and third-party tracing platforms are supported.Expected Behavior
AgentScope v2 should provide a first-class observability activation layer that makes tracing easy to enable for both direct agent usage and service/web UI usage.
The goal is not merely "env-configured OpenTelemetry". Environment variables are useful, but they should be one configuration source for a more intuitive activation model.
Possible API shapes:
or:
or:
The implementation can still support standard OpenTelemetry environment variables:
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://localhost:3000/api/public/otel/v1/traces OTEL_EXPORTER_OTLP_HEADERS='Authorization=Basic ...,x-langfuse-ingestion-version=4' OTEL_SERVICE_NAME=agentscope-serviceBut users should not have to manually wire
TracingMiddlewareinto the service or agent assembly path.Why This Matters
Agent applications are usually debugged through complete execution traces:
For example, while debugging an agent-team issue, I needed to inspect whether the worker agent received the
TeamSaytool and whether the model chose to call it. Langfuse was a good fit for this, but AgentScope required custom application glue before the OTel spans could be emitted from the service path.This creates a confusing experience:
This also makes every production application repeat the same integration code for Langfuse, Phoenix, OpenTelemetry Collector, or other OTLP-compatible backends.
Related Issues / Context
ChatService, which is related because observability currently relies on manual middleware injection.Prior Art
Other agent frameworks usually expose a clear activation surface instead of requiring users to manually inject internal tracing middleware:
Agent.instrument_all(...)/ per-agent instrumentation.LlamaIndexInstrumentor().instrument(...).AgentScope v2 would benefit from a similarly clear activation layer while keeping OpenTelemetry as the backend-neutral foundation.
Proposed Acceptance Criteria
create_app()/ChatServicecan automatically attachTracingMiddlewarewhen observability is enabled.Agent(...)usage has an intuitive tracing activation path.agentscope.init(tracing_url=...)path.Contribution
I am willing to contribute code for this enhancement once the expected API shape is aligned with the maintainers.
Environment
mainAll reactions