Skip to main content

Collect leads from a website agent

What you'll do: a visitor on your website tells the agent "I'd like to talk to a person about a bulk order". The agent asks for their email address, saves it with what they need, and tells them the team will get back to them. Your team gets an email and finds the visitor on the agent's Leads tab, next to the conversation that led to it. You reply from your own email or phone.

The agent here is a shop's support agent with no knowledge base. Any agent works the same way, and so does the website widget it runs in.

1. Turn on Collect leads​

Open Agents → your agent, stay on the Settings tab and scroll to Collect leads.

  • Collect leads: adds a tool named capture_lead to every run of the agent. It is off by default. An agent with it off sends no extra tool, so it costs nothing extra.
  • Contact: what the agent must get before it saves a lead: Email, Phone, or Email or phone.
  • Extra fields: up to five details of your own, such as a company name or a budget. The Label is what your team sees. What the agent should ask for is the description the model reads. Required makes the agent ask for the field before it can save.

Name and what the visitor needs are always saved, so they need no field.

The Collect leads card on an agent's Settings tab: the switch turned on, Contact set to Email or phone, and one extra field labelled Company with the hint The visitor's company name, if they mention it, saved as company

Click Save. The Tools panel on the right now lists capture_lead as built-in. A change to these settings applies from the visitor's next message, and you do not commit a new prompt version.

2. Try it in the chat​

Ask for a person in the agent's Chat page or in the widget preview on the Embed on website tab. When you ask without giving a contact, the agent asks for one. When you give it, the agent saves the lead and confirms.

The website widget on the Embed on website tab: the visitor asks to talk to a person about a bulk order of 20 bikes, the agent asks for an email address or phone number, the visitor gives sara.khan@example.com and says she is Sara from Acme Cycling, and the agent says it saved her details

The visitor sees only the agent's replies. The tool call shows in the run's trace as a capture_lead step, like any other tool.

3. Work through the Leads tab​

Open the agent's Leads tab. Each row shows the email or phone number with a Copy button, the name, what the visitor needs, a column for each extra field, and when the lead was saved. Wants a person marks a visitor who asked to talk to someone, and Website or App says where the conversation started.

The Leads tab with one new lead: sara.khan@example.com, Sara, bulk order of 20 bikes with a Wants a person badge, Acme Cycling in the Company column, saved just now from the website, status New, Conversation and Trace links, and a delete icon

  • Conversation opens the chat that produced the lead, so you can read it before you reply.
  • Status moves a lead from New to Contacted and Closed. The count at the top shows how many are still new, and the menu on the right filters by status.
  • Click a row to see every saved detail, including values of fields you have since removed.
  • The trash icon deletes the lead for good. Deleting the agent deletes its leads too. Deleting a lead keeps the conversation, the run history and the trace, and they hold what the visitor typed.

The team's owners, admins and editors get an email for each new lead, with the details and a link to this tab. Each person can turn it off under Account & keys → Email notifications → Agent leads.

When the agent asks​

Your prompt decides when the agent offers to connect a visitor with your team. The settings decide what it saves. With no instruction in the prompt, the agent collects details when a visitor asks for a person or to be contacted, or needs help the agent cannot give. To change that, add a line to the prompt, for example:

When someone asks about a bulk order or a custom build, offer to have our sales team contact them.

A prompt line that asks for a detail with no field, such as a phone number while Contact is Email, makes the agent ask for it, but it is not saved. Add a field or change Contact instead.

What the agent cannot save​

  • Contact details the visitor did not type. The email or phone number must appear in one of the visitor's own messages, so the model cannot invent one and a document cannot plant one. A phone number matches however it was spaced: "0300 765-4321" in the chat is saved as 03007654321.
  • The same visitor twice. A second call in the same conversation with a known email or phone number updates that lead, and your team gets no second email.
  • More than three leads in one conversation.

AcruxCore never emails or messages the visitor, so nobody can use your widget to send mail to someone else. An agent run inside an experiment calls the tool and gets the same answer, but saves nothing and sends no email.

Send leads to your own CRM​

To have leads arrive in a CRM or a chat channel instead, turn Collect leads off and give the prompt an HTTP tool that posts to your webhook. See Create a tool. An HTTP tool skips the checks above, so the webhook receives whatever the model sends.

Next steps​