Bring Your Own Agent
Available now — open source. Bring Your Own Agent (BYOA) lets you deploy custom AI agents built on any framework while leveraging Sharely.ai's knowledge management, conversation infrastructure, distribution, and role-based access control.
The heart of BYOA is the Sharely Server SDK — an open-source TypeScript SDK (Apache 2.0) for building Sharely-compatible agent servers:
- GitHub: github.com/sharelyai/sharely-server-sdk (opens in a new tab)
- npm: published under the
@sharelyai(opens in a new tab) scope
What is Bring Your Own Agent?
Sharely.ai splits the platform into parts you run and parts Sharely manages:
- Sharely manages knowledge (ingestion, taxonomies, RAG), governance (RBAC), and the control plane that routes requests, validates identity, and persists conversations.
- You own the agent itself — its model, framework, tools, prompts, and infrastructure.
The Server SDK is the contract between the two. You host an agent server; the Sharely platform routes each user chat turn to your server and streams your agent's response back into the surface where the user is working (for example, Web Control embedded in your portal).
With BYOA you can:
- Build agents using any framework, SDK, or platform — Anthropic SDK, OpenAI Agents SDK, Vercel AI SDK, LangGraph, Temporal Workflows, or plain code
- Use domain-specific tools and agent loops tailored to your use case
- Query Sharely.ai's knowledge base with RAG and semantic search, already filtered to the calling user's role
- Get built-in RBAC for enterprise-grade content access control
- Distribute through Web Control and Hosted Agents with streaming UI for thinking steps, tool calls, and citations
- Host your agent on your preferred cloud platform
Different roles often need different agent behavior, not just different documents — a finance agent and a volunteer agent may draw on the same knowledge but differ in tools and guardrails. Running that as code you own and host is what BYOA is for.
How It Works
┌────────────┐ chat turn ┌──────────────────┐ POST /chat ┌──────────────────┐
│ Web Control │ ─────────────────▶ │ Sharely platform │ ────────────────▶ │ Your agent server │
│ (renders) │ ◀───────────────── │ (control plane) │ ◀──────────────── │ (Server SDK) │
└────────────┘ streamed events └──────────────────┘ SSE events └──────────────────┘
│ ▲
▼ │ RAG / threads / tools
Sharely Knowledge (RBAC-filtered)- You write a Handler — an async generator that yields typed events (
thinking_delta,tool_call_start,content_delta,sources, …) createSharelyServer()wraps it in an Express server that owns HTTP, CORS, auth, token validation, message persistence, and SSE encoding- You register your server with your workspace via the Agent API
- The platform dispatches chat turns to your server and streams your agent's output straight back to the user
- Your agent queries knowledge through a request-scoped platform client — results arrive already filtered to the calling user's role
Key principle: Your agent logic stays completely under your control. Your handler never deals with auth, the wire format, or storage.
The SDK Packages
All packages are published on npm under the @sharelyai scope (Apache 2.0):
| Package | Purpose |
|---|---|
@sharelyai/server | Express runtime — HTTP, CORS, auth, token validation, persistence, SSE encoding |
@sharelyai/protocol | Wire types — Handler, AgentInput, AgentContext, the AgentEvent union. Types only, no runtime |
@sharelyai/api | Typed client to the Sharely platform (threads, messages, RAG) |
@sharelyai/tools | First-party Sharely tool definitions + a pluggable executor registry |
@sharelyai/adapter-vercel-ai | Translate a Vercel AI SDK streamText stream into AgentEvents |
@sharelyai/adapter-temporal | Translate a Temporal workflow's signals into AgentEvents |
@sharelyai/conformance | Validate any AgentEvent stream against the wire-protocol contract |
Use Cases
Legal Research Agent — A law firm builds an agent with specialized legal research tools and case law analysis. Sharely.ai manages document storage with RBAC so attorneys only access cases relevant to their practice areas.
Medical Knowledge Assistant — A healthcare provider creates an agent with clinical protocol validation. Sharely.ai manages the medical literature knowledge base with strict RBAC for sensitive clinical information.
Code Review Agent — A software company develops an agent with static analysis and security scanning tools, using Sharely.ai's knowledge base for coding standards, with role-based access per engineering team.
Customer Support Agent — A SaaS company creates an agent with CRM integration and product-specific troubleshooting workflows. Sharely.ai manages product documentation with customer-tier based access control.
Comparison: Agent Deployment Options
| Feature | Out-of-Box Agent | Bring Your Own Agent |
|---|---|---|
| Setup Time | Minutes | Hours to days |
| Framework | Sharely.ai's agent | Any framework or custom |
| Tools | Built-in knowledge tools | Any custom tools you need |
| Agent Loop | General-purpose conversational | Custom domain-specific logic |
| Knowledge Management | ✅ Full Sharely.ai infrastructure | ✅ Full Sharely.ai infrastructure |
| RBAC | ✅ Supported | ✅ Supported |
| Web Control | ✅ Supported | ✅ Supported |
| Deployment | Fully managed by Sharely.ai | You deploy and manage |
| Customization | Knowledge and journeys | Complete control over agent |
| Best For | General knowledge access, quick launches | Domain-specific agents, specialized workflows |
You can also migrate later: your knowledge base and user spaces remain the same, so you can start with the out-of-box agent and move to a custom agent as your needs evolve.
Documentation
- Quickstart — A complete, working agent server in ~20 lines
- Handler & Wire Protocol — The
Handlercontract and all 12AgentEventtypes - Tools & Platform Client — First-party tools, executors, and the typed platform API client
- Adapters & Examples — Vercel AI SDK, Temporal, LangGraph, OpenAI Agents SDK, and raw streaming examples
- Agent API Reference — The underlying REST endpoints (threads, messages, RAG, server registration, tools)
FAQ
Q: Can I use my own LLM or foundation model?
A: Yes. Your agent has complete control over which models to use — Anthropic, OpenAI, open-source models, or your own fine-tuned models.
Q: Do I need to host the agent server myself?
A: Yes. You deploy your agent server on your preferred cloud platform, giving you full control over models, dependencies, and data flow.
Q: Does this work with Web Control?
A: Yes. Web Control renders your agent's streamed events — thinking steps, tool calls, citations — with no client UI to build. Enable the agent view via displayMode.VIEWS.AGENT (see Web Control).
Q: Is there a cost difference?
A: BYOA incurs your own hosting and LLM costs for running your custom agent. Sharely.ai's knowledge management and distribution pricing remains the same.
Q: Is the SDK open source?
A: Yes — Apache 2.0, at github.com/sharelyai/sharely-server-sdk (opens in a new tab). See Open Source at Sharely.ai for everything we've opened.