Introducing Ragwalla Agents: Beyond Simple RAG

Introducing Ragwalla Agents: Beyond Simple RAG Ragwalla Agents extend the traditional RAG (Retrieval-Augmented Generation) model by adding tool execution, conversation memory, and real-time interaction capabilities. While basic RAG systems...

Share:

Introducing Ragwalla Agents: Beyond Simple RAG

Ragwalla Agents extend the traditional RAG (Retrieval‑Augmented Generation) model by adding tool execution, conversation memory, and real‑time interaction capabilities. While basic RAG systems retrieve documents to answer questions, agents can perform actions, call APIs, and maintain context across multi‑turn conversations.

Understanding the Evolution from RAG to Agents

Traditional RAG workflows follow a simple pattern: embed your documents, store them in a vector database, retrieve relevant chunks for user queries, and generate responses. This works well for knowledge‑based Q&A but falls short when users need to accomplish tasks.

Ragwalla Agents introduce five key capabilities that transform static RAG into dynamic, actionable AI:

  • Tool Execution – Agents can call functions, APIs, and external services
  • Conversation Memory – Context persists across multiple interactions
  • Real‑time Streaming – Responses stream as they're generated
  • Multi‑Agent Composition – Agents can delegate to specialized sub‑agents
  • MCP Integration – Connect to external tools via Model Context Protocol

How Ragwalla Agents Work

Architecture Overview

┌─────────────┐     ┌──────────────┐     ┌─────────────┐
│   Client    │────▶│    Agent     │────▶│     LLM     │
│  (HTTP/WS)  │◀────│   Service    │◀────│  (OpenAI)   │
└─────────────┘     └──────┬───────┘     └─────────────┘
                           │
                    ┌──────▼───────┐
                    │    Tools     │
                    ├──────────────┤
                    │ • Function   │
                    │ • MCP        │
                    │ • Knowledge  │
                    │ • Assistant  │
                    │ • API        │
                    └──────────────┘

When a user sends a message, the agent:

  1. Analyzes the request and determines if tools are needed
  2. Executes appropriate tools (database queries, API calls, etc.)
  3. Synthesizes results into a natural‑language response
  4. Streams the response in real time

WebSocket‑First Design

Unlike traditional chat APIs that require polling or complex thread management, Ragwalla Agents use WebSocket connections for immediate bidirectional communication:

```javascript
// Connect to an agent
const ws = new WebSocket(
  `wss://api.ragwalla.com/v1/agents/customer-support/main?token=${token}`
);

// Send a message
ws.send(
  JSON.stringify({
    type: 'message',
    content: 'Check the status of order #12345'
  })
);

// Receive streaming responses
ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.type === 'chunk') {
    console.log(data.content); // Real‑time response streaming
  }
};
```

This approach eliminates the complexity of managing conversation threads manually while providing immediate feedback to users.

The Five Tool Types

Ragwalla Agents support five distinct tool types, each optimized for different integration patterns:

1. Function Tools

Custom JavaScript functions that execute in a secure sandbox:

javascript
{
  type: 'function',
  function: {
    name: 'calculate_shipping',
    description: 'Calculate shipping cost for an order',
    parameters: {
      type: 'object',
      properties: {
        weight: { type: 'number' },
        destination: { type: 'string' },
        priority: { type: 'string', enum: ['standard', 'express'] }
      }
    },
    implementation: 
      'export default function ({ weight, destination, priority }) {' +
      '  const rates = {' +
      '    "US": 5.00,' +
      '    "CA": 8.00,' +
      '    "EU": 12.00,' +
      '    "default": 15.00' +
      '  };' +
      '  ' +
      '  const baseRate = rates[destination] || rates.default;' +
      '  const weightCost = weight * 0.5;' +
      '  const priorityMultiplier = priority === "express" ? 2 : 1;' +
      '  ' +
      '  return {' +
      '    cost: (baseRate + weightCost) * priorityMultiplier,' +
      '    currency: "USD"' +
      '  };' +
      '}'
  }
}

2. MCP Tools

Connect to external services via Model Context Protocol:

javascript
{
  type: 'mcp',
  mcp: {
    serverId: 'weather-server-123',
    toolName: 'get_current_weather'
  }
}

3. Knowledge‑Base Tools

Perform vector search across your documents:

javascript
{
  type: 'knowledgeBase',
  knowledgeBase: {
    vectorStoreId: 'vs_45678',
    name: 'search_policies',
    description: 'Search company policies and procedures'
  }
}

4. Assistant Tools

Delegate specialized tasks to other AI assistants:

javascript
{
  type: 'assistant',
  assistant: {
    assistantId: 'asst_12345',
    name: 'legal-review',
    description: 'Review contracts and legal documents'
  }
}

5. API Tools

Make direct HTTP requests to external services:

javascript
{
  type: 'api',
  api: {
    url: 'https://api.inventory.com/stock',
    method: 'GET',
    headers: { 
      'Authorization': 'Bearer ${INVENTORY_TOKEN}'
    }
  }
}

Real‑World Example: Customer Support Agent

Here's how these concepts work together in a practical customer‑support scenario:

javascript
// Create a comprehensive support agent
const supportAgent = await createAgent({
  name: 'customer-support',
  description: 'Handles customer inquiries and issues',
  instructions: 'You are a helpful customer support agent. Always check our knowledge base first, then use appropriate tools to resolve issues.',
  tools: [
    // Search support documentation
    {
      type: 'knowledgeBase',
      knowledgeBase: {
        vectorStoreId: 'vs_12345',
        name: 'search_help_articles',
        description: 'Search through help documentation'
      }
    },
    // Check order status
    {
      type: 'function',
      function: {
        name: 'check_order_status',
        description: 'Check the status of a customer order',
        parameters: {
          type: 'object',
          properties: {
            orderId: { type: 'string' }
          },
          required: ['orderId']
        },
        implementation: 
          'export default async function ({ orderId }) {' +
          '  // In real implementation, this would query your database' +
          '  // For demo purposes, returning mock data' +
          '  const orders = {' +
          '    "12345": {' +
          '      status: "processing",' +
          '      trackingNumber: "ABC123XYZ",' +
          '      estimatedDelivery: "2024-01-15"' +
          '    }' +
          '  };' +
          '  ' +
          '  const order = orders[orderId];' +
          '  if (!order) {' +
          '    throw new Error("Order not found");' +
          '  }' +
          '  ' +
          '  return order;' +
          '}'
      }
    },
    // Escalate complex issues
    {
      type: 'assistant',
      assistant: {
        assistantId: 'asst_human_escalation',
        name: 'escalate_to_human',
        description: 'Escalate to human support for complex issues'
      }
    }
  ]
});

Conversation Flow

When a customer asks "What's the status of my order #12345?", the agent:

  1. Receives the message via WebSocket
  2. Analyzes the request and identifies the need to check order status
  3. Executes the check_order_status function with orderId: "12345"
  4. Retrieves order information from your database
  5. Streams a natural response:

    Your order #12345 is currently being processed and should ship within 24 hours.
    Tracking number: ABC123XYZ
    Estimated delivery: January 15, 2024

If the customer then asks "What's your return policy?", the agent:

  1. Searches the knowledge base using the support‑documentation tool
  2. Finds relevant policy information
  3. Streams the policy details in a conversational format

The agent maintains conversation context throughout, so follow‑up questions work naturally.

When to Use Ragwalla Agents

Use‑Case Examples

  • DevOps Incident Response Agent – "There's a 500 error on the checkout page" → Agent checks logs, queries monitoring APIs, identifies the failing service, restarts containers, updates the incident ticket, and notifies the team, all while explaining each step in real time.
  • Financial Research Assistant – "Analyze Tesla's Q3 performance vs competitors" → Agent pulls SEC filings, fetches real‑time stock data, runs financial calculations, generates comparison charts, and produces a comprehensive analysis with citations.
  • Code Review Buddy – "Review this pull request for security issues" → Agent analyzes the code changes, checks against security best practices from your knowledge base, runs static‑analysis tools via MCP, identifies vulnerabilities, suggests fixes, and creates actionable feedback comments.
  • Sales Engineering Demo Agent – "Show how our API handles high‑traffic scenarios" → Agent creates live demo environments, generates realistic load‑testing data, monitors performance metrics in real time, and explains the results while automatically scaling resources as needed.
  • Smart Contract Auditor – "Audit this Solidity contract for vulnerabilities" → Agent analyzes the code, checks for known vulnerability patterns, runs multiple security‑scanning tools, calculates gas‑optimization opportunities, and generates a detailed security report with risk scores.
  • Multi‑Language Documentation Generator – "Create user guides for our new API" → Agent reads the codebase, generates examples in multiple programming languages, creates interactive tutorials, updates existing documentation, and publishes to multiple platforms simultaneously.
  • Compliance Monitoring Assistant – "Check if our new feature meets GDPR requirements" → Agent reviews the feature specification against GDPR documentation, identifies potential compliance issues, suggests implementation changes, and generates a compliance checklist for legal review.
  • Real Estate Market Analyzer – "Find investment opportunities in Austin under $500k" → Agent searches MLS data, analyzes neighborhood trends, calculates potential ROI, checks zoning regulations, and creates investment recommendations with market projections.

Why These Work So Well

Each example showcases multiple tool types working together:

  • Knowledge bases provide domain expertise
  • MCP tools connect to external services
  • Functions perform custom calculations
  • API tools fetch real‑time data
  • Assistant tools handle specialized analysis

The magic is in the orchestration – agents coordinate these tools automatically while maintaining natural conversation flow.

Comparison with Traditional RAG

Traditional RAG Ragwalla Agents
Static document retrieval Dynamic tool execution
Single‑turn interactions Multi‑turn conversations
Read‑only responses Actionable operations
Manual integration work Built‑in tool ecosystem
Complex threading APIs WebSocket simplicity

Getting Started

1. Create Your First Agent

javascript
const agentResponse = await fetch('https://api.ragwalla.com/v1/agents', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: 'demo-agent',
    description: 'A simple demonstration agent',
    instructions: 'You are a helpful assistant that can search documentation and answer questions.',
    model: 'gpt-4o-mini',
    tools: [] // Start simple; add tools later
  })
});

const agent = await agentResponse.json();

2. Connect via WebSocket

```javascript
// Get connection token
const tokenResponse = await fetch(
  'https://api.ragwalla.com/v1/agents/token',
  {
    method: 'POST',
    headers: { 
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ agentId: agent.id })
  }
);

const { token } = await tokenResponse.json();

// Connect and start chatting
const ws = new WebSocket(
  `wss://api.ragwalla.com/v1/agents/demo-agent/main?token=${token}`
);

ws.onopen = () => {
  ws.send(JSON.stringify({
    type: 'message',
    content: 'Hello! How can you help me?'
  }));
};

ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  if (data.type === 'chunk') {
    process.stdout.write(data.content);
  } else if (data.type === 'done') {
    console.log('\n--- Response complete ---');
  }
};
```

3. Add Tools as Needed

Start with basic functionality and incrementally add tools:

```javascript
// Add a knowledge‑base search
await fetch(`https://api.ragwalla.com/v1/agents/${agent.id}/tools`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    type: 'knowledgeBase',
    knowledgeBase: {
      vectorStoreId: 'your-vector-store-id',
      name: 'search_docs',
      description: 'Search through our documentation'
    }
  })
});

// Add custom business logic
await fetch(`https://api.ragwalla.com/v1/agents/${agent.id}/tools`, {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    type: 'function',
    function: {
      name: 'calculate_price',
      description: 'Calculate price with discount',
      parameters: {
        type: 'object',
        properties: {
          basePrice: { type: 'number' },
          discountPercent: { type: 'number' }
        },
        required: ['basePrice', 'discountPercent']
      },
      implementation: 
        'export default function({ basePrice, discountPercent }) {' +
        '  const discount = basePrice * (discountPercent / 100);' +
        '  return {' +
        '    basePrice: basePrice,' +
        '    discount: discount,' +
        '    finalPrice: basePrice - discount' +
        '  };' +
        '}'
    }
  })
});
```

Best Practices

Agent Design

  • Single Responsibility – Each agent should have a focused purpose
  • Clear Instructions – Provide detailed context about the agent's role and capabilities
  • Incremental Complexity – Start simple and add tools gradually

Tool Selection

  • Minimize Tool Count – Only include tools the agent actually needs
  • Descriptive Names – Use clear, action‑oriented tool names
  • Input Validation – Always validate tool parameters

Performance Optimization

  • Cache Expensive Operations – Implement caching in frequently‑used tools
  • Choose Appropriate Models – Use gpt-4o-mini for speed, gpt-4 for complex reasoning
  • Monitor Usage – Track tool invocations and response times

Summary

Ragwalla Agents transform traditional RAG from a document‑retrieval system into an intelligent action platform. By combining conversation memory, tool execution, and real‑time streaming, agents can handle complex, multi‑step workflows while maintaining natural conversation flow.

The five tool types—functions, MCP, knowledge bases, assistants, and APIs—provide comprehensive integration options without requiring custom infrastructure. The WebSocket‑first design eliminates common pain points around thread management and polling.

Whether you're building customer support, sales assistance, or internal productivity tools, Ragwalla Agents provide the foundation for AI applications that don't just answer questions—they get things done.

Ready to build your first agent? Check out our complete developer documentation or sign up.

R

Ragwalla Team

Author

Build your AI knowledge base today

Start creating intelligent AI assistants that understand your business, your documentation, and your customers.

Get started for free