diff --git a/netlify/functions/agent-proxy.js b/netlify/functions/agent-proxy.js index 0a51b6e..8c26282 100644 --- a/netlify/functions/agent-proxy.js +++ b/netlify/functions/agent-proxy.js @@ -12,29 +12,10 @@ import Anthropic from '@anthropic-ai/sdk' // --------------------------------------------------------------------------- // Managed Agent configuration // --------------------------------------------------------------------------- -// The Managed Agent ID is supplied via the ANTHROPIC_AGENT_ID env var. When -// present the call is routed to that agent. Otherwise we fall back to a -// system-prompt-driven "virtual agent" that defines the persona inline. - -const SYSTEM_PROMPT = `You are the "PMC Funder Discovery Agent", an expert -fundraising consultant for U.S. public media stations (NPR/PBS member -stations, community radio, and independent public broadcasters). - -Your job is to take a brief intake form about a public media station and -produce a tailored funding outlook that includes: - 1. A short profile of the station based on the supplied details. - 2. 3-5 likely foundation funders that match the station's mission and - geography (CPB, Knight, MacArthur, Wyncote, regional community - foundations, etc.). - 3. 2-3 corporate underwriting angles relevant to the station's market. - 4. Concrete next steps for the development director. - -Write in clear, direct prose. Use Markdown headings and bullet lists. If -you need additional information, you may emit a tool_use block requesting -it; otherwise produce the brief in one pass. Avoid speculation about -specific dollar amounts.` - -const MODEL = process.env.ANTHROPIC_MODEL || 'claude-sonnet-4-5' +// The Managed Agent ID is supplied via the ANTHROPIC_AGENT_ID env var. The +// agent's system prompt and model are defined in the Claude Console and used +// by default. ANTHROPIC_MODEL and ANTHROPIC_SYSTEM_PROMPT may optionally +// override them. // --------------------------------------------------------------------------- // Anthropic client (reused across warm Lambda invocations) @@ -67,8 +48,6 @@ export default async (req /*, context */) => { } const { - userName = '', - userEmail = '', stationName = '', stationLocation = '', stationWebsite = '', @@ -93,23 +72,17 @@ export default async (req /*, context */) => { const userMessage = `Here is a new public media station intake: -- Submitter Name: ${userName} -- Submitter Email: ${userEmail} - Station Name: ${stationName} - Station Location: ${stationLocation} - Station Website: ${stationWebsite} -Please draft the funding outlook brief described in your instructions.` +Please follow your instructions to produce the funding outlook brief.` // ----- Build the streaming request ----- - // Note: when calling a Managed Agent, the Anthropic SDK accepts an - // `agent_id` field on the messages.stream() call. We include it - // conditionally so the same code path also works with a plain system - // prompt while you're wiring things up. + // The Managed Agent's system prompt and model (configured in the Claude + // Console) are used by default. Optional env vars can override them. const streamArgs = { - model: MODEL, max_tokens: 10000, - system: SYSTEM_PROMPT, messages: [ { role: 'user', @@ -120,6 +93,12 @@ Please draft the funding outlook brief described in your instructions.` if (process.env.ANTHROPIC_AGENT_ID) { streamArgs.agent_id = process.env.ANTHROPIC_AGENT_ID } + if (process.env.ANTHROPIC_MODEL) { + streamArgs.model = process.env.ANTHROPIC_MODEL + } + if (process.env.ANTHROPIC_SYSTEM_PROMPT) { + streamArgs.system = process.env.ANTHROPIC_SYSTEM_PROMPT + } const upstream = client.messages.stream(streamArgs) diff --git a/src/index.css b/src/index.css index 1865889..9c335d6 100644 --- a/src/index.css +++ b/src/index.css @@ -5,7 +5,7 @@ html, body { font-family: 'Noto Serif', serif; - background-color: #f7f4ee; + background-color: #ffffff; color: #1f1b16; }