Agents

Agents

AI agents in Seclai are intelligent workflows that process information, interact with knowledge bases, and perform automated tasks through a series of configurable steps.

What are Agents?

Agents are AI-powered workflows that can:

  • Call AI models (GPT, Claude, Gemini, and 50+ others) to generate responses
  • Transform and extract data from various formats (JSON, XML, HTML)
  • Integrate with external systems via webhooks and APIs
  • Send notifications via email or other channels
  • Run automatically on schedules or when content changes
  • Store results in AWS S3 or display them directly

Each agent is composed of ordered steps that execute sequentially, with outputs from one step feeding into the next. This creates powerful, flexible workflows for content processing and automation.

Agent Components

Agent Definition

An agent definition includes:

  • Name - A descriptive identifier for the agent
  • Description - Optional details about the agent's purpose
  • Tags - Labels for organization and filtering
  • Steps - The ordered list of processing steps (must have at least one)

Agent Triggers

Triggers define when and how an agent runs:

Dynamic Input

Manual execution with custom input provided each time

Best for: Interactive agents, chat interfaces, ad-hoc processing

Template Input

Scheduled execution with predefined input template

Best for: Recurring reports, periodic content analysis, scheduled tasks

Input Content Type

For template_input triggers, you can optionally set an input_content_type so Seclai knows how to interpret and store the rendered trigger input.

Common values:

  • text/plain
  • text/html
  • application/json
  • application/xml

You can also provide a templated value (for example {{metadata.content_type}}) so the content type can be determined from runtime metadata.

Validation behavior:

  • At save-time, template expressions are allowed.
  • At run-time, after substitutions are applied, the resolved value must be one of the supported content types above.

Content Added

Runs when new content is added to a knowledge base

Best for: Processing new documents, monitoring RSS feeds, ingesting data

Content Updated

Runs when existing content in a knowledge base changes

Best for: Tracking content changes, update notifications, data synchronization

Content Added or Updated

Runs on both new and updated content

Best for: Comprehensive monitoring, content processing pipelines

Creating an Agent

Via Account

  1. Navigate to Agents in your account
  2. Click Create Agent
  3. Configure the agent:
    • Name - Give it a descriptive name
    • Description - Optional details about its purpose
    • Trigger Type - Select when it should run
    • Knowledge Base - (Optional) Connect to a knowledge base
    • Template - Start with blank or use a retrieval example

Agent Steps

Agents execute a series of steps in order. Each step type serves a specific purpose:

Retrieval Step

Searches a knowledge base using semantic similarity to find relevant content.

Use cases:

  • Finding relevant documents for a query
  • Gathering context before AI generation
  • Searching knowledge bases

Prompt Call Step

Calls an AI model (GPT, Claude, Gemini, etc.) to generate responses.

Features:

  • 50+ supported models
  • JSON schema support for structured outputs
  • Tool/function calling support
  • Temperature and parameter controls
  • System prompts and instructions

Use cases:

  • Generating summaries
  • Answering questions
  • Extracting structured data
  • Creative content generation

Transform Step

Transforms text using string operations, regex, or simple manipulations.

Use cases:

  • Text formatting
  • String replacement
  • Pattern matching
  • Data cleaning

Extract JSON Step

Extracts and validates JSON data from text.

Use cases:

  • Parsing API responses
  • Extracting structured data
  • Validating JSON format

Extract HTML Step

Extracts content from HTML using CSS selectors.

Use cases:

  • Web scraping
  • HTML parsing
  • Content extraction

Extract XML Step

Extracts data from XML using XPath expressions.

Use cases:

  • XML data parsing
  • RSS feed processing
  • Structured data extraction

Filter Step

Filters documents from a knowledge base based on metadata criteria using MongoDB-style query filters.

Features:

  • Metadata filtering with operators ($eq, $ne, $lt, $gt, $in, $regex, etc.)
  • Logical operators ($and, $or, $not)
  • Sorting by multiple fields
  • Pagination with limit and offset

Use cases:

  • Finding documents by author, date, category, or custom metadata
  • Filtering content based on complex criteria
  • Sorting and paginating results
  • Combining multiple filter conditions

Display Result Step

Marks a step's output as the final result to display.

Use cases:

  • Showing final output to users
  • Marking completion point
  • Returning formatted results

Webhook Call Step

Makes HTTP requests to external APIs or webhooks.

Use cases:

  • API integrations
  • Triggering external systems
  • Posting to Slack/Discord
  • Custom integrations

Write AWS S3 Object Step

Saves content to an AWS S3 bucket.

Use cases:

  • Storing generated reports
  • Archiving results
  • File backups
  • Data export

Send Email Step

Sends email notifications with content.

Use cases:

  • Alert notifications
  • Report delivery
  • Status updates
  • Content distribution

String Substitutions

Agent steps support dynamic variable substitutions using {{variable}} syntax:

{{agent_input}}          - The original input to the agent
{{steps.step_id.output}} - Output from a previous step
{{metadata.field_name}}  - Metadata field value

Example prompt:

Analyze this content: {{agent_input}}

Previous summary: {{steps.summarize.output}}

Author: {{metadata.author}}

Scheduled Runs

Agents with template_input trigger type can run on schedules:

Schedule Frequencies

  • Hourly - Every N hours
  • Daily - Every N days at specific time
  • Weekly - Specific day(s) of week at specific time
  • Monthly - Specific day of month or week of month

Running Agents

Manual Execution

For agents with dynamic_input or template_input triggers:

curl -X POST https://api.seclai.com/agents/{agent_id}/runs \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "input": "What are the latest AI trends?",
    "metadata": {
      "user_id": "123",
      "source": "api"
    }
  }'

Automatic Execution

Agents with content-based triggers run automatically when:

  • New content is added to their knowledge base
  • Existing content is updated
  • Scheduled time arrives (for template_input with schedules)

Monitoring Agent Runs

Run Status

Each agent run has a status:

  • pending - Queued for execution
  • processing - Currently running
  • completed - Finished successfully
  • failed - Error occurred

Step Runs

Each step in a run tracks:

  • Status (pending, processing, completed, failed)
  • Input and output data
  • Error messages
  • Execution time
  • Credit usage

Viewing Run History

Access run history via:

  • Account → Agents → [Agent Name] → Runs tab
  • API endpoint: /agents/{agent_id}/runs

Agent Warnings

The system analyzes your agent definition and provides warnings for:

  • Missing required metadata fields
  • Undefined step references in substitutions
  • Invalid model selections
  • Circular dependencies
  • Configuration issues

Warnings appear in the editor and help you fix issues before deployment.

Validation

Before execution, agents are validated:

  • Must have at least one step
  • All string substitutions must reference valid fields
  • Model configurations must be compatible
  • Required fields must be present

Next Steps