Setup guide · Framework
Formfeed in Plain tool calling
MCP is the right choice when the agent should discover templates. When it should only ever produce invoices, a tool of your own is simpler: its schema is the invoice, the model cannot pick the wrong template, and the SDK does retries and idempotency.
Create a test key
Sign in to the app, open API keys and create a key in the test environment. Test renders are not metered, which is what you want while an agent is still learning your templates. Switch to a live key when it goes to production.
Install the packages
Shell npm install @anthropic-ai/sdk @formfeed/sdk zod # or: pip install anthropic formfeedWrite the tool
The tool calls
renders.createwith a fixed template. The same function works as a tool in any framework: OpenAI function calling, LangChain@tool, or the Claude tool runner shown here.import Anthropic from '@anthropic-ai/sdk'; import { betaZodTool } from '@anthropic-ai/sdk/helpers/beta/zod'; import { Formfeed } from '@formfeed/sdk'; import { z } from 'zod'; const anthropic = new Anthropic(); const formfeed = new Formfeed({ apiKey: process.env.FORMFEED_API_KEY! }); const renderInvoice = betaZodTool({ name: 'render_invoice', description: 'Renders an invoice PDF with the invoice-de template and returns its download URL.', inputSchema: z.object({ number: z.string(), customer: z.object({ name: z.string(), street: z.string(), zip: z.string(), city: z.string() }), lines: z.array(z.object({ description: z.string(), qty: z.number(), price: z.number() })), }), run: async (invoice) => { const render = await formfeed.renders.create({ template: 'invoice-de', data: { invoice } }); const done = render.status === 'succeeded' ? render : await formfeed.renders.waitFor(render.id); return done.download_url ?? `Render ${done.id} failed: ${done.error?.message}`; }, }); const message = await anthropic.beta.messages.toolRunner({ model: 'claude-opus-5-5', max_tokens: 16000, tools: [renderInvoice], messages: [ { role: 'user', content: 'Invoice Olvarest GmbH, Beispielweg 2, 54321 Beispielstadt: 8 h consulting at 120 EUR. Number 2026-0042.', }, ], }); console.log(message.content);import os import anthropic from anthropic import beta_tool from formfeed import Formfeed formfeed = Formfeed(api_key=os.environ["FORMFEED_API_KEY"]) @beta_tool def render_certificate(name: str, course: str, date: str) -> str: """Renders a course certificate as PDF and returns the download URL. Args: name: Full name of the participant. course: Title of the course. date: Completion date as ISO 8601, e.g. 2026-09-10. """ data = {"name": name, "course": course, "date": date} render = formfeed.renders.create(template="certificate", data=data) return render.download_url or f"Render {render.id} is {render.status}" prompt = "Jane Doe finished Analytical Engines 101 today. I need her certificate." runner = anthropic.Anthropic().beta.messages.tool_runner( model="claude-opus-5-5", max_tokens=16000, tools=[render_certificate], messages=[{"role": "user", "content": prompt}], ) message = runner.until_done() print(next(block.text for block in message.content if block.type == "text"))Run it
Run it with a test key: the render is not metered and shows up in the app’s render log, with the data the model sent if the workspace keeps request data (a setting of the paid plans, off by default).
Tips
- Copy the field names from the template’s schema (
GET /v1/templates/{id}/schema) into the tool schema; the editor infers it from your sample data. - The SDK sends an idempotency key with every render, so its own retries create no second invoice. A tool call the model repeats is a new render, unless you pass a key of your own, such as the invoice number.
Configuration reference: Formfeed SDK — Plain tool calling (checked 17 October 2026)