epsimo-agent 0.1.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,435 @@
1
+ # Epsimo Agent Framework
2
+
3
+ > **Beta Release** — Build sophisticated AI-powered applications with agents, persistent threads, and Virtual Database state management.
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Version](https://img.shields.io/badge/version-0.2.0-blue.svg)](https://github.com/thierryteisseire/epsimo-agent)
7
+ [![Skills](https://img.shields.io/badge/skills.sh-epsimo--agent-purple.svg)](https://skills.sh)
8
+ [![npm](https://img.shields.io/badge/npm-epsimo--agent-red.svg)](https://www.npmjs.com/package/epsimo-agent)
9
+
10
+ The Epsimo Agent Framework provides a unified **CLI**, **Python SDK**, and **React UI Kit** for building AI applications with:
11
+ - 🤖 Multi-agent orchestration
12
+ - 💾 Virtual Database (thread-based persistent state)
13
+ - 💬 Streaming conversations with tool support
14
+ - 🎨 Pre-built React components
15
+ - 🔌 Extensible tool library
16
+
17
+ **Base URL:** `https://api.epsimoagents.com`
18
+ **Frontend:** `https://app.epsimoagents.com`
19
+
20
+ ---
21
+
22
+ ## 📦 Installation
23
+
24
+ ### For AI Coding Agents (Recommended)
25
+
26
+ Install as a skill for Claude Code, Cursor, Cline, Windsurf, and 30+ other AI coding agents:
27
+
28
+ ```bash
29
+ npx skills add thierryteisseire/epsimo-agent
30
+ ```
31
+
32
+ This installs the skill across all your AI agents in one command! The skill helps agents:
33
+ - Set up Epsimo projects quickly
34
+ - Manage agents and threads
35
+ - Query the Virtual Database
36
+ - Deploy configurations
37
+ - Handle authentication flows
38
+
39
+ ### npm Package (Global Installation)
40
+
41
+ ```bash
42
+ npm install -g epsimo-agent
43
+ ```
44
+
45
+ ### Python SDK & CLI
46
+
47
+ ```bash
48
+ # Install from PyPI (coming soon)
49
+ pip install epsimo-agent
50
+
51
+ # Or install from source
52
+ git clone https://github.com/thierryteisseire/epsimo-agent.git
53
+ cd epsimo-agent
54
+ pip install -r requirements.txt
55
+
56
+ # Make CLI executable
57
+ chmod +x epsimo/cli.py
58
+ export PATH="$PATH:$(pwd)/epsimo"
59
+ ```
60
+
61
+ ---
62
+
63
+ ## 🚀 Quick Start
64
+
65
+ ### 1. Authentication
66
+
67
+ ```bash
68
+ # Login to Epsimo
69
+ epsimo auth login
70
+
71
+ # Check who you're logged in as
72
+ epsimo whoami
73
+
74
+ # Check thread/credit balance
75
+ epsimo credits balance
76
+ ```
77
+
78
+ ### 2. Create Your First Project
79
+
80
+ ```bash
81
+ # Create a new Next.js project with Epsimo
82
+ epsimo create "My AI App"
83
+
84
+ # Or initialize in existing directory
85
+ cd my-existing-project
86
+ epsimo init
87
+ ```
88
+
89
+ ### 3. Deploy Configuration
90
+
91
+ ```bash
92
+ # Sync your epsimo.yaml to the platform
93
+ epsimo deploy
94
+ ```
95
+
96
+ ---
97
+
98
+ ## 🛠️ CLI Reference
99
+
100
+ ### Authentication Commands
101
+ ```bash
102
+ epsimo auth login # Interactive login
103
+ epsimo whoami # Display current user info
104
+ ```
105
+
106
+ ### Project Management
107
+ ```bash
108
+ epsimo projects # List all projects
109
+ epsimo create <name> # Scaffold a new Next.js app
110
+ epsimo init # Initialize existing directory
111
+ epsimo deploy # Deploy epsimo.yaml configuration
112
+ ```
113
+
114
+ ### Virtual Database
115
+ ```bash
116
+ epsimo db query --project-id <P_ID> --thread-id <T_ID>
117
+ epsimo db set --project-id <P_ID> --thread-id <T_ID> --key <K> --value <V>
118
+ epsimo db get --project-id <P_ID> --thread-id <T_ID> --key <K>
119
+ ```
120
+
121
+ ### Credits & Billing
122
+ ```bash
123
+ epsimo credits balance # Check thread balance
124
+ epsimo credits buy --quantity <N> # Generate Stripe checkout URL
125
+ ```
126
+
127
+ ### Resource Listing
128
+ ```bash
129
+ epsimo assistants --project-id <P_ID> # List assistants
130
+ epsimo threads --project-id <P_ID> # List threads
131
+ ```
132
+
133
+ ---
134
+
135
+ ## 📚 Python SDK
136
+
137
+ ### Installation
138
+
139
+ ```python
140
+ from epsimo import EpsimoClient
141
+
142
+ # Initialize with API key (JWT token)
143
+ client = EpsimoClient(api_key="your-token-here")
144
+
145
+ # Or use environment variable
146
+ # export EPSIMO_API_KEY=your-token-here
147
+ client = EpsimoClient()
148
+ ```
149
+
150
+ ### Virtual Database Access
151
+
152
+ ```python
153
+ # Get all structured data from a thread
154
+ db_state = client.db.get_all(project_id, thread_id)
155
+
156
+ # Get specific key
157
+ user_prefs = client.db.get(project_id, thread_id, "user_preferences")
158
+ print(f"Theme: {user_prefs.get('theme')}")
159
+
160
+ # Set value (for seeding/testing)
161
+ client.db.set(project_id, thread_id, "status", "active")
162
+ ```
163
+
164
+ ### Streaming Conversations
165
+
166
+ ```python
167
+ # Stream assistant responses
168
+ for chunk in client.threads.run_stream(
169
+ project_id,
170
+ thread_id,
171
+ assistant_id,
172
+ "Hello, how can you help me?"
173
+ ):
174
+ print(chunk, end="", flush=True)
175
+ ```
176
+
177
+ ### Managing Resources
178
+
179
+ ```python
180
+ # Projects
181
+ projects = client.projects.list()
182
+ project = client.projects.create(name="My Project", description="...")
183
+ project_details = client.projects.get(project_id)
184
+
185
+ # Assistants
186
+ assistants = client.assistants.list(project_id)
187
+ assistant = client.assistants.create(project_id, config={...})
188
+
189
+ # Threads
190
+ threads = client.threads.list(project_id)
191
+ thread = client.threads.create(project_id, assistant_id=assistant_id)
192
+
193
+ # Files
194
+ files = client.files.list(project_id)
195
+ file = client.files.upload(project_id, file_path="document.pdf")
196
+
197
+ # Credits
198
+ balance = client.credits.get_balance()
199
+ checkout_url = client.credits.create_checkout_session(quantity=1000, amount=100.0)
200
+ ```
201
+
202
+ ---
203
+
204
+ ## 🎨 React UI Kit
205
+
206
+ ### ThreadChat Component
207
+
208
+ ```tsx
209
+ import { ThreadChat } from "@/components/epsimo";
210
+
211
+ export default function App() {
212
+ return (
213
+ <ThreadChat
214
+ assistantId="your-assistant-id"
215
+ projectId="your-project-id"
216
+ placeholder="Ask me anything..."
217
+ />
218
+ );
219
+ }
220
+ ```
221
+
222
+ ### useChat Hook (Headless)
223
+
224
+ ```tsx
225
+ import { useChat } from "@/hooks/epsimo";
226
+
227
+ export default function CustomChat() {
228
+ const { messages, sendMessage, isLoading } = useChat({
229
+ projectId: "...",
230
+ threadId: "...",
231
+ assistantId: "..."
232
+ });
233
+
234
+ return (
235
+ <div>
236
+ {messages.map(msg => (
237
+ <div key={msg.id}>{msg.content}</div>
238
+ ))}
239
+ <button onClick={() => sendMessage("Hello")} disabled={isLoading}>
240
+ Send
241
+ </button>
242
+ </div>
243
+ );
244
+ }
245
+ ```
246
+
247
+ ---
248
+
249
+ ## 🧪 Tool Library
250
+
251
+ The framework includes reusable tool schemas in `epsimo/tools/library.yaml`:
252
+
253
+ ### Available Tools
254
+
255
+ | Tool | Type | Description |
256
+ |------|------|-------------|
257
+ | **database_sync** | function | Persist structured JSON to thread state (Virtual DB) |
258
+ | **web_search_tavily** | search_tavily | Advanced web search with source attribution |
259
+ | **web_search_ddg** | ddg_search | Fast DuckDuckGo search for simple queries |
260
+ | **retrieval_optimized** | retrieval | High-accuracy document search in uploaded files |
261
+ | **task_management** | function | Track and update user tasks |
262
+
263
+ ### Using Tools in Assistants
264
+
265
+ ```yaml
266
+ # epsimo.yaml
267
+ assistants:
268
+ - name: "Research Assistant"
269
+ model: "gpt-4o"
270
+ instructions: "You help with research tasks"
271
+ tools:
272
+ - type: search_tavily
273
+ max_results: 5
274
+ - type: function
275
+ name: update_database
276
+ description: "Save research findings"
277
+ parameters:
278
+ type: object
279
+ properties:
280
+ key: { type: string }
281
+ value: { type: object }
282
+ ```
283
+
284
+ ---
285
+
286
+ ## 💾 Virtual Database Pattern
287
+
288
+ Threads serve as persistent, structured storage — eliminating the need for a separate database.
289
+
290
+ ### How It Works
291
+
292
+ 1. **Agent writes to DB** using the `update_database` tool
293
+ 2. **Data persists** in thread state
294
+ 3. **Query from SDK or CLI**:
295
+
296
+ ```python
297
+ # Python SDK
298
+ preferences = client.db.get(project_id, thread_id, "user_preferences")
299
+
300
+ # CLI
301
+ epsimo db query --project-id P123 --thread-id T456
302
+ ```
303
+
304
+ ### Benefits
305
+
306
+ - ✅ Zero database configuration
307
+ - ✅ Data naturally partitioned by conversation
308
+ - ✅ Agent always "knows" what's in its DB
309
+ - ✅ Queryable from both agent and application code
310
+
311
+ See [docs/virtual_db_guide.md](docs/virtual_db_guide.md) for detailed guide.
312
+
313
+ ---
314
+
315
+ ## 🔐 Authentication & Security
316
+
317
+ ### Environment Variables
318
+
319
+ ```bash
320
+ # .env file (never commit!)
321
+ EPSIMO_API_KEY=your-jwt-token-here
322
+ EPSIMO_EMAIL=your@email.com
323
+ EPSIMO_PASSWORD=your-password # Only for automated scripts
324
+ ```
325
+
326
+ ### Token Management
327
+
328
+ ```python
329
+ from epsimo.auth import get_token, perform_login
330
+
331
+ # Login programmatically
332
+ token = perform_login("your@email.com", "password")
333
+
334
+ # Get cached token (auto-refreshes if expired)
335
+ token = get_token()
336
+ ```
337
+
338
+ **Token Storage:** Tokens are stored in `~/code/epsimo-frontend/.epsimo_token` (configurable via `TOKEN_FILE` in auth.py)
339
+
340
+ **Security Best Practices:**
341
+ - Never commit `.epsimo_token` or `.env` files
342
+ - Use environment variables in production
343
+ - Rotate tokens regularly
344
+ - Use project-specific tokens for multi-tenant apps
345
+
346
+ ---
347
+
348
+ ## 📖 API Reference
349
+
350
+ See [references/api_reference.md](references/api_reference.md) for comprehensive endpoint documentation including:
351
+ - Authentication flows
352
+ - Request/response schemas
353
+ - HTTP status codes
354
+ - Error handling patterns
355
+ - Rate limits
356
+
357
+ ---
358
+
359
+ ## 🧪 Verification & Testing
360
+
361
+ ```bash
362
+ # Verify skill is correctly configured
363
+ python3 verify_skill.py
364
+
365
+ # Run E2E test suite
366
+ python3 scripts/test_all_skills.py
367
+
368
+ # Test streaming functionality
369
+ python3 scripts/test_streaming.py
370
+
371
+ # Test Virtual DB
372
+ python3 scripts/test_vdb.py
373
+ ```
374
+
375
+ ---
376
+
377
+ ## 📁 Project Structure
378
+
379
+ ```
380
+ epsimo-agent/
381
+ ├── epsimo/
382
+ │ ├── cli.py # Unified CLI
383
+ │ ├── client.py # Main SDK client
384
+ │ ├── auth.py # Authentication logic
385
+ │ ├── resources/ # Resource-specific clients
386
+ │ │ ├── projects.py
387
+ │ │ ├── assistants.py
388
+ │ │ ├── threads.py
389
+ │ │ ├── files.py
390
+ │ │ ├── credits.py
391
+ │ │ └── db.py
392
+ │ ├── tools/
393
+ │ │ └── library.yaml # Reusable tool schemas
394
+ │ └── templates/ # Project scaffolding templates
395
+ ├── scripts/ # Helper scripts and examples
396
+ ├── docs/ # Additional documentation
397
+ ├── references/ # API reference docs
398
+ ├── SKILL.md # Main skill documentation
399
+ └── README.md # This file
400
+ ```
401
+
402
+ ---
403
+
404
+ ## 🤝 Contributing
405
+
406
+ Contributions are welcome! Please open an issue or pull request on [GitHub](https://github.com/thierryteisseire/epsimo-agent).
407
+
408
+ ---
409
+
410
+ ## 📄 License
411
+
412
+ MIT License - see [LICENSE](LICENSE) for details.
413
+
414
+ ---
415
+
416
+ ## 🔗 Links
417
+
418
+ ### Installation & Discovery
419
+ - **skills.sh:** Search for "epsimo-agent" at https://skills.sh
420
+ - **npm Package:** https://www.npmjs.com/package/epsimo-agent
421
+ - **Install Command:** `npx skills add thierryteisseire/epsimo-agent`
422
+
423
+ ### Documentation
424
+ - **Skill Guide:** [SKILL.md](SKILL.md)
425
+ - **API Reference:** [references/api_reference.md](references/api_reference.md)
426
+ - **Virtual DB Guide:** [docs/virtual_db_guide.md](docs/virtual_db_guide.md)
427
+
428
+ ### Platform
429
+ - **GitHub Repository:** https://github.com/thierryteisseire/epsimo-agent
430
+ - **Epsimo Web App:** https://app.epsimoagents.com
431
+ - **API Endpoint:** https://api.epsimoagents.com
432
+
433
+ ---
434
+
435
+ **Questions?** Open an issue on [GitHub](https://github.com/thierryteisseire/epsimo-agent/issues) or check the [API Reference](references/api_reference.md).