Skip to main content

AI Agents & Memory

MachinaOs provides two types of AI agents for different use cases, plus a memory node for conversation context.

Agent Types

AgentPurposeSpecial Features
AI AgentComplex reasoning with tool callingLangGraph execution, iterative reasoning
Chat AgentConversational AI with skillsSkill-driven behavior, multi-turn chat
Simple MemoryConversation history storageMarkdown format, long-term vector storage

Specialized Agents

Pre-configured agents for specific domains. Same AI configuration as base agents with domain-focused defaults.
AgentDescriptionColor
Android Control AgentAndroid device controlGreen
Coding AgentCode executionCyan
Web Control AgentWeb automationRed
Task Management AgentTask automationPurple
Social Media AgentSocial messagingGreen

AI Agent Node

The AI Agent uses LangGraph for structured execution with tool calling and iterative reasoning.

Input Handles

HandlePositionPurpose
Main InputLeftUser prompt/data from upstream nodes
MemoryBottom-left (diamond)Connect Simple Memory
ToolsBottom-right (diamond)Connect Tool nodes

Parameters

provider
select
required
AI provider: openai, anthropic, gemini, openrouter, groq, cerebras
model
select
required
Model to use (options based on provider)
systemPrompt
string
Instructions that define the agent’s behavior and personality
prompt
string
required
The user message. Supports template variables like {{nodeName.field}}
maxIterations
number
default:"5"
Maximum reasoning iterations for complex tasks

Output

{
  "response": "The agent's final response",
  "thinking": "Reasoning process (if thinking enabled)",
  "iterations": 2,
  "tool_calls": [
    {"tool": "calculator", "input": {"operation": "add", "a": 5, "b": 3}, "output": 8}
  ]
}

Tool Calling

Connect Tool nodes to the input-tools handle (bottom-right diamond) to give the agent capabilities:
[Calculator Tool] --+
                    +--> [AI Agent] --> [Output]
[Web Search Tool] --+
The agent will automatically use tools when needed based on the user’s request.

Chat Agent Node

The Chat Agent is designed for conversational interactions with skill-based behavior extension.

Input Handles

HandlePositionPurpose
Main InputLeftUser message (e.g., from Chat Trigger)
MemoryBottom-left (diamond)Connect Simple Memory
SkillsBottom-right (diamond)Connect Skill nodes
ToolsBottom (diamond)Connect Tool nodes

Parameters

provider
select
required
AI provider: openai, anthropic, gemini, openrouter, groq, cerebras
model
select
required
Model to use (options based on provider)
systemPrompt
string
Base system instructions (extended by connected skills)
prompt
string
User message. If empty, reads from connected input node’s message, text, or content field.

Skill Support

Connect Skill nodes to the input-skill handle to extend the Chat Agent’s capabilities:
[WhatsApp Skill] --+
                   +--> [Chat Agent] --> [Response]
[Maps Skill] ------+
Skills provide domain-specific instructions and allowed tools to the Chat Agent.

Input Methods

  1. Template Variable (Explicit):
    Prompt: {{chatTrigger.message}}
    
  2. Auto-Fallback (Implicit): Leave Prompt empty - the agent reads from the connected input node automatically.

Output

{
  "response": "Chat Agent's response",
  "thinking": "Reasoning (if enabled)",
  "model": "claude-3-5-sonnet",
  "provider": "anthropic"
}

Simple Memory Node

Stores conversation history in markdown format for AI agents.

Connection

Simple Memory connects to the memory handle (diamond shape on bottom-left):
[Simple Memory] ---(diamond)---> [AI Agent or Chat Agent]
Connect to the diamond handle, not the main input. The main input is for data flow.

Parameters

sessionId
string
default:"default"
Unique identifier for the conversation session. Use dynamic values for multi-user scenarios.
windowSize
number
default:"10"
Number of message pairs to keep in short-term memory
memoryContent
string
Editable conversation history in markdown format. View and edit directly in the parameter panel.
longTermEnabled
boolean
default:"false"
Archive old messages to vector DB for semantic retrieval
retrievalCount
number
default:"3"
Number of relevant memories to retrieve from long-term storage (shown when longTermEnabled is true)

Memory Format

Conversation history is stored in markdown:
# Conversation History

### **Human** (2025-01-30 14:23:45)
What is the weather like today?

### **Assistant** (2025-01-30 14:23:48)
I don't have access to real-time weather data...

Memory Flow

  1. Agent reads memoryContent markdown from connected Simple Memory node
  2. Parses markdown to LangChain message format
  3. (If enabled) Retrieves relevant context from vector store
  4. Executes with conversation history
  5. Appends new messages to markdown
  6. Trims to keep last N pairs (windowSize)
  7. Archives removed messages to vector store (if longTermEnabled)
  8. Saves updated markdown back to node parameters

Dynamic Session IDs

For multi-user scenarios, use template variables:
Session ID: {{webhookTrigger.body.user_id}}
This creates separate memory for each user.

Building Agent Workflows

Basic AI Agent with Tools

[Webhook Trigger] --> [AI Agent] --> [Webhook Response]
                          ^
                          |
                   [Simple Memory]

                   [Calculator Tool]
                          |
                          v
                     [AI Agent]

Chat Agent with Skills

[Chat Trigger] --> [Chat Agent] --> [Console]
                        ^
                        |
                 [Simple Memory]

                 [WhatsApp Skill]
                        |
                        v
                   [Chat Agent]

Step-by-Step Setup

  1. Add AI Agent or Chat Agent from AI Agents category
  2. Add Simple Memory and connect to memory handle (diamond)
  3. Add Tools/Skills and connect to respective handles
  4. Add Trigger (Webhook, Chat, WhatsApp) connected to main input
  5. Add Response node connected to agent output

AI Agent vs Chat Agent

FeatureAI AgentChat Agent
Primary UseComplex reasoning tasksConversational interactions
Tool CallingYes (LangGraph)Yes (LangGraph)
Memory SupportYesYes
Skill SupportYesYes
Bottom HandlesSkill, ToolsSkill, Tools
Left HandlesInput, MemoryInput, Memory
Best ForTask automation, reasoningChat interfaces, multi-turn dialog

Async Agent Delegation

Agents can delegate tasks to other agents connected via the input-tools handle. The parent agent continues immediately while the child works in the background.

How It Works

  1. Connect a specialized agent to a parent agent’s input-tools handle
  2. Parent agent calls delegate_to_<agent_type>(task="...", context="...")
  3. Child agent spawns as background task
  4. Parent receives {"status": "delegated", "task_id": "..."} immediately
  5. Child executes independently with its own tools

Example

[AI Agent] <--tools-- [Android Control Agent] <--tools-- [Battery Monitor]
                                              <--tools-- [WiFi Automation]
When the AI Agent needs Android control:
  • Calls delegate_to_android_agent(task="Check battery and enable WiFi if low")
  • Android Agent spawns in background with its own connected tools
  • AI Agent continues with other work

Multi-Turn Conversation Example

First Request

curl -X POST http://localhost:3010/webhook/chat \
  -d '{"user_id": "user123", "message": "My name is Alex"}'
Response: “Nice to meet you, Alex! How can I help you today?”

Second Request

curl -X POST http://localhost:3010/webhook/chat \
  -d '{"user_id": "user123", "message": "What is my name?"}'
Response: “Your name is Alex, as you told me earlier.”

Tips

Use descriptive system prompts to define agent behavior clearly.
Set Max Iterations based on task complexity. Simple Q&A: 1-2, Complex reasoning: 3-5.
Use unique Session IDs per user/conversation for proper isolation.
Connect Skills to Chat Agent for domain-specific behavior (WhatsApp, Maps, HTTP, etc.).
Long conversations with large window sizes can exceed model context limits. Use appropriate windowSize for your use case.

Troubleshooting

  • Verify Simple Memory is connected to diamond handle (not main input)
  • Check Session ID is consistent across requests
  • Ensure workflow is deployed (not just saved)
  • Verify Tool nodes are connected to the input-tools diamond handle
  • Check tool node has proper schema/description
  • Ensure the prompt requires tool usage
  • Verify Skill nodes are connected to input-skill handle
  • Check skill SKILL.md content is valid
  • Ensure skill’s allowed-tools match connected tool nodes
  • Reduce windowSize setting (10-20 messages recommended)
  • Enable long-term memory to archive old messages
  • Consider clearing sessions periodically