Skip to content

Add per-app agent support with tailored assistants for blog, places, and weather#179

Draft
Copilot wants to merge 3 commits intomainfrom
copilot/investigate-agent-per-app
Draft

Add per-app agent support with tailored assistants for blog, places, and weather#179
Copilot wants to merge 3 commits intomainfrom
copilot/investigate-agent-per-app

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

Investigates and implements the "agent per app" concept: each app gets a tailored AI agent with its own system prompt and a restricted tool set, surfaced as an inline assistant widget within the app's UI.

Core infrastructure (agent/agent.go)

  • AppAgent structID, Name, SystemPrompt, Tools (empty = unrestricted)
  • RegisterAppAgent() — package-level registry; any package can register its own agent
  • handleQuery — accepts optional "app" field in the POST body; restricts the planner's tool catalogue and swaps in the app-specific synthesis prompt when set
  • buildRestrictedToolsDesc() — generates a tool description string scoped to an app's allowed tools
  • Load() registers three built-in agents:
ID Role Tools
blog Writing assistant: grammar, clarity, tags, moderation blog_list, search, web_search
places Discovery & recommendations: intent understanding, practical tips places_search, places_nearby, weather_forecast
weather Outfit & activity advisor weather_forecast, places_nearby

App widgets

Each widget calls POST /agent with {"app": "<id>", "prompt": "..."} and streams the SSE response inline.

  • Blog write form — "✍️ Writing Assistant" card; automatically injects the post title + content as context
  • Places page — "🗺️ Places Assistant" (logged-in only); natural-language place discovery
  • Weather page — "🌂 Weather Advisor"; appears after a forecast loads, pre-populates current temperature and conditions as context

Usage

// Register a custom app agent from any package
agent.RegisterAppAgent(&agent.AppAgent{
    ID:           "myapp",
    Name:         "My App Assistant",
    SystemPrompt: "You are a helpful assistant for myapp...",
    Tools:        []string{"search", "web_search"},
})

Client POST:

{ "prompt": "Suggest tags for this post", "app": "blog" }

🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI and others added 2 commits March 3, 2026 08:32
…istants

Co-authored-by: asim <17530+asim@users.noreply.github.com>
… nolint comment

Co-authored-by: asim <17530+asim@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate the concept of agent per app or service Add per-app agent support with tailored assistants for blog, places, and weather Mar 3, 2026
Copilot finished work on behalf of asim March 3, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants