Skip to content

Commit 976162c

Browse files
committed
docs: add supported models section and HMAC security documentation
1 parent cc3bf1c commit 976162c

File tree

1 file changed

+55
-85
lines changed

1 file changed

+55
-85
lines changed

README.md

Lines changed: 55 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,23 @@
2020
- **📝 Intelligent Logging** with contextual insights
2121
- **🌐 HTTP Endpoints** to expose agents as REST APIs
2222

23-
**From startup MVPs to enterprise solutions** - RiLiGar Agents SDK scales with you.
23+
## 🌐 Supported Models
24+
25+
Via **OpenRouter** (configure `OPENROUTER_API_KEY`):
26+
27+
- OpenAI (GPT-4, GPT-3.5)
28+
- Anthropic (Claude)
29+
- Google (Gemini)
30+
- Meta (Llama)
31+
- Perplexity, Cohere, etc.
32+
33+
```javascript
34+
const llm = model.create({
35+
modelName: 'openai/gpt-4', // or 'anthropic/claude-3', 'google/gemini-pro'
36+
apiKey: process.env.OPENROUTER_API_KEY,
37+
temperature: 0.7,
38+
});
39+
```
2440

2541
## 🚀 Installation
2642

@@ -93,40 +109,34 @@ const data = await response.json();
93109
console.log(data.result.text); // "Hello, Sarah! 👋"
94110
```
95111

96-
## 🎯 Key Features
97-
98-
| Feature | Description | Example |
99-
| ----------------- | ------------------------------------------- | --------------------------------------------- |
100-
| **🤖 Agents** | Intelligent agents with custom instructions | `new Agent({ name, instructions, model })` |
101-
| **🔧 Tools** | Local tools and MCP integration | `tool.build([{ type: 'local', executeFn }])` |
102-
| **📝 Logging** | Contextual and configurable logging system | `new Logger({ level: 'info' })` |
103-
| **🛡️ Guardrails** | Input and output validation | `guardrails: { input: [...], output: [...] }` |
104-
| **🔐 Security** | HMAC authentication for secure APIs | `security.generateHMACAuth(id, key, ...)` |
105-
| **🔄 Handoffs** | Transfer between agents | `{ type: 'agent', agent: otherAgent }` |
106-
| **📡 Streaming** | Real-time responses | `result.textStream` |
107-
| **🌐 HTTP API** | Expose agents as REST endpoints | `new Endpoint(agent, { port: 3001 })` |
112+
## 🔐 HMAC Security
108113

109-
## 🌐 Supported Models
114+
Secure your agent endpoints with enterprise-grade HMAC authentication. Perfect for production APIs that need to verify client identity and request integrity.
110115

111-
Via **OpenRouter** (configure `OPENROUTER_API_KEY`):
116+
### 🔑 Security Features
112117

113-
- OpenAI (GPT-4, GPT-3.5)
114-
- Anthropic (Claude)
115-
- Google (Gemini)
116-
- Meta (Llama)
117-
- Perplexity, Cohere, etc.
118+
- **🛡️ HMAC-SHA256**: Industry-standard message authentication
119+
- **⏱️ Timestamp Protection**: Prevents replay attacks
120+
- **👥 Multi-Client Support**: Individual keys per client
121+
- **🔐 Timing-Safe Validation**: Resistant to timing attacks
122+
- **🚫 Request Integrity**: Detects message tampering
123+
- **⚙️ Configurable Tolerance**: Flexible timestamp validation
118124

119-
```javascript
120-
const llm = model.create({
121-
modelName: 'openai/gpt-4', // or 'anthropic/claude-3', 'google/gemini-pro'
122-
apiKey: process.env.OPENROUTER_API_KEY,
123-
temperature: 0.7,
124-
});
125-
```
125+
### 📋 Environment Variables
126126

127-
## 🔐 HMAC Security
127+
```bash
128+
# Server configuration
129+
OPENROUTER_API_KEY=your-openrouter-api-key
130+
HMAC_MASTER_SECRET=your-master-secret-key
131+
FRONTEND_SECRET=frontend-client-secret-key
132+
MOBILE_SECRET=mobile-client-secret-key
133+
ADMIN_SECRET=admin-client-secret-key
128134

129-
Secure your agent endpoints with enterprise-grade HMAC authentication. Perfect for production APIs that need to verify client identity and request integrity.
135+
# Client configuration
136+
AGENT_CLIENT_ID=frontend-app
137+
AGENT_SECRET_KEY=frontend-client-secret-key
138+
AGENT_BASE_URL=https://your-agent-api.com
139+
```
130140

131141
### 🛡️ Secure Server Implementation
132142

@@ -138,7 +148,7 @@ const agent = new Agent({
138148
name: 'SecureAgent',
139149
instructions: 'You are a secure AI assistant.',
140150
model: model.create({ apiKey: process.env.OPENROUTER_API_KEY }),
141-
logger: new Logger({ level: 'info' })
151+
logger: new Logger({ level: 'info' }),
142152
});
143153

144154
// Create endpoint with HMAC security
@@ -148,11 +158,11 @@ const endpoint = new Endpoint(agent, {
148158
hmacClients: {
149159
'frontend-app': process.env.FRONTEND_SECRET,
150160
'mobile-app': process.env.MOBILE_SECRET,
151-
'admin-panel': process.env.ADMIN_SECRET
161+
'admin-panel': process.env.ADMIN_SECRET,
152162
},
153163
// Option 2: Master secret (simpler)
154164
hmacSecret: process.env.HMAC_MASTER_SECRET,
155-
hmacTolerance: 300 // 5 minutes tolerance
165+
hmacTolerance: 300, // 5 minutes tolerance
156166
});
157167

158168
await endpoint.start();
@@ -173,23 +183,17 @@ class SecureAgentClient {
173183

174184
async processTask(task) {
175185
const body = { task };
176-
186+
177187
// Generate HMAC authentication
178-
const authHeader = security.generateHMACAuth(
179-
this.clientId,
180-
this.secretKey,
181-
'POST',
182-
'/process',
183-
body
184-
);
188+
const authHeader = security.generateHMACAuth(this.clientId, this.secretKey, 'POST', '/process', body);
185189

186190
const response = await fetch(`${this.baseUrl}/process`, {
187191
method: 'POST',
188192
headers: {
189193
'Content-Type': 'application/json',
190-
'Authorization': authHeader
194+
Authorization: authHeader,
191195
},
192-
body: JSON.stringify(body)
196+
body: JSON.stringify(body),
193197
});
194198

195199
if (!response.ok) {
@@ -200,66 +204,32 @@ class SecureAgentClient {
200204
}
201205

202206
async checkHealth() {
203-
const authHeader = security.generateHMACAuth(
204-
this.clientId,
205-
this.secretKey,
206-
'GET',
207-
'/health'
208-
);
207+
const authHeader = security.generateHMACAuth(this.clientId, this.secretKey, 'GET', '/health');
209208

210209
const response = await fetch(`${this.baseUrl}/health`, {
211-
headers: { 'Authorization': authHeader }
210+
headers: { Authorization: authHeader },
212211
});
213212

214213
return response.json();
215214
}
216215
}
217216

218217
// Usage
219-
const client = new SecureAgentClient(
220-
'frontend-app',
221-
process.env.FRONTEND_SECRET,
222-
'https://your-agent-api.com'
223-
);
218+
const client = new SecureAgentClient('frontend-app', process.env.FRONTEND_SECRET, 'https://your-agent-api.com');
224219

225220
const result = await client.processTask('Analyze customer data');
226221
console.log(result.result.text);
227222
```
228223

229-
### 🔑 Security Features
230-
231-
- **🛡️ HMAC-SHA256**: Industry-standard message authentication
232-
- **⏱️ Timestamp Protection**: Prevents replay attacks
233-
- **👥 Multi-Client Support**: Individual keys per client
234-
- **🔐 Timing-Safe Validation**: Resistant to timing attacks
235-
- **🚫 Request Integrity**: Detects message tampering
236-
- **⚙️ Configurable Tolerance**: Flexible timestamp validation
237-
238-
### 📋 Environment Variables
239-
240-
```bash
241-
# Server configuration
242-
OPENROUTER_API_KEY=your-openrouter-api-key
243-
HMAC_MASTER_SECRET=your-master-secret-key
244-
FRONTEND_SECRET=frontend-client-secret-key
245-
MOBILE_SECRET=mobile-client-secret-key
246-
ADMIN_SECRET=admin-client-secret-key
247-
248-
# Client configuration
249-
AGENT_CLIENT_ID=frontend-app
250-
AGENT_SECRET_KEY=frontend-client-secret-key
251-
AGENT_BASE_URL=https://your-agent-api.com
252-
```
253-
254224
## 📚 Practical Examples
255225

256-
| Example | File | Description |
257-
| -------------- | ----------------------- | ----------------------- |
258-
| **Basic** | `examples/hello.js` | Simple agent with tools |
226+
| Example | File | Description |
227+
| -------------- | ----------------------- | ------------------------ |
228+
| **Basic** | `examples/hello.js` | Simple agent with tools |
259229
| **Security** | `examples/security.js` | HMAC authentication demo |
260-
| **Guardrails** | `examples/guardrail.js` | Input/output validation |
261-
| **Handoffs** | `examples/handoffs.js` | Transfer between agents |
262-
| **MCP** | `examples/mcp/` | MCP server integration |
230+
| **Guardrails** | `examples/guardrail.js` | Input/output validation |
231+
| **Handoffs** | `examples/handoffs.js` | Transfer between agents |
232+
| **MCP** | `examples/mcp/` | MCP server integration |
263233

264234
Run any example:
265235

0 commit comments

Comments
 (0)