Extensibility Guide
Complete guide to extending the Synap ecosystem
Overview
Synap offers two extensibility mechanisms for adding intelligence and capabilities:
-
Internal Plugins (The Architech) - Extensions that modify the Core OS directly
- Single Agents: Simple LangGraph workflows
- Agent Graphs: Complex multi-agent orchestration
- Business Logic: Custom routers, handlers, database schemas
-
External Services (Marketplace) - Services hosted separately and connected via Hub Protocol
- Specialized AI: Expert agents with cloud resources
- Shared Services: Services accessible to multiple users
- Independent Updates: Services that evolve independently
See Plugin System for the decision matrix and intelligence plugin details.
Internal Plugins
When to Use
- Need direct database access
- Complex business logic
- Performance critical
- User/organization-specific
Creating a Plugin
- Create manifest.json:
{
"name": "@synap/plugin-myplugin",
"version": "1.0.0",
"synap": {
"version": ">=1.0.0",
"type": "plugin",
"capabilities": {
"routers": ["myplugin"],
"handlers": ["myplugin.event"],
"migrations": ["001_add_tables.sql"]
}
}
}
- Create router:
import { router, protectedProcedure } from '@synap/api';
import { z } from 'zod';
export const myPluginRouter = router({
create: protectedProcedure
.input(z.object({ name: z.string() }))
.mutation(async ({ ctx, input }) => {
// Your logic here
}),
});
- Create handler:
import { IEventHandler } from '@synap/jobs';
export class MyPluginHandler implements IEventHandler {
async handle(event: SynapEvent): Promise<void> {
// Handle event
}
}
External Services
When to Use
- Providing AI expertise
- Need cloud resources
- Shared across users
- Independent updates
Creating a Service
- Implement Hub Protocol:
import { HubOrchestratorBase } from '@synap/hub-orchestrator-base';
export class MyService extends HubOrchestratorBase {
async processRequest(request: ExpertiseRequest): Promise<ExpertiseResponse> {
// Your logic here
return {
insight: {
version: '1.0',
type: 'action_plan',
actions: [],
},
};
}
}
- Register on Marketplace:
POST /api/marketplace/register
{
"name": "my-service",
"endpoint": "https://my-service.example.com",
"capabilities": ["planning"]
}
Best Practices
- Follow the protocol - Adhere to Hub Protocol V1.0
- Document thoroughly - Clear README and examples
- Test extensively - Unit and integration tests
- Version carefully - Semantic versioning
Next: See Internal Plugins or External Services for detailed guides.