Skip to content

Creating agents

Agents are conversational — they decide what tools to call, ask follow-ups, and remember the thread. Ask the widget for one in plain English and it generates the TypeScript for you.

Example prompts

Create an agent called scribe that summarises any text I paste into three bullet points.

Build a support-agent that answers questions about our company handbook. Give it access to the handbook PDF.

I want a research-agent that can search the web and take notes.

Make a sales-advisor that reads my CRM via Gmail and advises me on follow-ups.

What happens

  1. The widget may ask one or two clarifying questions — name, personality, what tools it should have, and what files it answers about (if any).
  2. It writes src/mastra/agents/<yourAgentId>.ts, picks a model tier (fast, general, or best), equips the agent with memory, and wraps tools with createAgentTools.
  3. It runs a dry-run build and hot-reloads. The agent appears in Mastra Studio’s sidebar — click to chat with it directly.

What you get

Every generated agent comes with:

  • Memory — conversations persist across tabs and browser restarts.
  • File handlingqueryDocumentsTool so you can upload PDFs, DOCX, XLSX, and ask questions about them (see Working with files).
  • A sensible model choice — the widget picks fast for simple agents, general for most, best for complex reasoning tasks.

Iterate

Once the agent exists, everything else in this section is a follow-up prompt to the same widget:

Tips

  • Be specific about who the agent helps and what it refuses to do. Good instructions mean fewer follow-up fixes later.
  • Name files you want the agent to know about — the widget wires them into the agent’s instructions, not just its tools.
  • Save the prompt template. If you’re building several similar agents, keep the original request — subsequent agents can be generated by copy-paste with a few tweaks.

Released under the Apache-2.0 License.