← Back to all guides

Text Graph Builder — Build Advanced AI Chatbots

Langoedge Team7 min read

What is a Text Graph?

A Text Graph in Langoedge is a programmatic AI agent workflow built on our custom graph execution engine (inspired by graph-based orchestration patterns like LangGraph). It accepts user input, executes logic through connected nodes, and generates a response — all powered by Large Language Models (LLMs).

Definition — Text Graph: A visual, node-based workflow where each node is an AI action (LLM call, API request, Python code) and each edge is a routing decision that determines the next step.

Key Concepts

Every graph is a collection of **Nodes** (actions) and **Edges** (routing logic) that operate on a shared **State** (memory).


How It Works

When you build a graph in the dashboard, Langoedge "compiles" your visual design into executable Python code behind the scenes.

1

Draw the Graph

Use the drag-and-drop canvas to connect nodes. Define what each node does and how they connect.
2

JSON Compilation

The UI produces a JSON definition of your nodes, edges, and tool bindings.
3

State Machine Execution

Our custom graph execution engine translates this JSON into a running state machine.
4

Stream Results

Tokens are streamed back to the user via **Server-Sent Events (SSE)** for a ChatGPT-like experience.

Memory & State

Langoedge uses a structured memory system. Instead of one giant text blob, memory is divided into 15 fields (field1 through field15) plus summaries and file_contents.

The add_messages Reducer

To prevent overwriting history, Langoedge uses a custom "reducer" function. When a node returns data for a field, it is appended to the existing list rather than replacing it.

# Conceptual State Schema
state = {
    "field1": [...],  # Primary Chat History list
    "field2": [...],  # Secondary Storage list
    "summaries": [...],  # Thread summaries: condensed overviews of long conversations generated by summariser nodes to reduce token usage in long-running sessions
    "file_contents": [...],  # Uploaded document text: raw text extracted from files uploaded to the session (e.g., PDFs or DOCX), available for RAG and Python nodes
}

This means your AI agent remembers every message in the conversation — even after days of back-and-forth. The summaries and file_contents fields follow the same append-only reducer as field1field15.


Node Types

Langoedge provides four node types for building sophisticated AI workflows.

Method Node

A standard LLM call. You provide a System Prompt, and the AI generates a response based on the input state. Use this for greeting, reasoning, summarizing, or drafting.

Retriever Tool (RAG)

Connects to vector databases to perform similarity searches against your uploaded documents. Perfect for FAQ bots and knowledge-base agents.

API Tool

Triggers external HTTP webhooks (REST APIs). Supports custom headers, authentication secrets, and JSON payloads. Connect to any service with an API.

Custom Python

Write raw Python code to transform data, run math, or implement custom logic using our protected AST evaluator. Use this when you need 100% deterministic results.


Logic & Routing (Edges)

Edges dictate where the conversation goes next. Langoedge supports three edge types.

1. Direct Edges

A simple connection from Node A to Node B. The flow proceeds in sequence.

2. Conditional Edges (Tool Conditions)

Logic-based routing. For example, a Tool Condition checks if the AI decided to use a tool. If yes, it routes to the Tool Node; otherwise, it finishes the conversation.

Use Case: "If the user asks about pricing, route to the Pricing Node. Otherwise, route to the General Q&A Node."

3. Quality Gates

A "Supervisor AI" evaluates the output of a node against specific rules. If the output fails (e.g., "be more polite"), the graph loops back for a retry. This is essential for compliance-critical workflows like legal emails or financial advice.


Text Graph Settings & Sidebar Configuration

When editing a text agent in the visual builder, the right-hand configuration panel allows you to configure essential settings (such as LLM models and core outputs) and optional settings (such as access control, secondary outputs, background execution, and memory persistence).

The settings are organized into three tabs: General, Flow, and Runtime.

Required Configurations

These settings must be configured for the chatbot/agent to function correctly and output data.

1. AI Engine (LLM Model Selection)

  • Tab Location: General tab -> AI Engine
  • Description: Select and configure the Large Language Model (LLM) that powers this agent (e.g., GPT-4o, GPT-4o-mini, Claude, or Gemini models) by clicking the Configure Model button. This model acts as the core reasoning engine for all LLM nodes in the workflow.

2. Final Destination (Target Node)

  • Tab Location: Flow tab -> Final Destination
  • Description: Specify which Node in the graph will generate the main response. The text graph executor will return the response from this specific target node back to the client application.

3. State Storage (Output Variable)

  • Tab Location: Flow tab -> State Storage
  • Description: Map the output of your final target node to one of the graph's State variables (such as field1 through field15). This determines where the final execution data is persisted in the shared conversation memory.

Optional Configurations

These settings can be adjusted to customize access control, data collection, and execution characteristics.

1. Access Control (Graph Protection Level)

  • Tab Location: General tab -> Access Control
  • Description: Define authorization permissions for who can view and execute your text agent:
    • Public: Anyone with the link or embed code can interact with the chatbot.
    • Protected: Restricted to specific authenticated or shared users.
    • Private: Only the creator can access and run the agent.

2. Secondary Outputs

  • Tab Location: Flow tab -> Secondary Outputs
  • Description: Add supplementary outputs to capture intermediate results. You can map other nodes in your graph to specific state fields, allowing the application to extract and store auxiliary data (such as user emails, order details, or sentiment scores) during runtime execution.

3. Background Task (Execute in Background)

  • Tab Location: Runtime tab -> Background Task
  • Description: Toggle this setting to enable asynchronous execution. If enabled, long-running agent tool calls (such as waiting for slow API webhooks or external database writes) are decoupled from the initial client request, allowing the graph to finish processing in the background without causing HTTP client timeouts.

4. Memory Persistence (Checkpoint TTL)

  • Tab Location: Runtime tab -> Memory Persistence
  • Description: Specify a Time-to-Live (TTL) duration in seconds to dictate how long conversation history is kept. After this duration has passed since the last interaction, session thread state snapshots are automatically purged from the MongoDB checkpointer database to maintain security and clean up inactive sessions.

Advanced Features

Server-Sent Events (SSE)

Langoedge provides real-time token streaming. As the AI generates each token, it is pushed to the frontend instantly — no loading spinners, no timeouts. This provides a snappy, ChatGPT-like experience for your users.

API Secrets & Security

Store your API keys in the Langoedge Vault. Use the x-langoedge-secret header in your API Tools to authenticate requests without exposing keys to the LLM or the frontend.

Background Execution

Enable background mode for long-running agents. Your agent can say "I'll wait for your email" and actually wake up hours later when the email arrives — powered by persistent session checkpoints.


Example: Building a Refund Bot

Here's how you'd build an e-commerce refund bot:

graph TD User([User requests refund]) --> NodeA(Node: Check Order) NodeA -->|Valid| NodeB[Tool: Process Refund] NodeB --> NodeC(Node: Confirm) NodeA -->|Invalid| NodeD(Node: Decline)
  1. Check Order (LLM Node) — Extracts the order ID from the user's message.
  2. Process Refund (API Tool) — Calls your internal billing API with secure vault credentials.
  3. Confirm (LLM Node) — Formats a polite confirmation message.

Frequently Asked Questions

What is a Text Graph used for?
Text Graphs are used to build AI chatbots, support agents, lead qualification bots, knowledge-base search agents, and automated workflows that interact with your business tools via APIs.
Can a Text Graph call an external API?
Yes. Add an API Tool node, configure the HTTP endpoint, method, headers, and authentication. Langoedge securely injects your vault credentials into every request.
How does RAG work in Langoedge?
Upload documents to the Knowledge Base. Langoedge chunks them, creates vector embeddings, and stores them in a vector database. When a user asks a question, the Retriever Tool searches for relevant chunks and feeds them to the LLM as context.
Can I use Langoedge without coding?
Yes. The visual graph builder requires no code. However, for advanced use cases like custom Python transformations or complex API integrations, some technical knowledge helps.
Is there an API for Text Graphs?
Yes. You can invoke Text Graphs from external applications via the `/invoke-from-external-app` REST endpoint using your `x-langoedge-secret` API key.

For details on custom state parameters, please consult our developer guides.
LT

Langoedge Team

The Langoedge engineering team builds AI agent infrastructure that empowers businesses to deploy reliable, observable AI staff. Follow Langoedge Team on LinkedIn for product updates and architectural deep dives.