Skip to content

feat(ai-review): add agent LLM provider backed by local Claude Code#93

Merged
vineethkrishnan merged 1 commit into
mainfrom
feat/agent-llm-provider
Jun 13, 2026
Merged

feat(ai-review): add agent LLM provider backed by local Claude Code#93
vineethkrishnan merged 1 commit into
mainfrom
feat/agent-llm-provider

Conversation

@vineethkrishnan

Copy link
Copy Markdown
Owner

What

Adds a sixth LLM_PROVIDER value, agent, that routes reviews through a local Claude Code agent exposing POST /trigger (which runs claude -p non-interactively) instead of calling an LLM API directly.

Why

When ClearPR runs in Docker, it cannot invoke the host's claude binary or read its credentials. Pointing the new provider at a small host-side agent lets a deployment reuse an existing Claude subscription on the host, so no Anthropic API key is needed.

How

  • AgentLlmAdapter POSTs the prompt with Authorization: Bearer <LLM_API_KEY>, maps the agent's { result.result, usage, modelUsage } payload onto LlmResponse, applies a 600s timeout matching the agent's own ceiling, and surfaces aborts as LlmTimeoutError and bad payloads as MalformedLlmResponseError.
  • Wired into LlmProvider enum, llm-provider.registry.ts, and the default-model map (claude-code).
  • docker-compose.yml gains host.docker.internal:host-gateway so the container can reach a host-side agent.
  • README and the provider guide document the new option.

Config

LLM_PROVIDER=agent
LLM_BASE_URL=http://host.docker.internal:8765
LLM_API_KEY=<agent bearer token>

Tests

6 new unit tests for the adapter (success mapping, model fallback, error result, non-2xx, abort to timeout). Full suite 170/170, tsc/eslint/nest build clean.

Add an 'agent' value to LLM_PROVIDER that routes reviews through a local Claude Code agent exposing POST /trigger and running `claude -p`. This lets a deployment reuse an existing Claude subscription on the host instead of an Anthropic API key, which matters when ClearPR runs in Docker and cannot invoke the host `claude` binary or read its credentials directly.

AgentLlmAdapter POSTs the prompt with a bearer token, maps the agent's {result.result, usage, modelUsage} payload onto LlmResponse, applies a 600s timeout matching the agent ceiling, and surfaces timeouts and malformed payloads as the existing review errors. Wire it into the enum, registry, and default-model map, document it in the README and provider guide, and add host.docker.internal:host-gateway to the compose app service so the container can reach a host-side agent.
@vineethkrishnan vineethkrishnan force-pushed the feat/agent-llm-provider branch from 981f3b9 to 0d5e017 Compare June 13, 2026 14:05
@vineethkrishnan vineethkrishnan changed the title feat(review): add agent LLM provider backed by local Claude Code feat(ai-review): add agent LLM provider backed by local Claude Code Jun 13, 2026
@vineethkrishnan vineethkrishnan merged commit 078851a into main Jun 13, 2026
14 checks passed
@vineethkrishnan vineethkrishnan deleted the feat/agent-llm-provider branch June 13, 2026 16:07
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.

1 participant