Getting Started with AI-Powered Workflows
Learn how to leverage AI capabilities across your Spojit workflows.
What This Integration Does
Spojit treats AI as a first-class workflow building block. Instead of bolting a chatbot onto an automation, you drop AI Agent nodes into the same canvas where your connectors, triggers, and transforms live. The agent can read upstream variables, call MCP tools, and hand structured output to downstream steps. The result is workflows that can reason about messy data, classify intent, extract structured fields from documents, and decide which path to take at runtime.
This guide is a tour rather than a single workflow. Each section below names a Spojit feature, when to reach for it, and which built-in pieces compose with it. Use the "Where to Start" section to pick a concrete tutorial once you know which pattern fits your use case.
Prerequisites
- A Spojit workspace with at least one workflow created (even an empty one is fine for clicking through nodes).
- At least one connector configured. The AI Agent has tools to call so pick one that matches a real system you have access to (Shopify, Monday, Slack, MongoDB, etc.).
- For Knowledge Base flows: documents you can upload (PDFs, spreadsheets, emails, images).
- Familiarity with the canvas. If this is your first workflow, read the Trigger and Connector node docs linked at the bottom first.
Step 1: Agent Mode - Let the AI Pick Tools
Add an AI Agent node to the canvas and give it a goal in natural language. Bind the connectors you want it to use (for example monday with create-item and list-boards, or slack with send-message). The agent reads the prompt, inspects the bound tools, and decides which to call and in what order. Use this when the exact steps depend on the input, e.g. "Triage this support email: if it's billing, create a Monday item on the Finance board, otherwise reply on Slack."
Step 2: Structured Output - Constrain the JSON Shape
In the AI Agent node, switch the output mode to Structured and paste a JSON schema. The model is forced to return JSON that matches the schema, which means the next step can reference {{ ai.fieldName }} without defensive parsing. A typical schema for order triage:
{
"type": "object",
"properties": {
"category": { "type": "string", "enum": ["billing", "shipping", "product", "other"] },
"urgency": { "type": "string", "enum": ["low", "medium", "high"] },
"summary": { "type": "string" }
},
"required": ["category", "urgency", "summary"]
}
Downstream Condition nodes can branch on {{ ai.category }} with zero ambiguity.
Step 3: Knowledge Base - Ground the Agent in Your Docs
Add a Knowledge node before your AI Agent. Point it at a knowledge base you've indexed (policy docs, product manuals, runbooks). The node returns the top-k most relevant chunks, which you pass into the agent's prompt as context. This is retrieval-augmented generation (RAG) in two clicks. Use it whenever an answer needs to be grounded in something other than the model's training data, for example replying to a customer with the exact wording from your shipping policy.
Step 4: Document Processing - Pull Text Out of Files
Use the pdf connector's extract-text tool, the csv connector's parse tool, or the image connector for OCR-friendly preprocessing. Feed the extracted text into an AI Agent that returns Structured Output. This pattern handles invoices, contracts, expense reports, and scanned forms - the agent does the field extraction, your downstream nodes do the routing and posting.
Step 5: Pick the Right Model
Each AI Agent node lets you choose a model. The trade-off is cost, latency, and reasoning ability:
- Claude Haiku - Fast and cheap. Good for classification, simple extraction, and high-volume routing.
- Claude Sonnet - Balanced. Handles most multi-step reasoning and tool use well.
- Claude Opus - Most capable. Reach for it when the task involves nuanced reasoning, code, or long synthesis.
- Gemini Flash / Pro - Very large context windows. Great when you need to process a long document in a single pass.
Step 6: Code Runner - Drop Down When AI Is Overkill
For deterministic logic (formatting, regex, math, custom data shaping), use a Connector node pointing at the code connector with execute-javascript or execute-python. It runs in a sandbox and is cheaper and more predictable than an AI Agent for things that don't need reasoning. A good rule: if you can describe the logic in three lines of pseudocode, use the code connector instead of an agent.
Tips
- Match the model to the task. Don't pay Opus prices for what Haiku can classify in 200ms.
- Prefer Structured Output over free-form text any time the next node has to read a specific field.
- Keep agent tool lists small. Binding 30 tools confuses the model and balloons token usage. Five focused tools per agent is a sweet spot.
- Cache Knowledge Base results for high-volume flows where the same chunks get retrieved repeatedly.
Common Pitfalls
- Skipping schema validation. Even Structured Output can produce empty strings or missing optional fields. Add a Condition node to short-circuit on bad input.
- Hidden costs. A loop that calls an agent per item can add up fast. Use a single agent call with batched input where possible.
- Stale knowledge. If your docs change, your knowledge base needs re-indexing. Schedule a refresh workflow rather than embedding once and forgetting.
- Prompt injection. User-supplied text can override your system prompt. Treat external content as data, not instructions, and use Structured Output to constrain what the model can return.
Testing
Build each AI Agent node in isolation first. Pin a small sample input as a variable, run the node alone, and inspect the output. Once the agent behaves on five hand-picked inputs, wire it into the surrounding flow and run end-to-end on a tiny scope (a single record, a single Slack channel) before turning the schedule on.
Where to Start
Browse the AI-Powered Automation and Knowledge Base & Document Management categories for end-to-end tutorials that put these pieces together.