Building AI Agents
Building AI Agents
How to Add Intelligence to Synap
:::note Some sections below reference LangGraph as an internal agent option. LangGraph was evaluated and deferred — the current Intelligence Hub uses a peer-agent network built on the Vercel AI SDK. The external Hub Protocol pattern described here remains the recommended integration path. :::
The Intelligence Services Model
Synap's AI architecture is different: AI runs as external services, not embedded code.
Why External?
| Traditional (Built-in) | Synap (External Services) |
|---|---|
| One AI model | Your choice of model |
| Vendor lock-in | Swap anytime |
| Can't use proprietary models | Keep your IP |
| Scales with app | Scale independently |
The Flow
Quick Decision Tree
Option 1: Intelligence Service (Recommended)
Best for: Production AI, proprietary models, independent scaling
1. Create Your Service
2. Implement the Service
3. Deploy Anywhere
- Cloudflare Workers: Serverless, global edge
- AWS Lambda: Serverless, AWS ecosystem
- Railway: One-click deploy
- Your VPS: Full control
- Local (ngrok): Development
4. Register with Data Pod
5. Frontend Integration
Users can invoke your service:
Option 2: Internal Agent (LangGraph)
Best for: Simple utilities, tight integration, open-source contributions
When to Use Internal
- No proprietary logic
- Simple AI calls
- Contributing to core
- Low latency critical
Example: Note Summarizer
Register in Router
Option 3: Simple AI Call (Vercel AI SDK)
Best for: One-off AI features, prototyping
Example: Smart Tags
Proposals: Human-in-the-Loop
All AI-created entities start as proposals awaiting user approval.
The Flow
Why Proposals?
- Review before commit: See what AI wants to create
- Confidence scores: AI explains its reasoning
- Audit trail: Track all AI suggestions
- Undo capability: Reject bad suggestions
Proposal API
AI Metadata Standard
Always include AI context in metadata:
This enables:
- UI badges ("AI-suggested")
- Filtering (show only high-confidence)
- Debugging (trace AI reasoning)
- Analytics (which AI performs best)
Real Examples
1. Meeting Notes Analyzer
Intelligence Service that:
- Reads meeting notes
- Extracts action items → Tasks
- Identifies attendees → Person entities
- Creates relations (Task → Person)
All as proposals for user review.
2. Knowledge Graph Builder
Intelligence Service that:
- Reads all user notes
- Finds semantic connections
- Proposes relations between notes
- Generates summary notes
User reviews and approves connections.
3. Smart Inbox
Internal Agent that:
- Monitors inbox items
- Classifies by type
- Suggests tags
- Routes to projects
Runs on every inbox item creation.
Deployment Patterns
Development
Production
Cloudflare Workers
Docker
Testing
Test Intelligence Service Locally
Best Practices
- Use Intelligence Services for production - Better separation, scaling
- Use Internal Agents sparingly - Only for simple utilities
- Always create proposals - Never write directly
- Include metadata - Confidence, reasoning, model
- Test with real Data Pods - Use Hub Protocol SDK
- Version your APIs - Service endpoints can change
- Monitor confidence scores - Track AI performance
Next Steps
- Choose your approach (Intelligence Service recommended)
- Read Hub Protocol docs → Hub and spoke
- See composability → Composable architecture
- Build and deploy
Resources:
