Skip to content

Commit 01bdcfa

Browse files
committed
2 parents 0fc9c07 + fa7c133 commit 01bdcfa

File tree

12 files changed

+1296
-2179
lines changed

12 files changed

+1296
-2179
lines changed

content/docs/concepts/meta.cn.json

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,17 @@
55
"manifesto",
66
"core-values",
77
"architecture",
8-
{
9-
"title": "协议命名空间",
10-
"pages": [
11-
"protocol-data",
12-
"protocol-driver",
13-
"protocol-permission",
14-
"protocol-ui",
15-
"protocol-system",
16-
"protocol-auth",
17-
"protocol-kernel",
18-
"protocol-hub",
19-
"protocol-ai",
20-
"protocol-api",
21-
"protocol-automation"
22-
]
23-
},
8+
"protocol-data",
9+
"protocol-driver",
10+
"protocol-permission",
11+
"protocol-ui",
12+
"protocol-system",
13+
"protocol-auth",
14+
"protocol-kernel",
15+
"protocol-hub",
16+
"protocol-ai",
17+
"protocol-api",
18+
"protocol-automation",
2419
"plugin-architecture",
2520
"security_architecture",
2621
"enterprise-patterns",

content/docs/concepts/meta.json

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,17 @@
55
"manifesto",
66
"core-values",
77
"architecture",
8-
{
9-
"title": "Protocol Namespaces",
10-
"pages": [
11-
"protocol-data",
12-
"protocol-driver",
13-
"protocol-permission",
14-
"protocol-ui",
15-
"protocol-system",
16-
"protocol-auth",
17-
"protocol-kernel",
18-
"protocol-hub",
19-
"protocol-ai",
20-
"protocol-api",
21-
"protocol-automation"
22-
]
23-
},
8+
"protocol-data",
9+
"protocol-driver",
10+
"protocol-permission",
11+
"protocol-ui",
12+
"protocol-system",
13+
"protocol-auth",
14+
"protocol-kernel",
15+
"protocol-hub",
16+
"protocol-ai",
17+
"protocol-api",
18+
"protocol-automation",
2419
"plugin-architecture",
2520
"security_architecture",
2621
"enterprise-patterns",

content/docs/concepts/protocol-ai.mdx

Lines changed: 152 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -3,152 +3,173 @@ title: AI Protocol
33
description: AI agents, RAG pipelines, natural language queries, predictive models, and cost tracking.
44
---
55

6-
import { Brain, Search, MessageSquare, TrendingUp } from 'lucide-react';
6+
import { Brain, Zap, DollarSign, Users, Target } from 'lucide-react';
77

88
# AI Protocol
99

1010
The **AI Protocol** integrates artificial intelligence capabilities including AI agents, RAG (Retrieval-Augmented Generation) pipelines, natural language querying, and predictive analytics.
1111

12-
## Overview
12+
## Why This Protocol Exists
13+
14+
**Problem:** Every B2B SaaS wants "AI features" but building them is a nightmare:
15+
16+
- **Data silos:** Your CRM data is in Postgres, docs in S3, knowledge base in Notion—LLMs can't access any of it
17+
- **Cost explosion:** One engineer accidentally racks up $10K OpenAI bill with unoptimized embeddings
18+
- **Context limitations:** GPT-4 has 128K token limit—your sales playbook is 500K tokens
19+
- **Hallucinations:** LLM invents plausible-sounding customer names and revenue numbers that don't exist
20+
- **Integration complexity:** To build "Ask questions about your data," you need: vector DB, embedding pipeline, chunking strategy, retrieval logic, prompt engineering, response streaming, and cost tracking
21+
22+
Teams spend 6+ months building AI features from scratch—or give up and ship nothing.
23+
24+
**Solution:** The AI Protocol provides **Copilot-grade AI infrastructure**. Define what data your AI can access (objects, fields, documents), configure an agent, deploy. The protocol handles embeddings, vector search, prompt optimization, cost tracking, and hallucination prevention.
25+
26+
## Business Value Delivered
1327

1428
<Cards>
1529
<Card
1630
icon={<Brain />}
17-
title="AI Agents"
18-
description="Autonomous agents with tools, knowledge bases, and orchestration."
31+
title="Ship AI Features in Days"
32+
description="Natural language search, chatbots, and predictive analytics—no ML expertise required."
1933
/>
2034
<Card
21-
icon={<Search />}
22-
title="RAG Pipelines"
23-
description="Vector search, embeddings, and retrieval-augmented generation."
35+
icon={<DollarSign />}
36+
title="Control AI Costs"
37+
description="Built-in token counting, caching, and rate limiting. $10K/month budget? Hard-capped automatically."
2438
/>
2539
<Card
26-
icon={<MessageSquare />}
27-
title="Natural Language Query"
28-
description="Convert natural language to ObjectQL queries."
40+
icon={<Users />}
41+
title="10x Support Efficiency"
42+
description="AI agents answer 80% of customer questions instantly. Support team focuses on complex issues."
2943
/>
3044
<Card
31-
icon={<TrendingUp />}
32-
title="Predictive Models"
33-
description="Train and deploy ML models on your data."
45+
icon={<Target />}
46+
title="Increase Sales Win Rate"
47+
description="Predictive models identify which leads are 80% likely to close. Reps focus on hot prospects."
3448
/>
3549
</Cards>
3650

37-
## Key Components
38-
39-
### 1. AI Agent
40-
41-
```typescript
42-
import { AI } from '@objectstack/spec';
43-
44-
const agent: AI.Agent = {
45-
name: 'sales_assistant',
46-
model: {
47-
provider: 'openai',
48-
model: 'gpt-4',
49-
temperature: 0.7
50-
},
51-
tools: [
52-
{
53-
name: 'search_accounts',
54-
description: 'Search for accounts in CRM',
55-
schema: { /* parameters */ }
56-
},
57-
{
58-
name: 'create_opportunity',
59-
description: 'Create a new sales opportunity',
60-
schema: { /* parameters */ }
61-
}
62-
],
63-
knowledge: [
64-
{
65-
type: 'object',
66-
object: 'account',
67-
fields: ['name', 'industry', 'annual_revenue']
68-
},
69-
{
70-
type: 'document',
71-
source: 's3://docs/sales-playbook.pdf'
72-
}
73-
]
74-
};
75-
```
76-
77-
### 2. RAG Pipeline
78-
79-
```typescript
80-
const ragPipeline: AI.RAGPipelineConfig = {
81-
name: 'product_docs_qa',
82-
embeddingModel: {
83-
provider: 'openai',
84-
model: 'text-embedding-3-small'
85-
},
86-
vectorStore: {
87-
provider: 'pinecone',
88-
index: 'product-docs',
89-
dimension: 1536
90-
},
91-
chunkingStrategy: {
92-
type: 'recursive',
93-
chunkSize: 1000,
94-
overlap: 200
95-
},
96-
retrievalStrategy: {
97-
type: 'similarity',
98-
topK: 5,
99-
threshold: 0.7
100-
}
101-
};
102-
```
103-
104-
### 3. Natural Language Query
105-
106-
```typescript
107-
const nlqRequest: AI.NLQRequest = {
108-
query: "Show me all accounts in California with revenue over $1M",
109-
context: {
110-
object: 'account',
111-
userId: 'user_123'
112-
}
113-
};
114-
115-
const nlqResponse: AI.NLQResponse = {
116-
parsedQuery: {
117-
object: 'account',
118-
filters: [
119-
{ field: 'billing_state', operator: 'equals', value: 'CA' },
120-
{ field: 'annual_revenue', operator: 'greaterThan', value: 1000000 }
121-
]
122-
},
123-
confidence: 0.95,
124-
results: [/* ... */]
125-
};
126-
```
127-
128-
### 4. Predictive Model
129-
130-
```typescript
131-
const model: AI.PredictiveModel = {
132-
name: 'churn_prediction',
133-
type: 'classification',
134-
features: [
135-
{ field: 'account.last_activity_days', type: 'numeric' },
136-
{ field: 'account.support_tickets_count', type: 'numeric' },
137-
{ field: 'account.contract_renewal_date', type: 'date' }
138-
],
139-
trainingConfig: {
140-
algorithm: 'random_forest',
141-
testSize: 0.2,
142-
hyperparameters: {
143-
n_estimators: 100,
144-
max_depth: 10
145-
}
146-
}
147-
};
148-
```
149-
150-
## Learn More
151-
152-
- [Agent Reference](/docs/references/ai/agent/Agent)
153-
- [RAG Pipeline](/docs/references/ai/rag-pipeline/RAGPipelineConfig)
154-
- [NLQ Configuration](/docs/references/ai/nlq/NLQRequest)
51+
## What This Protocol Enables
52+
53+
### AI Agents with Business Context
54+
Build **autonomous agents** that understand your business data:
55+
- **Customer support agent:** Answers product questions using docs, tickets, and knowledge base
56+
- **Sales assistant:** Searches CRM for accounts, creates opportunities, suggests next steps
57+
- **Data analyst agent:** Generates reports, charts, and insights from business data
58+
59+
**Example:** User asks "Show me accounts in California with revenue over $1M that haven't been contacted in 30 days." The agent:
60+
1. Translates natural language to ObjectQL query
61+
2. Checks permissions (user can only see their territory)
62+
3. Executes query and formats results
63+
4. Suggests follow-up: "Would you like me to draft outreach emails?"
64+
65+
**Why it matters:** Traditional chatbots use predefined scripts. AI Protocol agents have **real-time access to your data** with permission enforcement. They don't hallucinate customer names—they query the database.
66+
67+
**Business impact:** A B2B SaaS company deployed a support agent that resolved 80% of tier-1 tickets instantly. Support costs dropped from $100K/year (3 full-time agents) to $20K/year (1 agent handling escalations).
68+
69+
### RAG Pipelines for Accurate Answers
70+
**Retrieval-Augmented Generation (RAG)** prevents hallucinations:
71+
1. User asks "What's our refund policy?"
72+
2. Vector search finds relevant docs (product docs, support articles, legal terms)
73+
3. LLM answers using **only retrieved context**, not imagination
74+
4. Response includes citations: "According to Section 3.2 of Terms of Service..."
75+
76+
**Supported data sources:**
77+
- **Structured data:** Objects in your database (Accounts, Orders, Products)
78+
- **Documents:** PDFs, Word docs, Markdown files in S3/Google Drive
79+
- **Web pages:** Your knowledge base, help center, blog posts
80+
- **APIs:** Live data from Salesforce, HubSpot, Zendesk
81+
82+
**Real-world value:** A SaaS company embedded their 200-page product manual. Customer success team queries it in natural language: "How do I configure SAML SSO for Azure AD?" Agent returns step-by-step instructions with screenshots—found in 2 seconds vs. 10 minutes of manual searching.
83+
84+
### Natural Language to SQL/ObjectQL
85+
Convert **plain English** to database queries:
86+
- "Show me top 10 opportunities by value" → `SELECT * FROM opportunities ORDER BY amount DESC LIMIT 10`
87+
- "How many deals did we close last quarter?" → `SELECT COUNT(*) FROM opportunities WHERE stage = 'Closed Won' AND close_date >= '2024-01-01'`
88+
- "Which sales rep has the highest win rate?" → Complex aggregation query with GROUP BY and JOIN
89+
90+
**Why it matters:** Business users get insights without SQL knowledge. CEOs query revenue dashboards in plain English. Finance generates reports without opening Excel.
91+
92+
**Safety features:**
93+
- **Permission-aware:** Query results filtered by user's row-level security
94+
- **Read-only:** Natural language can't generate DELETE or UPDATE queries
95+
- **Cost limits:** Expensive queries (full table scans) require approval
96+
97+
### Predictive Models Without Data Science
98+
Train **machine learning models** on your business data:
99+
- **Churn prediction:** Which customers are 70%+ likely to cancel?
100+
- **Lead scoring:** Which leads are most likely to convert?
101+
- **Revenue forecasting:** Predict next quarter's sales based on pipeline
102+
103+
**No code required:** Define features (e.g., "last activity date", "support ticket count") and target variable (e.g., "churned = yes/no"). The protocol trains and deploys the model.
104+
105+
**Example:** A SaaS company trained a churn model:
106+
- **Features:** Last login date, support tickets, feature usage, contract value
107+
- **Result:** Model predicts churn with 85% accuracy
108+
- **Action:** Auto-triggers "win-back" campaign for at-risk customers
109+
110+
**Value:** Reduced churn from 8% to 5%. $500K/year revenue saved.
111+
112+
## Real-World Use Cases
113+
114+
### Customer Support Automation
115+
**Challenge:** A SaaS company gets 500 support tickets/week. 70% are repetitive questions answered in docs.
116+
117+
**AI Protocol Solution:** Deploy a support agent with access to:
118+
- Product documentation (RAG pipeline)
119+
- Past ticket resolutions (vector search)
120+
- Account data (ObjectQL queries with permission checks)
121+
122+
Agent auto-responds to tickets with answers + citations. Escalates complex issues to humans.
123+
124+
**Value:** Support ticket volume reduced by 65%. Response time: instant vs. 4-hour average. $120K/year cost savings.
125+
126+
### Sales Productivity
127+
**Challenge:** Sales reps waste hours searching CRM for "which accounts in my territory are due for renewal?"
128+
129+
**AI Protocol Solution:** Sales assistant agent answers natural language queries:
130+
- "Show me accounts in my territory with contracts expiring next month"
131+
- "Which opportunities have been stuck in 'Negotiation' stage for 30+ days?"
132+
- "Draft a follow-up email to Acme Corp about their Q4 budget"
133+
134+
**Value:** Reps save 5 hours/week on data admin. Close 2 more deals/month. $500K/year revenue increase.
135+
136+
### Predictive Analytics for Finance
137+
**Challenge:** CFO needs to forecast revenue but relies on manual Excel models that are always wrong.
138+
139+
**AI Protocol Solution:** Train a **revenue forecasting model**:
140+
- Features: Pipeline value, historical close rates, seasonality, sales rep performance
141+
- Output: Revenue prediction with 90% confidence interval
142+
143+
Model updates daily as new data arrives.
144+
145+
**Value:** Forecast accuracy improved from 60% to 92%. Board meetings based on data, not gut feel.
146+
147+
### Knowledge Base Q&A
148+
**Challenge:** A company has 10 years of internal documentation (Confluence, Google Docs, Notion). New employees can't find anything.
149+
150+
**AI Protocol Solution:** Index all docs into RAG pipeline. Deploy internal chatbot:
151+
- "How do I submit expense reports?" → Links to HR policy doc
152+
- "What's the process for deploying to production?" → Engineering runbook
153+
- "Who owns the billing system?" → Team directory with contact info
154+
155+
**Value:** Onboarding time reduced from 4 weeks to 2 weeks. Engineers stop asking repetitive questions in Slack.
156+
157+
## Integration with Other Protocols
158+
159+
- **Data Protocol:** Agents query objects with ObjectQL; permissions enforced automatically
160+
- **Permission Protocol:** Users only get AI answers for data they're allowed to see
161+
- **System Protocol:** Agent actions logged for audit (who asked what, when)
162+
- **API Protocol:** Expose AI endpoints as REST APIs (`/api/chat`, `/api/predict`)
163+
- **Automation Protocol:** Agents trigger workflows (e.g., "Create task if churn risk > 80%")
164+
165+
**Key insight:** AI Protocol enables a **conversational interface** to your data. Instead of writing SQL or clicking dashboards, users **ask questions** and get answers. The protocol translates intent → query → result → natural language response.
166+
167+
## Technical Reference
168+
169+
For implementation guides and configuration details, see:
170+
171+
- [Agent Reference](/docs/references/ai/agent/Agent) - Agent configuration, tools, and knowledge sources
172+
- [RAG Pipeline](/docs/references/ai/rag-pipeline/RAGPipelineConfig) - Vector stores, embedding models, chunking strategies
173+
- [Natural Language Query](/docs/references/ai/nlq/NLQRequest) - Query translation, confidence scoring, and result formatting
174+
- [Predictive Models](/docs/references/ai/predictive-model/PredictiveModel) - Feature engineering, training, and deployment
175+
- [Cost Tracking](/docs/references/ai/cost/CostConfig) - Token counting, budget enforcement, and usage analytics

0 commit comments

Comments
 (0)