Skip to main content
The contract is small enough that a working endpoint is a few dozen lines. The examples below check the auth header, validate the request, look up an answer, and always return valid JSON.
A few details matter more than they look:
  • Return no_answer as a 200, not a 404. A 404 is a failure and gets logged as one.
  • Keep the whole handler under a couple of seconds. The 8-second timeout includes network time in both directions.
  • Use a dedicated secret for Anagram so you can rotate it without touching anything else. Paste the full header value (Bearer abc123) into Studio; Anagram sends it verbatim.

Testing before you enable

Work through this with the source saved but disabled. Nothing reaches shoppers until you flip the switch.
1

Send a request from your own machine

Confirm you get a 200 and a body that matches one of the two shapes.
2

Test from Studio

Open the card in Brain → Knowledge and use Test a question with a few questions your system should answer and one it should not. You will see the outcome, elapsed time, and for failures the reason and HTTP status. An expected question should come back as an answer well under 8 seconds; the off-topic one should come back as no answer.
3

Break it on purpose

Temporarily change the secret in Studio to something wrong and test again. You should see http error (HTTP 401). Change it back. This confirms your endpoint actually checks auth.
4

Check product references

If you return products, confirm the handles or GIDs belong to the store connected to this project. A reference to another store resolves to nothing and is dropped silently, so a wrong-store bug is invisible unless you check.
5

Enable and watch a real conversation

Flip the switch on, open the agent preview in Studio, and ask a shopper-style question your description covers. The agent should cite your source by name and show product cards from the catalog.

Writing the expertise description

The When should the agent ask it? field is the routing rule. The agent reads it on every turn to decide whether to call you. Vague descriptions cause either too many calls (wasted budget, slower replies) or too few (your expertise never surfaces). Weak:
Better:
Say what you cover and what you don’t. The exclusions are as useful as the inclusions.