Skip to content

Commit f89235b

Browse files
LeftTwixWandclaude
andcommitted
docs: update CLAUDE.md and DevUI README for Orleans bridge architecture
Add DevUI and MCP sections to CLAUDE.md documenting the Orleans client architecture, OrleansAgentChatClient bridge, and registered agents. Rewrite DevUI README replacing the default template content. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent aa6fa77 commit f89235b

2 files changed

Lines changed: 65 additions & 120 deletions

File tree

CLAUDE.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ dotnet test IAW.slnx --filter "FullyQualifiedName~MethodName" # run a sing
3131
src/
3232
Core/Core.csproj -- Agent base class (AgentV2), V2 contracts, LLM integration
3333
IAW.AppHost/Aspire.csproj -- Aspire orchestration (AppHost)
34-
IAW.MCP/MCP.csproj -- MCP server bridge (stdio, self-contained exe)
34+
IAW.MCP/MCP.csproj -- MCP server bridge (Orleans client, HTTP transport)
3535
IAW.ServiceDefaults/ -- Shared Aspire defaults (OpenTelemetry, health checks)
36-
Clients.Telegram.Bot/ -- Telegram bot silo service
37-
DevUI/ -- Microsoft Agent Framework dev UI
36+
Clients.Telegram.Bot/ -- Telegram bot (Orleans silo, ports 11112/30001)
37+
DevUI/ -- Microsoft Agent Framework DevUI (Orleans client → IAgent grains)
3838
samples/
39-
Samples/Samples.csproj -- Orleans silo with ~20 HTTP sample endpoints
39+
Samples/Samples.csproj -- Primary Orleans silo (ports 11111/30000), ~20 HTTP sample endpoints
4040
IAW.Testing/IAW.Testing.csproj -- Testing framework: AgentTestV2<T>, AspireAgentTest<T>, ScenarioBuilder
4141
test/
4242
Core.Tests/ -- AgentTestV2<Agent> behavior tests + architecture guards
@@ -83,6 +83,20 @@ Models are registered in `src/Core/AI/Models/` as singletons extending `LLMModel
8383

8484
Multi-silo setup: `samples` on ports 11111/30000, `telegram-bot` on 11112/30001, joined via `PrimarySiloEndpoint` config.
8585

86+
### DevUI (Microsoft Agent Framework)
87+
88+
DevUI provides a web-based chat UI for interacting with Orleans agents. It runs as an **Orleans client** (not a silo) connecting to the `samples` silo via gateway.
89+
90+
**Architecture**: DevUI → `OrleansAgentChatClient : IChatClient``IClusterClient.GetGrain<IAgent>(agentId)``RespondAsync()` → response.
91+
92+
`OrleansAgentChatClient` bridges `Microsoft.Extensions.AI.IChatClient` to Orleans `IAgent` grains. The `AddAIAgent()` registration passes the grain ID as `instructions`, which the client uses for routing. GenAI telemetry flows through the grain's `UseOpenTelemetry()` pipeline.
93+
94+
Well-known agents are registered in `Program.cs`: `personal-assistant`, `roslyn`, `dotnet`, `nuget`, `github`, `reviewer`, `fs`, `shell`, `git`, `build`, `knowledge`, `user`, `planning`, `notification`.
95+
96+
### MCP Server
97+
98+
`IAW.MCP` runs as an Orleans client connecting to `samples` silo. Exposes 8 orchestration tools via MCP HTTP transport: `agent_list_all`, `assistant_chat`, `agent_send_message`, `agent_get_status`, `agent_assign_task`, `agent_get_events`, `agent_get_metrics`, `agent_trigger_self_improvement`.
99+
86100
### Orleans Streaming
87101

88102
Stream provider named `"agents"`. Behavior streams use namespaces `"agent-events"`, `"agent-history"`, `"agent-notifications"` keyed by agent ID. Custom streams supported via `PublishStreamAsync(namespace, streamId, message)`.

src/DevUI/README.md

Lines changed: 47 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,60 @@
1-
# AI Agent Web API
1+
# IAW DevUI
22

3-
This is an AI Agent Web API application created from the `aiagent-webapi` template. This template is currently in a preview stage. If you have feedback, please take a [brief survey](https://aka.ms/dotnet/aiagent-webapi/preview1/survey).
3+
Web-based chat UI for interacting with IAW Orleans agents, built on [Microsoft Agent Framework DevUI](https://aka.ms/dotnet/agent-framework/docs).
44

5-
## Prerequisites
5+
## Architecture
66

7-
- A GitHub Models API token (free to get started)
7+
DevUI runs as an **Orleans client** (not a silo), connecting to the `samples` silo via gateway port 30000.
88

9-
## Getting Started
10-
11-
### 1. Configure Your AI Service
12-
13-
#### GitHub Models Configuration
14-
15-
This application uses GitHub Models (model: gpt-4o-mini) for AI functionality. You'll need to configure your GitHub Models API token:
16-
17-
**Option A: Using User Secrets (Recommended for Development)**
18-
19-
```bash
20-
dotnet user-secrets set "GITHUB_TOKEN" "your-github-models-token-here"
219
```
22-
23-
**Option B: Using Environment Variables**
24-
25-
Set the `GITHUB_TOKEN` environment variable:
26-
27-
- **Windows (PowerShell)**:
28-
```powershell
29-
$env:GITHUB_TOKEN = "your-github-models-token-here"
30-
```
31-
32-
- **Linux/macOS**:
33-
```bash
34-
export GITHUB_TOKEN="your-github-models-token-here"
35-
```
36-
37-
#### Get a GitHub Models Token
38-
39-
1. Visit [GitHub Models](https://github.com/marketplace/models)
40-
2. Sign in with your GitHub account
41-
3. Select a model (e.g., gpt-4o-mini)
42-
4. Click "Get API Key" or follow the authentication instructions
43-
5. Copy your personal access token
44-
45-
46-
### 2. Run the Application
47-
48-
```bash
49-
dotnet run -lp https
10+
DevUI (Orleans Client)
11+
└── OrleansAgentChatClient : IChatClient
12+
└── IClusterClient.GetGrain<IAgent>(agentId).RespondAsync()
13+
└── Agent grain in samples silo (with UseOpenTelemetry pipeline)
5014
```
5115

52-
The application will start and listen on:
53-
- HTTP: `http://localhost:5191`
54-
- HTTPS: `https://localhost:7283`
55-
56-
### 3. Test the Application
57-
58-
The application exposes OpenAI-compatible API endpoints. You can interact with the AI agents using any OpenAI-compatible client or tools.
59-
60-
In development environments, a `/devui/` route is mapped to the Agent Framework development UI (DevUI), and when the app is launched through an IDE a browser will open to this URL. DevUI provides a web-based UI for interacting with agents and workflows. DevUI operates as an OpenAI-compatible client using the Responses and Conversations endpoints.
61-
62-
## How It Works
16+
`OrleansAgentChatClient` bridges `Microsoft.Extensions.AI.IChatClient` to Orleans `IAgent` grains. The `AddAIAgent()` registration passes the grain ID as `instructions`, which the client uses for routing.
6317

64-
This application demonstrates Agent Framework with:
18+
## Running
6519

66-
1. **Writer Agent**: Writes short stories (300 words or less) about specified topics
67-
2. **Editor Agent**: Edits stories to improve grammar and style, ensuring they stay under 300 words
68-
3. **Publisher Workflow Agent**: A sequential workflow agent that combines the writer and editor agents
69-
70-
The agents are exposed through OpenAI-compatible API endpoints, making them easy to integrate with existing tools and applications.
71-
72-
## Template Parameters
73-
74-
When creating a new project, you can customize it using template parameters:
20+
Always start via Aspire (never `dotnet run` directly):
7521

7622
```bash
77-
# Specify AI service provider
78-
dotnet new aiagent-webapi --provider azureopenai
79-
80-
# Specify a custom chat model
81-
dotnet new aiagent-webapi --chat-model gpt-4o
82-
83-
# Use API key authentication for Azure OpenAI
84-
dotnet new aiagent-webapi --provider azureopenai --managed-identity false
85-
86-
# Use Ollama with a different model
87-
dotnet new aiagent-webapi --provider ollama --chat-model llama3.1
23+
aspire run
8824
```
8925

90-
### Available Parameters
91-
92-
- **`--provider`**: Choose the AI service provider
93-
- `githubmodels` (default) - GitHub Models
94-
- `azureopenai` - Azure OpenAI
95-
- `openai` - OpenAI Platform
96-
- `ollama` - Ollama (local development)
97-
98-
- **`--chat-model`**: Specify the chat model/deployment name
99-
- Default for OpenAI/Azure OpenAI/GitHub Models: `gpt-4o-mini`
100-
- Default for Ollama: `llama3.2`
101-
102-
- **`--managed-identity`**: Use managed identity for Azure services (default: `true`)
103-
- Only applicable when `--provider azureopenai`
104-
105-
- **`--framework`**: Target framework (default: `net10.0`)
106-
- Options: `net10.0`, `net9.0`, `net8.0`
107-
108-
## Project Structure
109-
110-
- `Program.cs` - Application entry point and configuration
111-
- `appsettings.json` - Application configuration
112-
- `Properties/launchSettings.json` - Launch profiles for development
113-
114-
## Learn More
115-
116-
- [AI apps for .NET developers](https://learn.microsoft.com/dotnet/ai)
117-
- [Microsoft Agent Framework Documentation](https://aka.ms/dotnet/agent-framework/docs)
118-
- [GitHub Models](https://github.com/marketplace/models)
119-
120-
## Troubleshooting
121-
122-
**Problem**: Application fails with "Missing configuration: GITHUB_TOKEN"
123-
124-
**Solution**: Make sure you've configured your GitHub Models API token using one of the methods described above.
125-
126-
**Problem**: API requests fail with authentication errors
127-
128-
**Solution**: Verify your GitHub Models token is valid and hasn't expired. You may need to regenerate it from the GitHub Models website.
129-
26+
DevUI is available at the `/devui/` path shown in the Aspire dashboard.
27+
28+
## Registered Agents
29+
30+
Well-known agents registered in `Program.cs`:
31+
32+
| Agent | Grain ID | Role |
33+
|-------|----------|------|
34+
| PersonalAssistant | personal-assistant | Task decomposition and delegation |
35+
| Roslyn | roslyn | C# code intelligence |
36+
| DotNet | dotnet | Build, test, format |
37+
| NuGet | nuget | Package management |
38+
| GitHub | github | PRs, issues, releases |
39+
| Reviewer | reviewer | Code quality review |
40+
| FileSystem | fs | File read/write/search |
41+
| Shell | shell | Shell command execution |
42+
| Git | git | Version control |
43+
| Build | build | Generic build runner |
44+
| Knowledge | knowledge | Project knowledge store |
45+
| User | user | Preferences, memories |
46+
| Planning | planning | Execution plan generation |
47+
| Notification | notification | User alerts |
48+
49+
## Telemetry
50+
51+
GenAI telemetry flows through the agent pipeline:
52+
- `agent.respond` spans from `AgentV2.RespondAsync()`
53+
- `agent.llm` + GenAI spans when agents call `RespondWithLlmAsync()`
54+
- Trace sample ratio set to 1.0 for full capture in development
55+
56+
## Key Files
57+
58+
- `Program.cs` -- Orleans client setup, agent registration, DevUI mapping
59+
- `OrleansAgentChatClient.cs` -- IChatClient → IAgent grain bridge
60+
- `appsettings.json` -- Telemetry config (SampleRatio: 1.0)

0 commit comments

Comments
 (0)