epsimo-agent 0.1.0 → 0.2.0

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