Add A365 S2S exporter sample - #217
Conversation
Add a self-contained sample under samples/a365_s2s/ demonstrating A365 telemetry export using the S2S (service-to-service) flow: - Custom a365_token_resolver mirroring the SDK FIC flow (app -> instance token exchange via MSAL) minus the agentic-user step, plus a365_use_s2s_endpoint=True. - Manual A365 scope classes (InvokeAgent/Inference/ExecuteTool), so the sample needs no LLM. - uv-managed project (pyproject.toml), .env via python-dotenv, and DEBUG logging so developers can see the export HTTP status and correlation id. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Performance comparisonThreshold: regressions >15.0% on gating scenarios fail the build. Higher ops/s is better; positive Δ means the PR is slower.
|
There was a problem hiding this comment.
Pull request overview
Adds a new self-contained sample under samples/a365_s2s/ that demonstrates exporting Agent 365 (A365) telemetry via the service-to-service (S2S) authentication flow, including a custom MSAL-based token resolver and manual scope instrumentation.
Changes:
- Introduces an S2S sample script that configures the A365 exporter for the S2S ingest endpoint and emits representative spans using manual A365 scope classes.
- Adds sample documentation +
.envtemplate describing required credentials, runtime toggles, and expected DEBUG exporter output. - Adds an
uv-managed sample project (with lockfile) to make the sample runnable without manual venv setup.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| samples/a365_s2s/s2s_exporter.py | Implements the S2S token resolver and a runnable manual-telemetry scenario configured for the S2S exporter endpoint. |
| samples/a365_s2s/README.md | Documents prerequisites, setup, execution, and required environment variables for the S2S scenario. |
| samples/a365_s2s/pyproject.toml | Defines a small uv project with runtime dependencies for the sample. |
| samples/a365_s2s/.env.example | Provides a template for required env vars and exporter toggles. |
| samples/a365_s2s/uv.lock | Locks the sample’s dependency set for reproducible installs via uv. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Use request_tenant_id for the MSAL authority and fail fast when it diverges from the configured credential tenant, so tokens are acquired for the same tenant they are cached under. - Guard _configure_export_logging against duplicate StreamHandlers and disable propagation to avoid double-logging on repeated runs. - Move the sample under samples/a365/s2s and update README references. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 516a9ff0-9d67-4aae-87af-e7e6395a66e1
The inline pragma was not recognized by the CI-pinned pylint (3.2.7) because it followed the vestigial ruff noqa in the same comment. Ruff is not configured in this repo, so drop the noqa and lead the comment with the pylint disable pragma. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 516a9ff0-9d67-4aae-87af-e7e6395a66e1
openai 2.45.0 made InputTokensDetails.cache_write_tokens a required field. openai-agents (pulled transitively via the agent-framework and openai-agents extras) still constructs InputTokensDetails(cached_tokens=0) in agents/usage.py, which now raises pydantic ValidationError and breaks the tests/a365/integration/openai suite. Constrain openai to >=2.36.0,<2.45.0 in both extras. This satisfies openai-agents 0.18.0 (openai<3,>=2.36.0) and agent-framework-openai 1.10.0 (openai<3,>=1.99.0), resolving to openai 2.44.0. Verified that InputTokensDetails(cached_tokens=0) succeeds on 2.44.0 and fails on 2.45.0. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 516a9ff0-9d67-4aae-87af-e7e6395a66e1
rads-1996
left a comment
There was a problem hiding this comment.
I don't think we need to add the .env.example, py.project and uv.lock files, whatever pre-requisites are required should be added to the README. If you look at the other samples, that is how they have been structured,
What
Adds a self-contained sample under
samples/a365_s2s/demonstrating how to export Agent 365 (A365) telemetry using the S2S (service-to-service) flow.Why
The existing
samples/a365samples cover the AI-teammate flow (with an agentic user). This adds the missing S2S scenario, where a service authenticates on its own behalf using its app-registration credentials — there is no agentic user.What's in it
_create_fic_token_resolver(app -> instance token exchange via MSAL), excluding the agentic-user (user_fic) step, combined witha365_use_s2s_endpoint=True.pyproject.toml),.envviapython-dotenv(with.env.example), and a placeholder/empty-value guard with friendly errors.HTTP 200 success ... Correlation ID: <id> ... "status":"sent".Testing
Verified end-to-end against the live S2S endpoint: token acquired and HTTP 200 with all sinks reporting
sent. The placeholder guard and missing-credential paths were also exercised.