mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
705473c276
* .Net: Add hosted agent observability sample Mirrors the Python sample added in #5608 for Foundry hosted agents. The .NET hosting library already wires OpenTelemetry automatically via Microsoft.Agents.AI.Foundry.Hosting (ApplyOpenTelemetry) plus Azure.AI.AgentServer.Core's AddAgentHostTelemetry, so no framework changes are needed. The sample is documentation plus a runnable artifact that produces an interesting span tree (invoke_agent / agent_invoke / chat / execute_tool). Adds Hosted-Observability under FoundryHostedAgents/responses with two small tools (GetCurrentLocation, GetWeather), agent.yaml / agent.manifest.yaml declaring OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT (the .NET equivalent of Python's ENABLE_SENSITIVE_DATA), Dockerfile + Dockerfile.contributor, .env.example and README explaining the .NET vs Python defaults. Project added to agent-framework-dotnet.slnx. * Address PR feedback: use Random.Shared and add .dockerignore
20 lines
1.0 KiB
Docker
20 lines
1.0 KiB
Docker
# Dockerfile for contributors building from the agent-framework repository source.
|
|
#
|
|
# This project uses ProjectReference to the local Microsoft.Agents.AI.Foundry source,
|
|
# which means a standard multi-stage Docker build cannot resolve dependencies outside
|
|
# this folder. Instead, pre-publish the app targeting the container runtime and copy
|
|
# the output into the container:
|
|
#
|
|
# dotnet publish -c Debug -f net10.0 -r linux-musl-x64 --self-contained false -o out
|
|
# docker build -f Dockerfile.contributor -t hosted-observability .
|
|
# docker run --rm -p 8088:8088 -e AGENT_NAME=hosted-observability -e AZURE_BEARER_TOKEN=$AZURE_BEARER_TOKEN --env-file .env hosted-observability
|
|
#
|
|
# For end-users consuming the NuGet package (not ProjectReference), use the standard
|
|
# Dockerfile which performs a full dotnet restore + publish inside the container.
|
|
FROM mcr.microsoft.com/dotnet/aspnet:10.0-alpine AS final
|
|
WORKDIR /app
|
|
COPY out/ .
|
|
EXPOSE 8088
|
|
ENV ASPNETCORE_URLS=http://+:8088
|
|
ENTRYPOINT ["dotnet", "HostedObservability.dll"]
|