The intelligence of this entire automation lies within its AI Agent nodes. These are not simple "ask a question, get an answer" components; they are orchestrators that follow complex instructions, use external tools, and make structured decisions. Hereās a breakdown of the logic and "thinking process" of each agent as defined in the scenario.
š¤ How the Agents Communicate with Their Tools
The connection between an AI Agent and its tools isn't magic; it's managed by a special placeholder function:Ā {{fromAIAgent()}}
. This function acts as a dedicated listening channel, waiting for a specific command from its parent AI Agent.
Hereās how it works in practice:
- The Agent Decides:Ā Based on the user's prompt and its own internal rules, the AI Agent decides it needs to use one of its tools. For example, it might decide, "I need to search the internal documentation."
- The Agent Formulates a Command:Ā The agent internally creates a "command" that includes the name of the tool it wants to use and the specific data (the argument) it needs to send. For example:Ā Command: Use tool 'rag_database_docs' with the search query 'HTTP node configuration'.
- The Platform Intercepts:Ā The workflow sees this command. It looks at the tool node namedĀ rag_database_docs.
- The Command Activates:Ā For example, inside theĀ rag_database_docsĀ node, a tool used by
first_message_agent
, the theĀ queryĀ parameter is set toĀ {{fromAIAgent("Body" ; "search query")}}
. The platform sees this command and injects the agent's search query ("HTTP node configuration") into that exact spot.
- The Tool Executes:Ā TheĀ rag_database_docsĀ node now runs its HTTP request, but with the data provided by the agent.
- The Result is Returned:Ā The output from the tool (the search results) is sentĀ backĀ to the AI Agent. The agent can now use this new information to formulate its final, helpfulĀ messageĀ for the user.
TheĀ fromAIAgentĀ function has two parts:Ā {{fromAIAgent("ArgumentName" ; "Command")}}.
- ArgumentName: This is the label the AI agent uses for its data packet.
- Command: This is a simple text label that explains the agent what it should command to the tool.
š¤ Agent 1:Ā first_message_agentĀ (Node 9) - The Frontline Triage
This agent is the first point of contact. Its entire design revolves around speed, efficiency, and a single, critical decision: is this message legitimate or is it spam?
š Core Directive & Personality:
- Role:Ā "You are a Latenode documentation assistant."
- Primary Job:Ā To help users with errors, node configuration, and platform understanding.
- Personality:Ā Friendly, brief, and practical. It is explicitly told to avoid verbose phrases like "Based on the documentation..." and to get straight to the point.
š¦ Decision-Making Framework (The Prompt's Rules):
-
Output Mandate:Ā The agent's absolute, number-one rule is toĀ alwaysĀ return a valid JSON object with a specific structure:Ā {"spam": boolean, "message": "string"}. It is forbidden from returning any other text or commentary. This strict formatting is essential for the downstream nodes to function correctly.
-
Spam Rules:Ā The agent is given a clear, rule-based definition of spam. It must setĀ "spam": trueĀ if the message is:
-
Guest-posting, SEO bait, or promotional.
-
Lacks a real question or is just noise.
-
Is clearly off-topic for Latenode.
Otherwise, it must setĀ "spam": false.
-
Greeting Rule:Ā If the message is not spam ("spam": false), the agent must begin itsĀ messageĀ with a brief, friendly greeting like "Hi!" or "Hey!".
š ļø How It Uses Its Tools:
The agent is aware of three tools it can call by name using the tag fromAIAgent
to gather information before formulating itsĀ message. It decides which to use based on the user's prompt.
- rag_database_docsĀ (HTTP Request to Cloudflare RAG):Ā š„ This is itsĀ primary source of truth. When the user asks a question like "How do I configure the HTTP node?", the agent will formulate a search query (e.g., "HTTP node configuration") and pass it to this tool usingĀ {{fromAIAgent("Body" ; "search query")}}. The tool then executes the search against the internal documentation and returns the findings to the agent.
- web_searchĀ (ChatGPT with Search):Ā š„ This is the backup plan. The agent is instructed to use this tool if the internal documentation is "missing or unclear." IfĀ rag_database_docsĀ returns no relevant information, the agent will pass its search query to this tool for a broader web search.
- docs_linksĀ (Google Sheets):Ā š This is a supplementary tool. The agent is instructed to call this tool only if "a helpful answer is found" and to include only "links relevant to the current context." This means after getting a good result fromĀ rag_database_docsĀ orĀ web_search, the agent can ask this tool to find the official URL for the relevant documentation page to include in its finalĀ message.