fiberwise 0.1.0__tar.gz

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.
Files changed (39) hide show
  1. fiberwise-0.1.0/PKG-INFO +692 -0
  2. fiberwise-0.1.0/README.md +656 -0
  3. fiberwise-0.1.0/fiberwise/__init__.py +1 -0
  4. fiberwise-0.1.0/fiberwise/__main__.py +7 -0
  5. fiberwise-0.1.0/fiberwise/cli/__init__.py +1 -0
  6. fiberwise-0.1.0/fiberwise/cli/__main__.py +9 -0
  7. fiberwise-0.1.0/fiberwise/cli/account.py +1481 -0
  8. fiberwise-0.1.0/fiberwise/cli/app.py +684 -0
  9. fiberwise-0.1.0/fiberwise/cli/app_context.py +143 -0
  10. fiberwise-0.1.0/fiberwise/cli/app_utils.py +371 -0
  11. fiberwise-0.1.0/fiberwise/cli/bundle.py +101 -0
  12. fiberwise-0.1.0/fiberwise/cli/commands.py +583 -0
  13. fiberwise-0.1.0/fiberwise/cli/config.py +260 -0
  14. fiberwise-0.1.0/fiberwise/cli/copy_web_module.py +112 -0
  15. fiberwise-0.1.0/fiberwise/cli/core_commands.py +359 -0
  16. fiberwise-0.1.0/fiberwise/cli/deploy.py +41 -0
  17. fiberwise-0.1.0/fiberwise/cli/functions.py +1391 -0
  18. fiberwise-0.1.0/fiberwise/cli/initialize.py +782 -0
  19. fiberwise-0.1.0/fiberwise/cli/marketplace.py +64 -0
  20. fiberwise-0.1.0/fiberwise/cli/oauth_commands.py +715 -0
  21. fiberwise-0.1.0/fiberwise/cli/seed_user.py +213 -0
  22. fiberwise-0.1.0/fiberwise/cli/start_enhanced.py +1018 -0
  23. fiberwise-0.1.0/fiberwise/common/__init__.py +48 -0
  24. fiberwise-0.1.0/fiberwise/common/constants/__init__.py +26 -0
  25. fiberwise-0.1.0/fiberwise/common/helpers.py +3 -0
  26. fiberwise-0.1.0/fiberwise/common/local_user_context.py +112 -0
  27. fiberwise-0.1.0/fiberwise/common/models/__init__.py +5 -0
  28. fiberwise-0.1.0/fiberwise/common/services/__init__.py +0 -0
  29. fiberwise-0.1.0/fiberwise/main.py +7 -0
  30. fiberwise-0.1.0/fiberwise.egg-info/PKG-INFO +692 -0
  31. fiberwise-0.1.0/fiberwise.egg-info/SOURCES.txt +37 -0
  32. fiberwise-0.1.0/fiberwise.egg-info/dependency_links.txt +1 -0
  33. fiberwise-0.1.0/fiberwise.egg-info/entry_points.txt +2 -0
  34. fiberwise-0.1.0/fiberwise.egg-info/requires.txt +15 -0
  35. fiberwise-0.1.0/fiberwise.egg-info/top_level.txt +2 -0
  36. fiberwise-0.1.0/pyproject.toml +53 -0
  37. fiberwise-0.1.0/setup.cfg +4 -0
  38. fiberwise-0.1.0/setup.py +16 -0
  39. fiberwise-0.1.0/tests/__init__.py +11 -0
@@ -0,0 +1,692 @@
1
+ Metadata-Version: 2.4
2
+ Name: fiberwise
3
+ Version: 0.1.0
4
+ Summary: FiberWise CLI and platform tools
5
+ Author-email: FiberWise <dev@fiberwise.ai>
6
+ License: MIT
7
+ Project-URL: Homepage, https://fiberwise.ai
8
+ Project-URL: Documentation, https://docs.fiberwise.ai/
9
+ Project-URL: Repository, https://github.com/fiberwise-ai/fiberwise
10
+ Project-URL: Issues, https://github.com/fiberwise-ai/fiberwise/issues
11
+ Keywords: fiberwise,cli,ai,platform,developer-tools
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Environment :: Console
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ Requires-Dist: click>=8.0.0
23
+ Requires-Dist: fastapi>=0.68.0
24
+ Requires-Dist: uvicorn>=0.15.0
25
+ Requires-Dist: python-multipart>=0.0.6
26
+ Requires-Dist: python-jose>=3.3.0
27
+ Requires-Dist: passlib>=1.7.4
28
+ Requires-Dist: pydantic>=1.10.0
29
+ Requires-Dist: watchdog>=3.0.0
30
+ Provides-Extra: test
31
+ Requires-Dist: pytest>=7.0.0; extra == "test"
32
+ Requires-Dist: pytest-asyncio>=0.21.0; extra == "test"
33
+ Requires-Dist: playwright>=1.40.0; extra == "test"
34
+ Requires-Dist: pytest-playwright>=0.4.0; extra == "test"
35
+ Requires-Dist: httpx>=0.24.0; extra == "test"
36
+
37
+ # FiberWise
38
+
39
+ A comprehensive command line tool and activation system for FiberWise agents with dependency injection support.
40
+
41
+ ## Overview
42
+
43
+ FiberWise provides:
44
+ - **Agent Activation System**: Register, version, and execute agents
45
+ - **Dependency Injection**: Automatic service injection into agents
46
+ - **SDK Integration**: Seamless integration with `fiberwise_sdk`
47
+ - **Multi-Database Support**: SQLite, DuckDB, MySQL, PostgreSQL
48
+ - **CLI Interface**: Easy command-line activation and management
49
+ - **Web Interface**: Built-in web server for agent management
50
+
51
+ ## Installation
52
+
53
+ ```bash
54
+ pip install -e .
55
+ ```
56
+
57
+ For the full SDK experience, also install:
58
+ ```bash
59
+ pip install fiberwise-sdk
60
+ ```
61
+
62
+ ## Default Credentials
63
+
64
+ **First time setup:**
65
+ - Username: `admin`
66
+ - Email: `admin@fiberwise.local`
67
+ - Password: `fiber2025!`
68
+
69
+ See [DEFAULT_CREDENTIALS.md](../DEFAULT_CREDENTIALS.md) for complete details.
70
+
71
+ ## Quick Start
72
+
73
+
74
+ ### 1. Initialize the FiberWise Environment
75
+
76
+ ```bash
77
+ # Initialize FiberWise project (creates config, database, and default admin user)
78
+ fiber initialize
79
+ ```
80
+
81
+ **Options:**
82
+
83
+ - `--db-path <path>`: Set custom database file path (default: ./fiberwise.db)
84
+ - `--force`: Overwrite existing config/database if present
85
+ - `--no-admin`: Skip creation of default admin user
86
+ - `--no-web`: Do not launch the web UI after initialization
87
+ - `--no-browser`: Do not open browser after starting web UI
88
+ - `--host <host>`: Set web server host (default: 127.0.0.1)
89
+ - `--port <port>`: Set web server port (default: 8000)
90
+
91
+ Example:
92
+ ```bash
93
+ fiber initialize --db-path ./mydb.db --no-browser --host 0.0.0.0 --port 3000
94
+ ```
95
+
96
+ For details on how instance routing works with initialization and activation, see the [CLI Instance Routing Guide](../CLI_INSTANCE_ROUTING_GUIDE.md).
97
+
98
+ ---
99
+
100
+ ### 2. Start the Web Server
101
+
102
+ ```bash
103
+ # Start FiberWise web interface (if not started by initialize)
104
+ fiber start
105
+ ```
106
+
107
+ ### 2. Configure Account and Providers
108
+
109
+ ```bash
110
+ # Add your FiberWise API configuration
111
+ python -m fiberwise.cli account add-config --name "prod" --api-key "your-api-key" --base-url "https://api.fiberwise.ai" --set-default
112
+
113
+ # Import providers from your app for dependency injection
114
+ python -m fiberwise.cli account import-providers --default
115
+
116
+ # List available providers
117
+ python -m fiberwise.cli account list-providers
118
+ ```
119
+
120
+ ### 3. Create an Agent with Dependency Injection
121
+
122
+ ```python
123
+ def run_agent(input_data, fiber=None, llm_service=None, storage=None, oauth_service=None):
124
+ """Agent with automatic dependency injection"""
125
+ result = {"input": input_data, "services": {}}
126
+
127
+ # FiberApp SDK automatically injected
128
+ if fiber:
129
+ try:
130
+ agents = await fiber.agents.list()
131
+ result["services"]["fiber"] = f"Connected to FiberApp - {len(agents)} agents available"
132
+ except Exception as e:
133
+ result["services"]["fiber"] = f"FiberApp error: {e}"
134
+
135
+ # LLM service automatically injected
136
+ if llm_service:
137
+ try:
138
+ response = await llm_service.generate("Test prompt")
139
+ result["services"]["llm"] = "LLM service connected"
140
+ except Exception as e:
141
+ result["services"]["llm"] = f"LLM error: {e}"
142
+
143
+ # Storage service automatically injected
144
+ if storage:
145
+ result["services"]["storage"] = "Storage service connected"
146
+
147
+ # OAuth service automatically injected
148
+ if oauth_service:
149
+ try:
150
+ providers = await oauth_service.get_available_providers()
151
+ result["services"]["oauth"] = f"OAuth providers: {providers}"
152
+ except Exception as e:
153
+ result["services"]["oauth"] = f"OAuth error: {e}"
154
+
155
+ return result
156
+ ```
157
+
158
+ ### 4. Run the Agent
159
+
160
+ ```bash
161
+ # Run locally with dependency injection (default)
162
+ fiber activate --input-data '{"query": "test"}' ./my_agent.py
163
+
164
+ # Run against local server API
165
+ fiber activate --input-data '{"query": "test"}' ./my_agent.py --to-instance default
166
+
167
+ # Run against remote server
168
+ fiber activate --input-data '{"query": "test"}' ./my_agent.py --to-instance "production"
169
+
170
+ # Run with verbose output to see injected services and routing
171
+ fiber activate --verbose --input-data '{"query": "test"}' ./my_agent.py --to-instance local
172
+ ```
173
+
174
+ ## CLI Usage
175
+
176
+ ### Basic Commands
177
+
178
+ ```bash
179
+ # Activate an agent (local direct execution - default)
180
+ fiber activate --input-data '{"key": "value"}' ./agent.py
181
+
182
+ # Activate against local server API
183
+ fiber activate --input-data '{"key": "value"}' ./agent.py --to-instance default
184
+
185
+ # Activate against remote server
186
+ fiber activate --input-data '{"key": "value"}' ./agent.py --to-instance "production"
187
+
188
+ # Verbose output for debugging
189
+ fiber activate --verbose --input-data '{"key": "value"}' ./agent.py
190
+
191
+ # Specify version with instance routing
192
+ fiber activate --version "2.0.0" --input-data '{"key": "value"}' ./agent.py --to-instance "production"
193
+ ```
194
+
195
+ ### Web Server Commands
196
+
197
+ ```bash
198
+ # Start the FiberWise web server (default: localhost:8000)
199
+ fiber start
200
+
201
+ # Start with custom host and port
202
+ fiber start --host 0.0.0.0 --port 3000
203
+
204
+ # Start with development features
205
+ fiber start --reload --no-browser
206
+
207
+ ```
208
+
209
+ #### Start Command Options
210
+
211
+ - `--host`: Host address to bind to (default: 127.0.0.1)
212
+ - `--port`: Port number to use (default: 8000)
213
+ - `--reload`: Enable auto-reload for development
214
+ - `--no-browser`: Disable automatic browser opening
215
+
216
+ ### Account Management Commands
217
+
218
+ The account management system integrates with `fiberwise-common` to store configurations and providers in the database for dependency injection.
219
+
220
+ ```bash
221
+ # Login with configuration file
222
+ fiber account login --config ./my-config.json
223
+
224
+ # Add configuration directly
225
+ fiber account add-config --name "prod" --api-key "your-key" --base-url "https://api.fiberwise.ai" --set-default
226
+
227
+ # Import providers from app (for dependency injection)
228
+ fiber account import-providers --app-id your-app-id --default
229
+
230
+ # List providers (local database)
231
+ fiber account list-providers --to-instance local
232
+
233
+ # List providers (remote server)
234
+ fiber account list-providers --to-instance "production"
235
+
236
+ # View specific provider details
237
+ fiber account list-providers --provider-id provider-uuid --format detailed --to-instance local
238
+ ```
239
+
240
+ #### Account Configuration Options
241
+
242
+ - `--name`: Unique configuration profile name
243
+ - `--api-key`: FiberWise API key for accessing platform services
244
+ - `--base-url`: API base URL (default: https://api.fiberwise.ai)
245
+ - `--set-default`: Mark this configuration as the default
246
+ - `--config`: Path to JSON configuration file for login command
247
+
248
+ #### Provider Import Options
249
+
250
+ - `--app-id`: Import providers from specific app ID
251
+ - `--app-dir`: Application directory (default: current directory)
252
+ - `--default`: Set first imported provider as default for dependency injection
253
+ - `--format`: Output format (basic, detailed, json)
254
+ - `--save-to-file`: Save provider information to file
255
+
256
+ **Configuration File Format**:
257
+ ```json
258
+ {
259
+ "config_name": "my-config",
260
+ "fiberwise_api_key": "your-api-key",
261
+ "fiberwise_base_url": "https://api.fiberwise.ai"
262
+ }
263
+ ```
264
+
265
+ ### Instance Routing (New Feature)
266
+
267
+ The CLI now supports routing commands to different execution environments:
268
+
269
+ ```bash
270
+ # Local direct database access (fastest - default)
271
+ fiber activate ./agent.py --to-instance local
272
+ fiber functions list --to-instance local
273
+ fiber account list-providers --to-instance local
274
+
275
+ # Local server API (for testing server functionality)
276
+ fiber activate ./agent.py --to-instance default
277
+ fiber account list-providers --to-instance default
278
+
279
+ # Remote server API (for production deployment)
280
+ fiber activate ./agent.py --to-instance "production"
281
+ fiber account list-providers --to-instance "production"
282
+ ```
283
+
284
+ **Configuration Setup:**
285
+ ```bash
286
+ # Add remote server configuration
287
+ fiber account add-config \
288
+ --name "production" \
289
+ --api-key "prod-api-key" \
290
+ --base-url "https://prod.fiberwise.ai"
291
+
292
+ # List all configurations
293
+ fiber account list-configs
294
+
295
+ # Use remote configuration
296
+ fiber activate ./agent.py --to-instance "production" --verbose
297
+ ```
298
+
299
+ For detailed instance routing documentation, see: [`CLI_INSTANCE_ROUTING_GUIDE.md`](../CLI_INSTANCE_ROUTING_GUIDE.md)
300
+
301
+ ### Input Data
302
+
303
+ ```bash
304
+ # JSON object
305
+ fiber activate --input-data '{"query": "test", "limit": 10}' ./agent.py
306
+
307
+ # Simple string (auto-wrapped)
308
+ fiber activate --input-data "simple input" ./agent.py
309
+
310
+ # With instance routing
311
+ fiber activate --input-data '{"query": "test"}' ./agent.py --to-instance "production"
312
+ ```
313
+
314
+ ## Features
315
+
316
+ - **✨ Dependency Injection**: Automatic service injection into agents (FiberApp SDK, LLM, OAuth, Storage)
317
+ - **🌐 Instance Routing**: Route commands to local, default server, or remote instances with `--to-instance`
318
+ - **⚙️ Account Management**: Centralized configuration management with database integration via `fiberwise-common`
319
+ - **🔧 Provider Configuration**: Import and manage LLM, OAuth, and storage providers for automatic injection
320
+ - **🚀 Agent Activation System**: Register, version, and execute agents with full lifecycle management
321
+ - **📊 Activation Tracking**: Complete execution history stored in `agent_activations` table
322
+ - **🔧 Service Registry**: Centralized service management with automatic discovery and injection
323
+ - **📊 Multi-Database Support**: SQLite, DuckDB, MySQL, PostgreSQL with automatic migrations
324
+ - **🌐 CLI Interface**: Comprehensive command-line tools for agent development and deployment
325
+ - **💻 Web Interface**: Built-in web server with real-time agent monitoring and management
326
+ - **🔐 OAuth Integration**: Built-in OAuth provider support (Google, GitHub, etc.) with token management
327
+ - **💾 Storage Providers**: Local, S3, Azure Blob, Google Cloud Storage with unified interface
328
+ - **📝 LLM Integration**: Multi-provider LLM support (OpenAI, Anthropic, etc.) with automatic configuration
329
+ - **🔄 Real-time Updates**: WebSocket-based real-time activation status and logging
330
+ - **📈 Comprehensive Logging**: Detailed execution logs with structured output and debugging support
331
+
332
+ ### Service Injection Details
333
+
334
+ **Understanding Activations**: In FiberWise, "activations" and "agent activations" refer to the same concept - they are execution instances of agents stored in the `agent_activations` database table. Each activation represents a single run of an agent with specific input data and injected services.
335
+
336
+ The dependency injection system automatically provides services based on agent method signatures:
337
+
338
+ - **`fiber` / `fiber_app`**: Core platform service with data, agents, functions, storage
339
+ - **`llm_service` / `llm_provider_service` / `llm`**: Language model service for AI operations
340
+ - **`oauth_service` / `oauth` / `credentials`**: Authentication and credential management
341
+ - **`storage` / `agent_storage` / `storage_provider`**: Direct file and blob storage access
342
+
343
+ **Service Configuration**: Services are configured through the account management system and stored in `fiberwise-common` database:
344
+ - LLM providers stored in `provider_defaults` table with type 'llm'
345
+ - OAuth providers in `oauth_providers` table linked via `app_oauth_provider_links`
346
+ - Storage providers configured per app with appropriate credentials
347
+ - API keys managed through `account_configs` for FiberApp integration
348
+
349
+ ### Agent Types
350
+
351
+ The CLI automatically detects:
352
+ - **Agents**: Classes inheriting from `FiberAgent` or `Agent`
353
+ - **Functions**: Standalone function-based agents
354
+ - **Pipelines**: Multi-step processing chains
355
+ - **Workflows**: Complex orchestration patterns
356
+
357
+ ### Database Support
358
+
359
+ Built-in support for multiple database providers:
360
+ - **SQLite**: Default, no additional dependencies
361
+ - **DuckDB**: `pip install duckdb`
362
+ - **MySQL**: `pip install mysql-connector-python`
363
+ - **PostgreSQL**: `pip install psycopg2-binary`
364
+
365
+ ## Documentation
366
+
367
+ ### Core Documentation
368
+ - **[Getting Started with Dependency Injection](../GETTING_STARTED_DEPENDENCY_INJECTION.md)** - Complete guide to the dependency injection system
369
+ - **[Account Management Guide](../docs-bin/account_README.md)** - Account configuration and provider management
370
+ - **[Start Command Guide](docs/START_COMMAND_GUIDE.md)** - Web server configuration and deployment
371
+ - **[CLI Commands Reference](../docs-bin/commands/readme.md)** - Complete CLI command documentation
372
+
373
+ ### Provider & Service Configuration
374
+ - **[Account Commands](../docs-bin/commands/account/account.md)** - Account management CLI reference
375
+ - **[OAuth Provider Setup](../docs-bin/commands/account/oauth.md)** - OAuth provider configuration
376
+ - **[App OAuth Management](../docs-bin/commands/app/oauth.md)** - Application-level OAuth setup
377
+ - **[Activation System Analysis](../ACTIVATION_SYSTEM_ANALYSIS.md)** - Deep dive into the activation system
378
+
379
+ ### SDK Integration
380
+ - **[FiberWise SDK Documentation](../fiber-sdk-python/fiberwise-sdk/DOCUMENTATION.md)** - Full SDK reference
381
+ - **[Agent Development Guide](examples/)** - Example agents and patterns
382
+
383
+ ### Database & Migration
384
+ - **[Migration Plan](../docs-bin/FIBER_TO_FIBERWISE_MIGRATION_PLAN.md)** - FiberWise-Common integration plan
385
+ - **[Service Extraction Plan](../docs-bin/SERVICE_EXTRACTION_PLAN.md)** - Service architecture documentation
386
+
387
+ ### Legacy Documentation
388
+ - **[Agent Dependency Injection Guide](./AGENT_DEPENDENCY_INJECTION.md)**: Legacy agent injection patterns
389
+ - **[Database Configuration](#database-support)**: Multi-database setup and configuration
390
+ - **[Start Command Testing](./tests/README_START_COMMAND_TESTS.md)**: Web server test documentation
391
+
392
+ ## Testing
393
+
394
+ ### Quick Start
395
+ ```bash
396
+ # Run all working tests (22+ tests)
397
+ python -m pytest tests/test_start_command.py tests/test_web_app.py tests/test_activation_service.py -v
398
+
399
+ # Run complete test suite
400
+ python -m pytest tests/ -v
401
+
402
+ # Run with coverage report
403
+ python -m pytest tests/ --cov=fiberwise --cov-report=html
404
+ ```
405
+
406
+ ### Test Documentation
407
+ - **[Complete Test Guide](./tests/README.md)**: Comprehensive testing documentation
408
+ - **[Test Status](./tests/TEST_STATUS.md)**: Current test status and quick commands
409
+ - **[Start Command Tests](./tests/README_START_COMMAND_TESTS.md)**: Detailed start command test documentation
410
+
411
+ ### Running Tests
412
+
413
+ ```bash
414
+ # Run all tests
415
+ python -m pytest tests/ -v
416
+
417
+ # Run specific test modules
418
+ python -m pytest tests/test_start_command.py -v
419
+ python -m pytest tests/test_activation_service.py -v
420
+
421
+ # Run with coverage
422
+ python -m pytest tests/ --cov=fiberwise --cov-report=html
423
+ ```
424
+
425
+ ### Test Coverage
426
+
427
+ - **Start Command**: 7 comprehensive tests covering CLI functionality, port handling, and server startup
428
+ - **Activation Service**: Full lifecycle testing with dependency injection
429
+ - **Web Application**: FastAPI endpoint testing with CORS validation
430
+ - **CLI Integration**: End-to-end command line interface testing
431
+
432
+ ### Test Structure
433
+
434
+ - `tests/test_start_command.py`: Web server startup and CLI option validation
435
+ - `tests/test_activation_service.py`: Agent registration and execution testing
436
+ - `tests/test_web_app.py`: FastAPI web application endpoint testing
437
+ - `tests/test_cli_integration.py`: CLI command integration testing
438
+
439
+ ## Architecture
440
+
441
+ ### Core Components
442
+
443
+ 1. **ActivationService**: Manages agent lifecycle (registration, versioning, execution)
444
+ 2. **AccountService**: Handles configuration management, API keys, and provider imports (via `fiberwise-common`)
445
+ 3. **DatabaseService**: Handles data persistence across multiple database types
446
+ 4. **CLI Commands**: User interface for agent activation and management
447
+ 5. **Dependency Injection**: Automatic service resolution and injection based on stored provider configurations
448
+
449
+ ### Integration with FiberWise-Common
450
+
451
+ The system integrates with `fiberwise-common` for:
452
+ - **Database Operations**: Shared database provider and query adapters
453
+ - **Service Registry**: Centralized service management with dependency injection
454
+ - **Account Management**: Configuration storage in database tables
455
+ - **Provider Management**: LLM, OAuth, and storage provider configurations
456
+
457
+ ### Agent Lifecycle
458
+
459
+ 1. **Detection**: CLI analyzes file content to determine activation type
460
+ 2. **Registration**: Agent metadata is stored with version tracking in `agents` table
461
+ 3. **Account Integration**: System retrieves API keys and provider configs from `account_configs`
462
+ 4. **Dependency Resolution**: Services are initialized based on stored provider configurations
463
+ 5. **Activation Creation**: New record created in `agent_activations` table with status tracking
464
+ 6. **Execution**: Agent runs with injected dependencies from configured providers
465
+ 7. **Results**: Output is captured and stored in activation record
466
+
467
+ ## Provider Configuration & Dependency Injection Setup
468
+
469
+ ### Setting Up Default Providers
470
+
471
+ The account management system stores provider configurations in the database for automatic dependency injection:
472
+
473
+ ```bash
474
+ # 1. Configure your FiberWise account
475
+ fiber account add-config --name "prod" --api-key "your-api-key" --base-url "https://api.fiberwise.ai" --set-default
476
+
477
+ # 2. Import providers from your app (for LLM, OAuth, Storage services)
478
+ fiber account import-providers --app-id your-app-id --default
479
+
480
+ # 3. Verify provider configuration
481
+ fiber account list-providers --format detailed
482
+ ```
483
+
484
+ ### Supported Provider Types
485
+
486
+ #### LLM Providers
487
+ - **OpenAI**: GPT-3.5, GPT-4, ChatGPT models
488
+ - **Anthropic**: Claude models
489
+ - **Google**: Gemini models
490
+ - **Azure OpenAI**: Enterprise OpenAI models
491
+
492
+ #### OAuth Providers
493
+ - **Google**: Gmail, Drive, Calendar access
494
+ - **Microsoft**: Office 365, Teams, OneDrive
495
+ - **GitHub**: Repository and user data access
496
+ - **Custom**: Any OAuth 2.0 compatible provider
497
+
498
+ #### Storage Providers
499
+ - **Local**: File system storage
500
+ - **AWS S3**: Amazon Simple Storage Service
501
+ - **Azure Blob**: Microsoft Azure Blob Storage
502
+ - **Google Cloud Storage**: Google Cloud Platform storage
503
+ - **Cloudflare R2**: Cloudflare object storage
504
+
505
+ ### Provider Configuration Files
506
+
507
+ When importing providers, the system creates configuration files in `~/.fiberwise/providers/`:
508
+
509
+ ```json
510
+ {
511
+ "provider_id": "google-llm-provider",
512
+ "provider_type": "llm",
513
+ "name": "Google Gemini",
514
+ "config": {
515
+ "api_key": "encrypted_key_reference",
516
+ "model": "gemini-pro",
517
+ "base_url": "https://generativelanguage.googleapis.com"
518
+ },
519
+ "is_default": true,
520
+ "created_at": "2025-08-02T10:00:00Z"
521
+ }
522
+ ```
523
+
524
+ ### Default Provider Management
525
+
526
+ ```bash
527
+ # Set default LLM provider
528
+ fiber account provider default "Google Gemini"
529
+
530
+ # List providers by type
531
+ fiber account provider list --type llm
532
+ fiber account provider list --type oauth
533
+ fiber account provider list --type storage
534
+
535
+ # View all provider types
536
+ fiber account provider list --format detailed
537
+ ```
538
+
539
+ ## Examples
540
+
541
+ ### Basic Agent
542
+ See `test_fiber_app_agent.py` for a complete working example.
543
+
544
+ ### Agent with Multiple Services
545
+ ```python
546
+ from fiberwise_sdk import FiberAgent
547
+
548
+ class AdvancedAgent(FiberAgent):
549
+ def get_dependencies(self):
550
+ return {
551
+ 'fiber_app': 'FiberApp',
552
+ 'llm_service': 'LLMService',
553
+ 'storage': 'StorageService'
554
+ }
555
+
556
+ def run_agent(self, input_data, fiber_app=None, llm_service=None, storage=None):
557
+ # Use multiple injected services
558
+ if fiber_app and llm_service:
559
+ data = fiber_app.data.query("SELECT * FROM context")
560
+ response = llm_service.generate(f"Analyze: {data}")
561
+
562
+ if storage:
563
+ storage.save("analysis.json", response)
564
+
565
+ return {"status": "success", "analysis": response}
566
+
567
+ return {"status": "limited", "message": "Required services not available"}
568
+ ```
569
+
570
+ ### Configuration-Based Agent
571
+ ```python
572
+ def run_agent(input_data, fiber=None, llm_service=None, oauth_service=None, storage=None):
573
+ """Agent that uses providers configured via account management"""
574
+
575
+ result = {"input": input_data, "services_available": []}
576
+
577
+ # FiberApp service (configured via account add-config)
578
+ if fiber:
579
+ result["services_available"].append("FiberApp")
580
+ result["app_data"] = fiber.data.query("SELECT COUNT(*) as count FROM agents")
581
+
582
+ # LLM service (configured via import-providers --default)
583
+ if llm_service:
584
+ result["services_available"].append("LLM")
585
+ result["ai_response"] = llm_service.generate("Summarize the input data")
586
+
587
+ # OAuth service (imported from app providers)
588
+ if oauth_service:
589
+ result["services_available"].append("OAuth")
590
+ result["oauth_providers"] = oauth_service.get_available_providers()
591
+
592
+ # Storage service (from provider configuration)
593
+ if storage:
594
+ result["services_available"].append("Storage")
595
+ storage.save("execution_log.json", result)
596
+
597
+ return result
598
+ ```
599
+ See `test_fiber_app_agent.py` for a complete working example.
600
+
601
+ ### Agent with Multiple Services
602
+ ```python
603
+ from fiberwise_sdk import FiberAgent
604
+
605
+ class AdvancedAgent(FiberAgent):
606
+ def get_dependencies(self):
607
+ return {
608
+ 'fiber_app': 'FiberApp',
609
+ 'llm_service': 'LLMService',
610
+ 'storage': 'StorageService'
611
+ }
612
+
613
+ def run_agent(self, input_data, fiber_app=None, llm_service=None, storage=None):
614
+ # Use multiple injected services
615
+ if fiber_app and llm_service:
616
+ data = fiber_app.data.query("SELECT * FROM context")
617
+ response = llm_service.generate(f"Analyze: {data}")
618
+
619
+ if storage:
620
+ storage.save("analysis.json", response)
621
+
622
+ return {"status": "success", "analysis": response}
623
+
624
+ return {"status": "limited", "message": "Required services not available"}
625
+ ```
626
+
627
+ ## Troubleshooting
628
+
629
+ ### Common Issues
630
+
631
+ **Account Configuration Issues**:
632
+ - **Configuration not found**: Use `fiber account list-providers` to verify configs exist
633
+ - **API key invalid**: Verify key with `fiber account add-config --name test --api-key your-key --base-url https://api.fiberwise.ai`
634
+ - **Provider import fails**: Ensure app-id exists and you have proper permissions
635
+
636
+ **Dependency Injection Issues**:
637
+ - **Services are None**: Check provider configuration with `fiber account list-providers --format detailed`
638
+ - **SDK Not Found**: Install with `pip install fiberwise-sdk`
639
+ - **Agent Not Detected**: Ensure proper inheritance from `FiberAgent`
640
+
641
+ **Database Connection Issues**:
642
+ - **Database Errors**: Install required database drivers
643
+ - **Migration Issues**: Run `fiber start` to initialize database tables
644
+ - **fiberwise-common Integration**: Ensure `fiberwise-common` is properly installed
645
+
646
+ ### Debug Mode
647
+
648
+ Use `--verbose` flag for detailed execution information:
649
+ ```bash
650
+ fiber activate --verbose --input-data '{"debug": true}' ./agent.py
651
+ ```
652
+
653
+ ### Configuration Verification
654
+
655
+ ```bash
656
+ # Check account configuration
657
+ fiber account list-providers --format json
658
+
659
+ # Verify default provider
660
+ cat ~/.fiberwise/default_provider.json
661
+
662
+ # Test database connection
663
+ fiber start --verbose
664
+ ```
665
+
666
+ ## Development
667
+
668
+ ### Running Tests
669
+ ```bash
670
+ python -m pytest tests/
671
+ ```
672
+
673
+ ### Creating New Agents
674
+ See the [Agent Dependency Injection Guide](./AGENT_DEPENDENCY_INJECTION.md) for detailed instructions.
675
+
676
+ ## Contributing
677
+
678
+ 1. Fork the repository
679
+ 2. Create a feature branch
680
+ 3. Add tests for new functionality
681
+ 4. Submit a pull request
682
+
683
+ ## License
684
+
685
+ [Add your license information here]
686
+
687
+ ---
688
+
689
+ Note: For database providers other than SQLite, you'll need to manually install:
690
+ - duckdb package for DuckDB support
691
+ - mysql-connector-python for MySQL support
692
+ - psycopg2-binary for PostgreSQL support