Skip to content

Tutorials

Tutorial: build an AI agent

Create an agent in the Agents section: connect a provider, write its role and task, give it tools, knowledge and data, test it in the playground and with test cases, watch its costs, then run it as a workflow step.

Last updated 5 min read Edit this page on GitHub
On this page

Goal: a Ticket triager agent that reads a support request, looks up the customer in a data table, and returns a category and a priority. Then a workflow runs it on every new request.

You need: View agents, Create agents, Edit agents and Test agents (agents.*), and Create integrations for the provider. Owner, Admin and Manager have them; Member and Viewer don't.

Time: about 25 minutes.

1. Connect an AI provider#

Agents use a provider connection from Integrations.

  1. Go to Build › Integrations and open the Connectors tab. Filter by AI.
  2. Pick your provider: OpenAI, Claude (Anthropic), Google Gemini, xAI Grok, Azure OpenAI, Mistral AI, Groq, DeepSeek, Together AI, Baseten, Perplexity AI or Ollama (Local).
  3. Paste the API key, select Continue, then Test Connection, then Enable Connector.

See Connect an integration for more on connectors.

2. Create the agent#

  1. Go to Build › Agents and select New agent.
  2. Enter the Name Ticket triager and a Description, then select Create agent.
  3. In the designer, choose the Provider (your connection) and a Model. Leave Model empty to use the provider's default.

3. Write its role and task#

In the Identity & task tab:

  1. Agent role: A support lead who sorts incoming requests.
  2. Task: Read the request, look up the customer, and pick a category and a priority.
  3. Custom instructions: anything else, for example Treat any mention of an outage as urgent.

The Generated system prompt preview shows what the model receives. Starter presets fill these fields in for common jobs.

In Boundaries, add rules it must follow: Never contact the customer. If unsure, choose "general".

4. Declare its outputs#

In Output, select Add output variable for each value the workflow needs:

Variable nameTypeAllowed valuesRequired
categoryStringbilling, technical, account, generalyes
priorityStringlow, normal, urgentyes
summaryStringno

Tick Strict to fail the run when a required output is still missing after one repair attempt.

5. Give it data and tools#

In Tools:

  1. Under Access scope → Data tables, search for your Customers table and tick Read. Read lets the agent query the table. Insert, Update and Delete are separate, and new agents have no access until you grant it. An agent's row tools are always limited by these grants (and, when it acts for a person, by that person's own data permissions).
  2. Under the built-in tools, add any others it needs, for example http_get to call a public status page. Set Outbound hosts in Settings to limit where URL tools can go.
  3. To let it call an integration, open API references and add the reference (for example Slack: Send Message).
  4. Under Approvals, tick tools that need a person to approve each call. A reviewer gets a task before the tool runs.

6. Add knowledge#

In Tools → Knowledge, select Add documents and upload your support policy (PDF, Word, Excel, PowerPoint, text, Markdown, CSV, JSON, HTML or XML; up to 20 MB each). Under Data tables to search, pick tables it may search without write access. The agent searches these passages when it needs them.

Select Save. Every save makes a new version; History lets you restore an older one.

7. Try it in the playground#

  1. Select Test. The playground opens beside the designer and runs the saved agent.
  2. Send Customer ACME-42 says invoices won't download since this morning.
  3. Watch the tool calls and the answer stream in. The meta line shows tokens, cost, iterations and time. View trace opens the full run.

8. Add test cases#

In the Tests tab, select Add case:

  • Case name: Outage is urgent
  • Input message: Nothing loads, the whole team is down.
  • Outputs JSON: {"priority":"urgent"}
  • Tools it must call: query_data_table

Select Save case, then Run suite. Tools that change data or call out are simulated during tests. Run the suite again after every change to the instructions or model.

9. Watch costs and set budgets#

  • Settings → Budgets & limits caps one agent: tokens per run, tool calls per run, and tokens or cost per day and month.
  • Agents → Costs & budgets shows spend for every agent, workspace budgets, and Model prices. If a model shows cost unknown (for example an Azure OpenAI deployment with its own name, or Ollama), select Fetch latest pricing to review and save the latest list prices, or Add price to enter its price per million tokens, then Save prices & budgets.

10. Run it from a workflow#

  1. In a workflow (for example one triggered by a support form), add Run Agent from the palette.
  2. Agent: Ticket triager. Prompt / message: Customer {{form.customer_id}} wrote: {{form.message}}.
  3. Keep Output variable name agent_response. Optionally pass Files (optional), such as {{form.screenshot}}.
  4. After the step, use the outputs. Each declared output is a variable: {{category}}, {{priority}}, {{summary}}, and the reply text is {{agent_response}}. Add a Branch by Condition on {{priority}} equals urgent to page the on-call team.
Run Agent nodeJSON
{
  "id": "triage",
  "type": "run_agent",
  "label": "Triage ticket",
  "position": { "x": 400, "y": 200 },
  "config": {
    "agent_id": "<agent-id>",
    "agent_name": "Ticket triager",
    "user_message": "Customer {{form.customer_id}} wrote: {{form.message}}",
    "output_variable": "agent_response",
    "timeout_ms": 120000
  }
}

agent_id and user_message are required. Act as chooses whose permissions the agent's tools use (the person who started the run by default). Publishing the workflow pins the agent version it uses.

What you built#

  • An agent with a role, boundaries, typed outputs, read access to one table, knowledge and approvals.
  • A test suite and budgets.
  • A workflow step that runs the agent and branches on its output.

Next steps#

Was this page helpful?