Building a Multi-Tool AI Agent Workflow in n8n

I recently built a powerful AI-driven automation workflow in n8n, and it turned out to be a great hands-on experience designing a system that connects multiple services into one intelligent pipeline.

What This Workflow Does

At its core, this setup centers around a single AI Agent that acts as the brain of the entire operation. Instead of building separate automations for every task, I funneled everything through one intelligent agent that can understand context, make decisions, and trigger the right action on its own.

The workflow accepts inputs from several entry points:

  • Chat messages: a “When chat message received” trigger for direct conversational requests
  • Webhooks: including a dedicated “Retrieve Deep Research” webhook and a “Respond to Webhook” node to send results back
  • Session handling: SetSessionID, SetResearchID, and ToolCall nodes manage state and keep each request properly tracked

From there, everything routes into the AI Agent for processing.

The Tools Behind the Agent

What makes the agent genuinely useful is the set of tools wired into it:

  • OpenAI Model: the language model powering the reasoning
  • Memory: so the agent retains context across the conversation
  • Calculator: for any on-the-fly computation
  • Google Sheets: reading and writing data to a connected sheet
  • Gmail: sending messages and creating drafts automatically
  • Task management: Get Active Tasks, Create Task, and Update Task nodes for full task handling
  • Deep Research: Retrieve and Conduct Deep Research nodes for pulling richer information
  • Shopping List management: Get, Add to, and Update Shopping List nodes
  • CreateHTML & Edit Fields: for formatting and shaping output

I also scaffolded in Microsoft Teams and Home Assistant nodes (currently deactivated) so the system can expand into team messaging and smart-home control down the line.

What I Learned

The most interesting part was structuring the logic so the agent could interpret a request, decide which tool to reach for, and execute, whether that meant creating a task, drafting an email, running research, or updating a sheet, all without manual intervention.

This project deepened my skills in:

  • Designing AI agents that orchestrate multiple tools
  • Workflow automation and state management
  • API integrations across Google, Gmail, and more
  • Building scalable no-code / low-code systems

It’s exciting to see how automation can turn a tangle of complex steps into one simple, efficient process. :rocket:

3 إعجابات

The session handling via SetSessionID/SetResearchID is a solid architectural choice - keeping those as dedicated Set nodes before the Agent makes it easy to swap the ID logic without touching the agent itself. One pattern worth considering as you scale to more tools: grouping related tools (like the task management cluster or the research cluster) into separate sub-workflows called via the “Execute Workflow” tool lets you version and test each group independently without redeploying the whole agent.

That’s a great point.

I agree, keeping the session and research ID logic outside the agent makes the workflow much easier to maintain. The agent can stay focused on decision-making, while the ID/session layer can be changed independently when the workflow grows.

I also like the idea of splitting tool groups into separate sub-workflows. For example, task management, research, Gmail, and Sheets actions could each live in their own workflow and be called through Execute Workflow when needed.

That would make the overall system cleaner, easier to test, and safer to update without touching the main agent every time. Definitely a good pattern for scaling this beyond a single workflow.

Following the sub-workflow point above — one thing I’d add from building agent-based automations for freelance clients: the failure mode worth watching for as this tool list grows isn’t just maintainability, it’s decision quality. An agent choosing between 8-9 tools (Sheets, Gmail, Tasks, Shopping List, Deep Research, Calculator…) tends to pick the wrong one more often than an agent choosing between 2-3, even with a good system prompt — more options per turn seems to correlate with more reasoning errors, not just more maintenance overhead.

Splitting into sub-workflows (like @nguyenthieutoan suggested) actually helps with this too, in a way that’s separate from the versioning benefit: if each sub-workflow exposes itself to the main agent as a single tool (“handle_task_management”, “handle_research”) rather than exposing 3-4 tools per domain, you cut the top-level agent’s real decision surface down to maybe 4-5 choices instead of 9+, even though the total tool count in the system hasn’t changed. The complexity just moves down a level, to sub-agents that only have to choose among 2-3 tools each.

Curious if you’ve noticed the agent misfiring more as you added Home Assistant/Teams into the mix, even deactivated?