SynapseX Manager — Introdução

Integration OS for AI Agents — Conecte seus usuários’ apps aos seus AI agents em minutos. SynapseX Manager é uma plataforma open-source que gerencia OAuth authentication, gerencia connected accounts por usuário, descobre ferramentas, e executa ferramentas em APIs externas através de uma API unificada.
Inspirado por Composio. Self-hosted, open-source, seu.

O que faz

Your AI Agent  →  SynapseX API  →  Gmail / Slack / GitHub / Notion / ...

                      ├─ OAuth2 flow managed
                      ├─ Tokens encrypted at rest (Fernet)
                      ├─ Per-user connected accounts
                      ├─ Session scoping
                      └─ Tool execution + audit logs

Features Principais

🔌 8 Integrações Built-in

ProviderServiços
Gmailsend_email, read_emails, drafts, labels
Slacksend_message, channels, files, reactions
Google Calendarevents, schedules, reminders
Notionpages, databases, blocks
GitHubissues, PRs, repos, gists
HubSpotcontacts, deals, companies
Twitter/Xtweets, timeline, mentions
YouTubevideos, comments, channels

🔐 OAuth2 Engine

  • Connect link generation
  • Token exchange automático
  • Auto-refresh de tokens
  • Tokens encryptados at rest com Fernet

👥 Multi-User Support

  • Uma API key para milhares de end-users
  • Session scoping (restringir acesso por sessão)
  • Entity ID para isolamento por usuário

🛠️ Tool Catalog

  • Toda ação tem JSON Schema input definition
  • Typo-safe, auto-complete
  • Versionamento de tools

🔔 Webhook Fanout

  • HMAC-signed delivery
  • Eventos por account/tool

SDKs Oficiais

SDKFramework
Python SDKLangChain, Anthropic, OpenAI
TypeScript SDKVercel AI SDK

Quick Start

1. Clone e configure

git clone https://github.com/softquantus/synapsex-manager
cd synapsex-manager
cp .env.example .env
# Preencha as credenciais OAuth dos apps que deseja usar

2. Inicie os serviços

make dev-db        # start PostgreSQL
make install-backend
make migrate       # run Alembic migrations
make seed          # popula app + action catalog
make dev-backend   # API at http://localhost:8000
make dev-frontend  # Dashboard at http://localhost:5173
Ou com Docker:
docker compose up --build

3. Crie seu primeiro usuário e API key

# Register via API
curl -X POST http://localhost:8000/v1/auth/register \
  -H "Content-Type: application/json" \
  -d '{"email":"you@example.com","password":"secret"}'

# Ou use a CLI atual
synapsex login --email you@example.com
synapsex keys --create "my-agent"
# → sk_...

4. Conecte um app

curl http://localhost:8000/v1/oauth/connect/gmail?entity_id=user_42 \
  -H "Authorization: Bearer sk_..."
# Redirect the user to the returned URL

5. Execute uma ferramenta

curl -X POST http://localhost:8000/v1/tools/execute \
  -H "Authorization: Bearer sk_..." \
  -H "Content-Type: application/json" \
  -d '{"action_name":"gmail_send_email","input_data":{"to":"friend@example.com","subject":"Hello","body":"From my agent!"},"entity_id":"user_42"}'

Python SDK

Instalação

pip install synapsex
# ou: cd apps/agents-synapsex/shared/sdk/python && pip install -e .

Uso básico

import asyncio
from synapsex import SynapseXClient

sx = SynapseXClient(api_key="sk_...", base_url="https://api.synapsex.ai", entity_id="user_42")

async def main():
    # List all available tools
    tools = await sx.list_all_tools(["gmail", "slack"])

    # Convert for your AI framework
    anthropic_tools = sx.to_anthropic_tools(tools)
    openai_tools    = sx.to_openai_tools(tools)
    langchain_tools = sx.to_langchain_tools(tools, entity_id="user_42")

    # Execute a tool
    result = await sx.execute(
        "gmail_send_email",
        input_data={"to": "x@y.com", "subject": "Hi", "body": "Hello from my agent"},
        entity_id="user_42",
    )
    print(result)

asyncio.run(main())

Padrão SaaS Multi-user

# When user_42 connects their Gmail in your app:
link = await sx.get_connect_link("gmail", entity_id="user_42")
# → redirect user_42 to link

# Later, your agent acts on behalf of user_42:
result = await sx.execute("gmail_send_email", {...}, entity_id="user_42")

TypeScript SDK

Instalação

npm install @synapsex/sdk
# ou: cd apps/agents-synapsex/shared/sdk && npm install

Uso

import { SynapseXClient } from "@synapsex/sdk";

const sx = new SynapseXClient({
  baseUrl: "https://api.synapsex.ai",
  accessToken: process.env.SYNAPSEX_ACCESS_TOKEN!,
  tenantId: process.env.SYNAPSEX_TENANT_ID!,
});

const agents = await sx.agents.list({ limit: 20 });
const user = await sx.auth.me();

API Reference

Interactive docs disponíveis em http://localhost:8000/docs (Swagger UI) e http://localhost:8000/redoc.

Principais Endpoints

MethodPathDescrição
POST/v1/auth/registerCriar conta
POST/v1/auth/loginLogin, get JWT
POST/v1/auth/keysCriar API key
GET/v1/appsListar todos os providers
GET/v1/apps/{id}/actionsListar tools de um provider
GET/v1/oauth/connect/{provider}?entity_id=Get OAuth connect link
GET/v1/accounts?entity_id=Listar connected accounts
POST/v1/sessionsCriar agent session
POST/v1/tools/executeExecutar uma tool
GET/v1/tools/executionsTool execution history
POST/v1/webhooksCriar webhook subscription

Adicionar uma Nova Integração

Nenhum arquivo core precisa ser modificado. O provider registry é auto-discovered ao startup scandando o diretório providers/ por packages que contenham um provider.py com subclasse BaseProvider.

1. Crie os arquivos

# manifest.py — static metadata seeded into the database
MANIFEST = {
    "id": "linear",
    "name": "Linear",
    "auth_type": "oauth2",
    "oauth_authorize_url": "https://linear.app/oauth/authorize",
    "oauth_token_url": "https://api.linear.app/oauth/token",
    "oauth_scopes": ["read", "write"],
    "oauth_credential_fields": [
        {"name": "client_id",     "label": "Client ID",     "secret": False, "required": True},
        {"name": "client_secret", "label": "Client Secret", "secret": True,  "required": True},
        {"name": "redirect_uri",  "label": "Redirect URI (optional)", "secret": False, "required": False},
    ],
    "actions": [
        {
            "name": "linear_create_issue",
            "display_name": "Create Issue",
            "description": "Create a new issue in a Linear team",
            "tags": ["linear", "write"],
            "input_schema": { "type": "object", "required": ["title"],
                              "properties": {"title": {"type": "string"}} },
        }
    ],
}

# provider.py — execution logic
from src.providers.base import BaseProvider

class LinearProvider(BaseProvider):
    provider_id = "linear"

    async def execute_tool(self, action_name: str, input_data: dict, credentials: dict) -> dict:
        if action_name == "linear_create_issue":
            # call Linear API with credentials["access_token"]
            ...
        raise ValueError(f"Unknown action: {action_name}")

    async def refresh_token(self, credentials: dict) -> dict:
        return credentials  # Linear tokens don't expire; override if needed

# __init__.py — empty, required to make this a Python package

2. Execute seed

make seed
# O novo provider é seeded no DB e auto-registrado no próximo startup

3. Configure credenciais

curl -X PUT http://localhost:8000/v1/admin/providers/linear/credentials \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"client_id": "...", "client_secret": "..."}'

Próximos Passos

GuiaDescrição
QuickstartSetup detalhado
IntegraçõesMais integrações disponíveis
API ReferenceReferência completa de API
GitHubRepositório oficial