Skip to content

Add Anthropic model support to the agent#2855

Merged
asim merged 8 commits intomasterfrom
copilot/continue-micro-mcp-work
Feb 12, 2026
Merged

Add Anthropic model support to the agent#2855
asim merged 8 commits intomasterfrom
copilot/continue-micro-mcp-work

Conversation

Copy link
Contributor

Copilot AI commented Feb 12, 2026

The agent prompt handler only supported OpenAI's API format. Anthropic uses a fundamentally different API: different endpoint (/v1/messages), auth header (x-api-key), tool schema (input_schema), and response format (content blocks with tool_use type).

Changes

  • Provider-aware API calls — branch on provider setting (openai | anthropic, auto-detected from base URL if unset) to build provider-specific requests, headers, and response parsing
  • Anthropic integration/v1/messages endpoint, x-api-key + anthropic-version headers, input_schema tool format, system as top-level field, max_tokens (required), tool_use/tool_result content blocks for tool call round-trips
  • Refactored shared logic — extracted toolInfo struct, executeToolCall and callLLMAPI closures to avoid duplicating registry scanning and RPC execution across providers
  • UI — added Provider dropdown (OpenAI/Anthropic) to settings form, updated placeholders
  • Defaultsgpt-4o / api.openai.com for OpenAI, claude-sonnet-4-20250514 / api.anthropic.com for Anthropic

Example: Anthropic tool call flow

POST https://api.anthropic.com/v1/messages
Headers: x-api-key: <key>, anthropic-version: 2023-06-01

→ Response contains content block: {"type": "tool_use", "id": "...", "name": "users.Users.List", "input": {}}
→ Server executes RPC, sends tool_result back
→ Anthropic returns final text answer

Agent settings with provider selector

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • 224.0.0.251
    • Triggering command: REDACTED, pid is -1 (packet block)
  • api.anthropic.com
    • Triggering command: /tmp/micro-test /tmp/micro-test server --address :9090 /tmp/go-build3779211617/b458/vet.cfg .a /libexec/gcc/x86_64-linux-gnu/13/lto-wrapper ux_amd64/vet s-through=-lgcc s-through=-lgcc_-atomic s-through=-lpthr-bool ux_amd64/vet s-th�� O9bb1czWs -I ux_amd64/compile-nilfunc -I util/backoff (dns block)
  • api.openai.com
    • Triggering command: /tmp/micro-test /tmp/micro-test server --address :9090 /tmp/go-build3779211617/b458/vet.cfg .a /libexec/gcc/x86_64-linux-gnu/13/lto-wrapper ux_amd64/vet s-through=-lgcc s-through=-lgcc_-atomic s-through=-lpthr-bool ux_amd64/vet s-th�� O9bb1czWs -I ux_amd64/compile-nilfunc -I util/backoff (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits February 12, 2026 08:43
- Add playground.html template with chat-style agent prompt interface
- Add /playground route handler in server
- Add /api/mcp/tools endpoint to list available MCP tools
- Add /api/mcp/call endpoint to invoke MCP tools via RPC
- Add Playground link to sidebar navigation
- Playground auto-discovers services from registry and renders them as
  callable tools with input forms and activity logging

Co-authored-by: asim <17530+asim@users.noreply.github.com>
Fix .gitignore pattern 'micro' -> '/micro' to only ignore root-level
binary, not paths containing 'micro' as a component.

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

Co-authored-by: asim <17530+asim@users.noreply.github.com>
Copilot AI changed the title [WIP] Continue work on micro mcp and playground integration Add MCP Playground to server web UI Feb 12, 2026
Copilot AI requested a review from asim February 12, 2026 08:49
Copilot AI and others added 2 commits February 12, 2026 09:04
- Rename /playground to /agent, move Agent link to top of sidebar menu
- Fix template styling: use existing form/input/button CSS from styles.css
  instead of inline styles and form-plain class
- Add /api/agent/settings GET/POST endpoints for model API key, model
  name, and base URL configuration (stored in server store)
- Add /api/agent/prompt POST endpoint that sends user prompt to
  OpenAI-compatible LLM API with tool definitions from registry,
  executes any tool calls via RPC, and returns results with a
  follow-up LLM summary
- Show available tools in a table using existing table styles
- Prompt section is placed above settings for primary workflow

Co-authored-by: asim <17530+asim@users.noreply.github.com>
…improve param descriptions

Co-authored-by: asim <17530+asim@users.noreply.github.com>
Copilot AI changed the title Add MCP Playground to server web UI Rename Playground to Agent, fix styling, add LLM-powered tool calling Feb 12, 2026
Copilot AI and others added 2 commits February 12, 2026 09:22
Support both OpenAI and Anthropic APIs in the agent prompt handler:
- Add provider selector (OpenAI/Anthropic) to settings UI and backend
- Auto-detect provider from base URL when not explicitly set
- Anthropic: use /v1/messages endpoint, x-api-key header, input_schema
  format for tools, content blocks for responses, tool_use/tool_result
  message format for follow-ups
- OpenAI: unchanged /v1/chat/completions with Bearer auth
- Default models: gpt-4o (OpenAI), claude-sonnet-4-20250514 (Anthropic)
- Provider-specific defaults for base URLs

Co-authored-by: asim <17530+asim@users.noreply.github.com>
Co-authored-by: asim <17530+asim@users.noreply.github.com>
Copilot AI changed the title Rename Playground to Agent, fix styling, add LLM-powered tool calling Add Anthropic model support to the agent Feb 12, 2026
@asim asim marked this pull request as ready for review February 12, 2026 09:32
@asim asim merged commit 06608d3 into master Feb 12, 2026
2 checks passed
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