Skip to content

Commit d268ead

Browse files
Adding csharp BYO agent. (#573)
* Adding BYO agent. * Prompt updates. * remove. * Some changes. * Fixing form filler prompt to base prompt. * PR coomments and a bug fix.
1 parent 8e04f96 commit d268ead

20 files changed

Lines changed: 1267 additions & 16 deletions

File tree

samples/csharp/hosted-agents/agent-framework/browser-automation/prompts/base.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ live browser.
9999

100100
## General browser work
101101

102+
- **NEVER ASK FOR CONFIRMATION.** Execute tasks fully without pausing. Do NOT say "If you want, I can continue" or "Should I proceed?" — JUST DO IT. Complete the entire task end-to-end.
102103
- Clarify only when the goal, target URL, or required data is ambiguous.
103104
- Prefer inspecting page state before interacting with elements.
104105
- Use screenshots when visual confirmation would help the user understand the

samples/csharp/hosted-agents/agent-framework/browser-automation/utils/Middlewares.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ public static async IAsyncEnumerable<AgentResponseUpdate> LiveViewUrlStreamingMi
171171
_logger.LogDebug("[streaming-middleware] Appending live_view_url");
172172
yield return new AgentResponseUpdate(
173173
ChatRole.Assistant,
174-
[new TextContent($"\n\n🔴 [Browser Live View]({liveViewUrl})")]);
174+
[new TextContent($"\n\n🔴 [Browser Live View]({liveViewUrl})")])
175+
{ FinishReason = ChatFinishReason.Stop };
175176
}
176177
}
177178
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Build artifacts
2+
**/bin/
3+
**/obj/
4+
5+
# .NET user secrets
6+
**/.secrets/
7+
8+
# Local settings
9+
**/*.user
10+
**/*.suo
11+
12+
# IDE settings
13+
.vs/
14+
.vscode/
15+
**/.idea/
16+
17+
# Test results
18+
**/TestResults/
19+
20+
# Version control
21+
.git/
22+
.gitignore
23+
24+
# Docker files
25+
.dockerignore
26+
27+
# Docs
28+
README.md
29+
30+
# Local environment (never bake credentials into the image)
31+
.env
32+
33+
# NuGet
34+
.nuget/
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Required
2+
# FOUNDRY_PROJECT_ENDPOINT=https://<account>.services.ai.azure.com/api/projects/<project>
3+
AZURE_AI_MODEL_DEPLOYMENT_NAME=gpt-4.1
4+
5+
# Foundry Toolbox name (hardcoded in agent.manifest.yaml; override only if using a different toolbox)
6+
TOOLBOX_NAME=browser-automation-tools
7+
8+
# Playwright workspace (used in agent.manifest.yaml for connection resource)
9+
# PLAYWRIGHT_SERVICE_URL=wss://<region>.api.playwright.microsoft.com/playwrightworkspaces/<workspace-id>/browsers
10+
# PLAYWRIGHT_SERVICE_RESOURCE_ID=/subscriptions/<sub-id>/resourceGroups/<rg>/providers/Microsoft.LoadTestService/playwrightWorkspaces/<name>
11+
# PLAYWRIGHT_SERVICE_ACCESS_TOKEN=<playwright-workspace-access-token>
12+
13+
# Optional
14+
# BROWSER_TIMEOUT_SECONDS=180
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
2+
WORKDIR /app
3+
EXPOSE 8088
4+
ENV ASPNETCORE_URLS=http://+:8088
5+
6+
# Install Node.js and @playwright/cli
7+
RUN apt-get update && apt-get install -y curl && \
8+
curl -fsSL https://deb.nodesource.com/setup_22.x | bash - && \
9+
apt-get install -y nodejs && \
10+
npm install -g @playwright/cli@latest && \
11+
playwright-cli install --skills && \
12+
apt-get clean && rm -rf /var/lib/apt/lists/*
13+
14+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
15+
WORKDIR /src
16+
COPY . .
17+
RUN dotnet restore
18+
RUN dotnet publish -c Release -o /app/publish
19+
20+
FROM base AS final
21+
WORKDIR /app
22+
COPY --from=build /app/publish .
23+
ENTRYPOINT ["dotnet", "browser-automation.dll"]

0 commit comments

Comments
 (0)