-
Notifications
You must be signed in to change notification settings - Fork 25
Add observability instructions for coding agents #371
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
docs/agent365-guided-setup/a365-observability-instructions.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # Add Agent 365 Observability | ||
|
|
||
| Add Agent 365 observability to your agent at any point after `a365 setup all` has completed. | ||
|
|
||
| > **Implementation reference:** [Agent observability — Microsoft Learn](https://learn.microsoft.com/en-us/microsoft-agent-365/developer/observability) | ||
| > | ||
| > **Prerequisite:** `a365 setup all` must have completed successfully so `AgentId` and `TenantId` values are present in `appsettings.json` (written by setup) or `a365.generated.config.json`. If neither source has these values, run `a365 setup all` first. | ||
|
|
||
| --- | ||
|
|
||
| ## Task A — Add the observability SDK to the project | ||
|
|
||
| Ask your coding agent (Claude Code, GitHub Copilot, or similar): | ||
|
|
||
| > "Using #file:a365-observability-instructions.md, add observability to this project" | ||
|
|
||
| The agent will follow the MS Learn reference above to: | ||
| 1. Install the observability SDK packages for your project type (.NET, Python, or Node.js) | ||
| 2. Register the exporter and tracing in startup code | ||
| 3. Wire up the token resolver in the agent's turn handler | ||
| 4. Add the exporter configuration setting (`EnableAgent365Exporter` / `ENABLE_A365_OBSERVABILITY_EXPORTER`) and leave it disabled by default | ||
|
|
||
| After completing the above steps, the agent **must** ask the user: | ||
|
|
||
| > "Setup is complete. Would you like me to scan your code and add instrumentation automatically? I'll find LLM calls, tool dispatches, agent-to-agent calls, and output operations and wrap each with the appropriate tracing scope." | ||
|
|
||
| - If **yes**: scan all agent source files, identify operations matching the scope types in Task B, present a summary of planned changes, confirm with the user, then apply — adding the correct scope wrapper and required usings to each. | ||
| - If **no**: skip — instrumentation can be added later via Task B. | ||
|
|
||
| After setup, set `EnableAgent365Exporter` to `true` in `appsettings.json` (or `ENABLE_A365_OBSERVABILITY_EXPORTER=true` in `.env`) to start exporting traces. | ||
|
|
||
| --- | ||
|
|
||
| ## Task B — Instrument individual code blocks | ||
|
|
||
| Select a code block in your editor (an LLM call, a tool dispatch, or an agent-to-agent call), then ask: | ||
|
|
||
| > "Using #file:a365-observability-instructions.md, add observability to the selected code" | ||
|
|
||
| The agent will: | ||
| 1. Read the selected code and identify the operation type | ||
| 2. Infer the relevant parameters (model name, provider, tool name, etc.) — it will not ask for values it can read from the code | ||
| 3. Present its interpretation and ask for confirmation before making any changes | ||
| 4. Wrap the code block with the correct Agent365 tracing scope | ||
|
|
||
| ### Supported scope types (auto-detected from code) | ||
|
|
||
| | What the code does | Scope applied | | ||
| |-------------------|---------------| | ||
| | Calls an LLM/model API (`gpt-4o`, `claude-3`, etc.) | `InferenceScope` | | ||
| | Dispatches a tool or plugin function | `ExecuteToolScope` | | ||
| | Calls another agent (A2A) | `InvokeAgentScope` | | ||
| | Sends final response back to user | `OutputScope` | | ||
|
|
||
| For Python and Node.js, equivalent OpenTelemetry spans are used with the same Agent365 attribute names. See the [MS Learn reference](https://learn.microsoft.com/en-us/microsoft-agent-365/developer/observability) for attribute names and patterns. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.