AI Learning Library · Beginner workflow automation

How can I build and test a first AI workflow in n8n?

Direct Answer

A first n8n agent connects a supported chat model and a bounded tool, then checks the actual tool call and result by using the chat model to generate decisions while the tool executes its specific operation.

Verify the OpenAI account has an available model from the supported list and the Calculator tool is added as a subnode, as model availability and tool configuration are account-specific prerequisites.


What makes this an agent rather than a prompt chain?

An AI Agent uses its connected chat model to dynamically decide which tools, like the Calculator, to invoke during a workflow. The chat model generates decisions while tools execute specific operations, distinguishing it from static prompt chains that lack this adaptive decision-making.

This exercise requires Chat Trigger, AI Agent, a supported chat model (e.g., OpenAI), and Calculator—components not all present in a Basic LLM Chain. The agent’s structured integration of these elements enables tool calling, whereas a prompt chain lacks the agent’s orchestrated decision-making framework.

Which model and account prerequisites should I verify?

Verify that your n8n version supports the desired model and that the model is explicitly available in your connected account; the listed supported models do not imply universal compatibility with all local or third-party implementations.

Ensure proper authentication credentials are configured for the service (e.g., OpenAI API key or Cloud Gateway credits) and confirm your account has an approved usage budget; neither authentication method establishes free or unlimited access to inference capabilities.

How do I configure the bounded practice request?

Connect the Calculator tool as the sole subnode, using a single input item, and define the Prompt field with the static seven-box request: 'Seven boxes hold12 cards each; five cards are set aside.' This establishes a bounded arithmetic problem for the Calculator to resolve.

Configure the System Message to explicitly require Calculator for arithmetic tasks and prompt for missing quantities. Set Max Iterations to 2 and enable Return Intermediate Steps to track the calculation process during testing.

Before executing, manually verify the Prompt content (User Message) for clarity and completeness. If the field appears blank, pause testing and review the setup, as this is a manual preflight check, not an automated validation.

How do I test the tool call and missing-data behavior?

After prerequisites and budget approval, verify the Calculator's intermediate steps by comparing its output to manually calculated results for the seven-box scenario. Ensure the system message guides the chat model’s decisions and check that the arithmetic exercise’s result aligns with the expected 7*12-5=79, without relying on external tools.

For the missing-data variant, request the unknown box count explicitly instead of guessing totals. If errors occur with credentials, tools, or inputs, pause and inspect these issues directly—these are standard validation checks, not completed outcomes.

Is this exercise free or unrestricted open-source use?

The Sustainable Use License permits royalty-free internal or noncommercial use of n8n's source code, excluding Enterprise and third-party exclusions. Enterprise code requires an Enterprise license, but the license does not establish universal licensing requirements for all Enterprise features.

Hosting costs and model usage expenses remain separate from the license, requiring independent budget checks. The license does not eliminate operational costs or provide free unlimited inference through connected services.

What safety boundaries should I keep before expanding?

Use fictional quantities and avoid connecting real customer records or external tools until confident in the workflow’s logic; the Calculator tool is safe for arithmetic exercises but does not interact with live systems.

Manually verify outputs as a person and keep workflows unpublished until ready for production; human review gates for sensitive tools require explicit configuration, which is not automatically applied.

Practice Exercise · Try It Yourself

Illustrative example

Fictional practice example: A beginner designs a test-only AI Agent that may use only Calculator on one invented arithmetic request.

Fictional practice inputs:
Request: seven boxes hold12 cards each; five cards are set aside. Use Calculator for7*12-5 and return expression, total cards and unresolved facts. Missing-data variant: box count is unknown; cards per box12; set aside5. Actual n8n version, supported model, credentials and approved usage budget are not confirmed.

Task:
Design Chat Trigger to AI Agent with connected OpenAI Chat Model and Calculator. Set Prompt to Define below and supply the complete static request; set Max Iterations2 and Return Intermediate Steps on. For the missing-data variant, request the box count instead of guessing.

Constraints:
- No installation, account setup, publication or inference is performed here.
- No email, browser, database or file-writing tools.
- Check actual model/node compatibility, credentials and cost before any permitted test.

Check the Result Before Using It

  • Human arithmetic independently checks7*12-5=79.
  • Inspect intermediate steps for an actual Calculator call; a fluent answer alone is insufficient.
  • Missing box count remains unknown; no invented total.
  • Stop on credential, model, tool or input errors; do not substitute fabricated results.
  • A blank static prompt is manually rejected before inference; this is a human preflight, not an asserted automatic n8n validation.

Book a 30-Minute Discovery Call

Enter your contact details first, then pick a Google Meet time with Javi Cobas without retyping. Paid 1-on-1 sessions ($149), setups ($349), and team workshops ($5,000+) are discussed on the call.

We save your contact details first and prefill Cal.com for scheduling. See our Privacy Policy.

Details saved. Pick a 30-minute slot below: