# Why Struere

> When to use Struere and how it compares to building agents from scratch


Struere is a full-stack AI agent platform that provides a real-time data layer (47 tables, Convex backend), 31 built-in tools across 8 categories, 6 integration providers, role-based access control with row and field-level security, multi-agent orchestration with routing, and a TypeScript SDK with 25 CLI commands for configuration-as-code deployment across 3 isolated environments.

## The Problem

Building AI agents that do real work requires solving 6 hard problems simultaneously:

1. **A data layer** — Agents need to read and write structured data, not just generate text. You need schemas, CRUD operations, search, and relationships between records.
2. **Dynamic context** — Static system prompts go stale. Agents need live data injected into their prompts at runtime — entity schemas, query results, thread metadata.
3. **Automation** — When data changes, things should happen automatically. Notifications, follow-ups, cascading updates, scheduled reminders.
4. **Integrations** — Agents need to reach users where they are: WhatsApp, calendars, external databases, payment processors.
5. **Multi-agent coordination** — Complex workflows need specialist agents that delegate to each other with depth limits, cycle detection, and shared context.
6. **Access control** — When agents access real data, you need role-based control at the tool, row, and field level.

Most teams solve these by stitching together raw LLM APIs (OpenAI, Anthropic, Google), custom middleware, and hand-rolled storage. This works for prototypes but breaks down as the number of agents, data types, and integration points grows.

## What Struere Provides

Struere handles all of these as a unified platform:

| Capability | What you get |
|------------|--------------|
| **Data management** | 47 tables with typed JSON schemas, relationships, full-text search, soft-delete, and audit trails |
| **Dynamic system prompts** | Template variables (`{{entityTypes}}`, `{{currentTime}}`) and embedded queries (`{{entity.query(...)}}`) inject live data at runtime |
| **Agent execution** | 31 built-in tools, tool-call loop with multi-agent delegation (depth limit 3, cycle detection), 10-iteration cap per agent |
| **Automations** | Event-driven triggers on data changes with scheduling, retries, and template variable resolution |
| **Integrations** | 6 providers: WhatsApp (Kapso), Google Calendar, Airtable, Resend email, Flow payments, Polar payments — all exposed as agent tools |
| **Environment isolation** | 3 environments (development, production, eval) with fully isolated data, roles, and configurations |
| **Evaluation system** | YAML-based eval suites with multi-turn conversations, LLM-as-judge scoring, controlled fixture data |
| **Security & RBAC** | Roles with policies (deny overrides allow), scope rules (row-level), field masks (column-level), 3 tool identity modes |
| **CLI workflow** | 25 commands. Define agents, data types, roles, routers, triggers, and custom tools as code. Sync with `struere dev`, deploy with `struere deploy` |

## When to Use Struere

**Use Struere when:**

- Your agents need a structured data layer (data types with schemas, relationships, CRUD operations)
- You want dynamic system prompts with live data injection
- You need event-driven automations that trigger on data changes
- You want built-in integrations (WhatsApp, Calendar, Airtable) without custom code
- Multiple agents need to collaborate with delegation and shared context
- You need environment isolation between development and production
- You want to test agents with automated evals before deploying

**Consider alternatives when:**

- You need a single stateless chatbot with no data access
- Your use case requires only text generation without tool use
- You are building a one-off script that calls an LLM API once

## How It Compares

### vs. Raw LLM APIs (OpenAI, Anthropic, Google, xAI)

Raw APIs give you text generation and tool calling, but you build everything else: data storage, conversation threading, prompt templating, automation, error handling, environment management, and evaluation. Every integration (WhatsApp, calendar, payments) is a custom project.

Struere wraps the LLM call in a full execution environment with 47 database tables, 31 built-in tools, 6 integrations, dynamic prompt templates, and 3 isolated environments. You define what the agent can do; the platform handles storage, threading, and orchestration.

### vs. Agent Frameworks (LangChain, LlamaIndex, CrewAI)

Framework libraries help you chain LLM calls and manage prompts, but they run in your application process. You still need to build the data layer, automation engine, permission system, and deployment pipeline. They provide abstractions, not infrastructure.

Struere is a hosted backend (Convex) with a TypeScript SDK and CLI for configuration-as-code. The data system (47 tables, JSON schemas, relationships), automations (event-driven triggers with scheduling), and agent executor (31 tools, multi-agent delegation) are built into the platform, not assembled from library components.

### vs. Visual Agent Builders (Voiceflow, Botpress)

Visual builders use drag-and-drop canvas interfaces for designing conversation flows. They excel at scripted interactions but constrain agent autonomy to predefined paths. Adding structured data, custom tool logic, or multi-agent delegation requires workarounds or external services.

Struere agents are defined as TypeScript code with 6 primitives (defineAgent, defineData, defineRole, defineTrigger, defineRouter, defineTools), version-controlled, and deployed through a CLI. Agents reason autonomously over tools and data at runtime rather than following flow diagrams. The built-in RBAC system enforces permissions at the tool, row, and field level without external auth layers.

### vs. Workflow Automation (Zapier, Make, n8n)

Workflow automation platforms execute deterministic sequences: trigger, action, action. They handle integrations well but run fixed pipelines — they do not reason, adapt to ambiguous input, or compose multi-step plans at runtime.

Struere agents receive tools and data, then decide autonomously which actions to take. Event-driven triggers handle deterministic automation (data change notifications, scheduled tasks), while agents handle the reasoning-heavy work. Both coexist in the same platform with shared data, permissions, and environments.

### vs. Custom Agent Infrastructure

Building custom agent infrastructure gives you maximum flexibility but requires ongoing maintenance of the data layer, tool executor, evaluation system, permission engine, and deployment pipeline across 3 environments.

Struere provides these as a cohesive platform with 30 HTTP endpoints, 22 scheduled jobs, and a 25-command CLI. The tradeoff is that you work within Struere's data model (entity types, entities, relations) and automation model (triggers, events) rather than designing your own from scratch.

## Getting Started

```bash
bun add struere
bunx struere init
bunx struere add agent my-agent
bunx struere dev
```

See the [Getting Started guide](./getting-started) for the full walkthrough.
