Search
Code3,144
<meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Anthropic Agent API - Swagger UI</title> <link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@5.9.0/swagger-ui.css" /> <style><body> <div class="custom-header"> <h1>🤖 Anthropic Agent API</h1> <p>API completa para gerenciar agentes Anthropic com MCPs e workflows assíncronos</p> </div> <h4>⚠️ Variáveis de Ambiente Necessárias</h4> <ul> <li><strong>ANTHROPIC_API_KEY</strong> - Chave da API Anthropic</li> <li><strong>FIRECRAWL_API_KEY</strong> - Chave da API Firecrawl</li> <li><strong>SERPER_API_KEY</strong> - Chave da API Serper.dev</li> openapi: "3.0.0", info: { title: "Anthropic Agent API with MCPs", version: "1.0.0", description: "API completa para gerenciar agentes Anthropic com suporte a MCPs e workflows assíncronos" }, servers: [ tags: ["Agents"], summary: "Criar novo agente", description: "Cria um novo agente Anthropic com MCPs configurados", requestBody: { required: true,app.get("/", (c) => { return c.json({ name: "Anthropic Agent API with MCPs", version: "1.0.0", description: "API completa para gerenciar agentes Anthropic com suporte a MCPs e workflows assíncronos", endpoints: { health: "/health", }, features: [ "🤖 Agentes Anthropic com Claude Sonnet 4", "🧠 Thinking mode ativo", "🔗 MCPs: Firecrawl, Serper.dev, Semrush",import Anthropic from "npm:@anthropic-ai/sdk";import type { GenericMessageEvent } from "npm:@slack/web-api";import { TOOLS_LIST, TOOLS_OBJECT } from "../tools/index.ts";const MAX_STEPS = 10;const anthropic = new Anthropic({ apiKey: Deno.env.get("CLAUDE_API_KEY") });const TOOL_RESULTS = {};export async function reply( event: GenericMessageEvent, messages: Anthropic.MessageParam[],) { // reply in thread or start one const thread_ts = event.thread_ts || event.ts; const input: Anthropic.MessageParam[] = [...messages]; for (let step = 0; step < MAX_STEPS; step++) { const response = await anthropic.messages.create({ model: "claude-sonnet-4-20250514", system: await getFullSystemPrompt(event), tools: TOOLS_LIST, // betas: ["context-1m-2025-08-07"], // Requires usage tier 4: https://docs.anthropic.com/en/docs/build-with-claude/context-windows#1m-token-context-window });import { WebClient } from "npm:@slack/web-api";import Anthropic from "npm:@anthropic-ai/sdk";import type { AppMentionEvent, GenericMessageEvent } from "npm:@slack/web-api";export const slack = new WebClient(Deno.env.get("SLACK_BOT_TOKEN"));export async function getSlackHistory( event: AppMentionEvent | GenericMessageEvent,): Promise<Anthropic.MessageParam[]> { const { messages } = await slack.conversations.replies({ channel: event.channel,import { SYSTEM_PROMPT } from "../prompts/index.ts";import Anthropic from "npm:@anthropic-ai/sdk";import { z } from "npm:zod@3.23.8";});const anthropic = new Anthropic({ apiKey: Deno.env.get("CLAUDE_API_KEY") });export async function shouldReply( threadHistory: Anthropic.MessageParam[],): Promise<boolean> { const response = await anthropic.messages.create({ model: "claude-sonnet-4-20250514", max_tokens: 200, T1["Query Mongo"] T2["CSV Export"] T3["Anthropic Web Search"] T4["E2B Matplotlib Visualization"] endWe charge a 50% markup on top of raw LLM costs. If you use $10 in Towniecredits, Anthropic will get $6.66 and we'll get $3.33. We think this is fair,sustainable, and transparent. We don't want to be in the business of havingmurky limits, obfuscated credits, or unsustainable margins.
project, branchId, // anthropicApiKey, // bearerToken, selectedFiles,- [x] Add a "view source" / "send me a PR" link- [x] Show the HTTP preview in second column if there is one (and let the user pick which one to preview in the iframe)- [x] Figure out a convention to teach in the anthropic prompt mod where the LLM always checks the readme for the scope (if not provided) and keeps it up to take with every change- [x] Ability to create new projects from the interface- [x] Figure out why OpenTownie can't create HTTP vals. Maybe give it a seperate tool for it?- [x] Start a timer for messages- [x] Add more indicators that it's "still working"- [x] Require users supply their own Anthropic token?- [x] Add cost indications on messages- [x] Add a bell noise when the message is done to let us know