Files
memex/notes/org-skill-provider-anthropic.org

2.4 KiB

SKILL: Anthropic Provider Agent (Universal Literate Note)

Overview

The Anthropic Provider Agent integrates Anthropic's Claude family of models as a pluggable System 1 (neural) backend. It enables high-intelligence reasoning, drafting, and analysis within the PSF.

Phase A: Demand (PRD)

1. Purpose

Define the interface for reliable communication with the Anthropic Messages API.

2. User Needs

  • Connectivity: Reliable I/O with Claude models.
  • Configurability: Model selection via Environment Configuration.
  • Context Management: Leverage Claude's large context windows.
  • Safety: Graceful error handling for API failures or missing keys.

3. Success Criteria

TODO API Authentication

TODO Model Resolution Loop

TODO Response Parsing Verification

Phase B: Blueprint (PROTOCOL)

1. Architectural Intent

Interfaces for executing neural completion requests. Source of truth is the Anthropic API and `$ANTHROPIC_API_KEY`.

2. Semantic Interfaces

(defun execute-anthropic-request (prompt system-prompt)
  "Executes a completion request via the Anthropic API.")

(defun get-anthropic-models ()
  "Returns supported models and their context limits.")

Phase D: Build (Implementation)

Request Execution

(defun execute-anthropic-request (prompt system-prompt)
  (let ((api-key (uiop:getenv "ANTHROPIC_API_KEY")))
    (unless api-key (return-from execute-anthropic-request "ERROR: Key missing"))
    (let ((model (get-config-attribute :LLM_MODEL_ANTHROPIC "claude-3-5-sonnet-20240620")))
      ;; Physical API call logic (mocked for refactor)
      (format nil "Executing Anthropic request on ~a" model))))

Model Discovery

(defun get-anthropic-models ()
  '((:id "claude-3-5-sonnet-20240620" :context "200k")
    (:id "claude-3-opus-20240229" :context "200k")
    (:id "claude-3-haiku-20240307" :context "200k")))

Registration

(defskill :skill-provider-anthropic
  :priority 100
  :trigger (lambda (context) nil)
  :neuro (lambda (context) nil)
  :symbolic (lambda (action context) action))