karrio-cli 2025.5rc3__py3-none-any.whl

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 (68) hide show
  1. karrio_cli/__init__.py +0 -0
  2. karrio_cli/__main__.py +105 -0
  3. karrio_cli/ai/README.md +335 -0
  4. karrio_cli/ai/__init__.py +0 -0
  5. karrio_cli/ai/commands.py +102 -0
  6. karrio_cli/ai/karrio_ai/__init__.py +1 -0
  7. karrio_cli/ai/karrio_ai/agent.py +972 -0
  8. karrio_cli/ai/karrio_ai/architecture/INTEGRATION_AGENT_PROMPT.md +497 -0
  9. karrio_cli/ai/karrio_ai/architecture/MAPPING_AGENT_PROMPT.md +355 -0
  10. karrio_cli/ai/karrio_ai/architecture/REAL_WORLD_TESTING.md +305 -0
  11. karrio_cli/ai/karrio_ai/architecture/SCHEMA_AGENT_PROMPT.md +183 -0
  12. karrio_cli/ai/karrio_ai/architecture/TESTING_AGENT_PROMPT.md +448 -0
  13. karrio_cli/ai/karrio_ai/architecture/TESTING_GUIDE.md +271 -0
  14. karrio_cli/ai/karrio_ai/enhanced_tools.py +943 -0
  15. karrio_cli/ai/karrio_ai/rag_system.py +503 -0
  16. karrio_cli/ai/karrio_ai/tests/test_agent.py +350 -0
  17. karrio_cli/ai/karrio_ai/tests/test_real_integration.py +360 -0
  18. karrio_cli/ai/karrio_ai/tests/test_real_world_scenarios.py +513 -0
  19. karrio_cli/commands/__init__.py +0 -0
  20. karrio_cli/commands/codegen.py +336 -0
  21. karrio_cli/commands/login.py +139 -0
  22. karrio_cli/commands/plugins.py +168 -0
  23. karrio_cli/commands/sdk.py +870 -0
  24. karrio_cli/common/queries.py +101 -0
  25. karrio_cli/common/utils.py +368 -0
  26. karrio_cli/resources/__init__.py +0 -0
  27. karrio_cli/resources/carriers.py +91 -0
  28. karrio_cli/resources/connections.py +207 -0
  29. karrio_cli/resources/events.py +151 -0
  30. karrio_cli/resources/logs.py +151 -0
  31. karrio_cli/resources/orders.py +144 -0
  32. karrio_cli/resources/shipments.py +210 -0
  33. karrio_cli/resources/trackers.py +287 -0
  34. karrio_cli/templates/__init__.py +9 -0
  35. karrio_cli/templates/__pycache__/__init__.cpython-311.pyc +0 -0
  36. karrio_cli/templates/__pycache__/__init__.cpython-312.pyc +0 -0
  37. karrio_cli/templates/__pycache__/address.cpython-311.pyc +0 -0
  38. karrio_cli/templates/__pycache__/address.cpython-312.pyc +0 -0
  39. karrio_cli/templates/__pycache__/docs.cpython-311.pyc +0 -0
  40. karrio_cli/templates/__pycache__/docs.cpython-312.pyc +0 -0
  41. karrio_cli/templates/__pycache__/documents.cpython-311.pyc +0 -0
  42. karrio_cli/templates/__pycache__/documents.cpython-312.pyc +0 -0
  43. karrio_cli/templates/__pycache__/manifest.cpython-311.pyc +0 -0
  44. karrio_cli/templates/__pycache__/manifest.cpython-312.pyc +0 -0
  45. karrio_cli/templates/__pycache__/pickup.cpython-311.pyc +0 -0
  46. karrio_cli/templates/__pycache__/pickup.cpython-312.pyc +0 -0
  47. karrio_cli/templates/__pycache__/rates.cpython-311.pyc +0 -0
  48. karrio_cli/templates/__pycache__/rates.cpython-312.pyc +0 -0
  49. karrio_cli/templates/__pycache__/sdk.cpython-311.pyc +0 -0
  50. karrio_cli/templates/__pycache__/sdk.cpython-312.pyc +0 -0
  51. karrio_cli/templates/__pycache__/shipments.cpython-311.pyc +0 -0
  52. karrio_cli/templates/__pycache__/shipments.cpython-312.pyc +0 -0
  53. karrio_cli/templates/__pycache__/tracking.cpython-311.pyc +0 -0
  54. karrio_cli/templates/__pycache__/tracking.cpython-312.pyc +0 -0
  55. karrio_cli/templates/address.py +308 -0
  56. karrio_cli/templates/docs.py +150 -0
  57. karrio_cli/templates/documents.py +428 -0
  58. karrio_cli/templates/manifest.py +396 -0
  59. karrio_cli/templates/pickup.py +839 -0
  60. karrio_cli/templates/rates.py +638 -0
  61. karrio_cli/templates/sdk.py +947 -0
  62. karrio_cli/templates/shipments.py +892 -0
  63. karrio_cli/templates/tracking.py +437 -0
  64. karrio_cli-2025.5rc3.dist-info/METADATA +165 -0
  65. karrio_cli-2025.5rc3.dist-info/RECORD +68 -0
  66. karrio_cli-2025.5rc3.dist-info/WHEEL +5 -0
  67. karrio_cli-2025.5rc3.dist-info/entry_points.txt +2 -0
  68. karrio_cli-2025.5rc3.dist-info/top_level.txt +1 -0
karrio_cli/__init__.py ADDED
File without changes
karrio_cli/__main__.py ADDED
@@ -0,0 +1,105 @@
1
+ import typer
2
+ import karrio_cli.commands.sdk as sdk
3
+ import karrio_cli.resources.logs as logs
4
+ import karrio_cli.commands.login as login
5
+ import karrio_cli.resources.orders as orders
6
+ import karrio_cli.resources.events as events
7
+ import karrio_cli.commands.codegen as codegen
8
+ import karrio_cli.resources.trackers as trackers
9
+ import karrio_cli.resources.carriers as carriers
10
+ import karrio_cli.resources.shipments as shipments
11
+ import karrio_cli.resources.connections as connections
12
+
13
+ try:
14
+ import google.adk
15
+ import karrio_cli.ai.commands as agent
16
+ has_ai_dep = True
17
+ except ImportError:
18
+ has_ai_dep = False
19
+
20
+ try:
21
+ import karrio
22
+ import karrio_cli.commands.plugins as plugins
23
+ has_sdk_dep = True
24
+ except ImportError:
25
+ has_sdk_dep = False
26
+
27
+ app = typer.Typer()
28
+
29
+ # Add login commands directly to the main app
30
+ app.command()(login.login)
31
+ app.command()(login.logout)
32
+ app.command()(login.status)
33
+
34
+ # Add resource-specific commands as sub-typers
35
+ app.add_typer(
36
+ carriers.app,
37
+ name="carriers",
38
+ help="Manage carriers.",
39
+ )
40
+
41
+ app.add_typer(
42
+ connections.app,
43
+ name="connections",
44
+ help="Manage carrier connections.",
45
+ )
46
+
47
+ app.add_typer(
48
+ shipments.app,
49
+ name="shipments",
50
+ help="Manage shipments.",
51
+ )
52
+
53
+ app.add_typer(
54
+ trackers.app,
55
+ name="trackers",
56
+ help="Manage trackers.",
57
+ )
58
+
59
+ app.add_typer(
60
+ orders.app,
61
+ name="orders",
62
+ help="Manage orders.",
63
+ )
64
+
65
+ app.add_typer(
66
+ logs.app,
67
+ name="logs",
68
+ help="View API request logs.",
69
+ )
70
+
71
+ app.add_typer(
72
+ events.app,
73
+ name="events",
74
+ help="View system events.",
75
+ )
76
+
77
+ if has_sdk_dep:
78
+ app.add_typer(
79
+ sdk.app,
80
+ name="sdk",
81
+ help="SDK-related commands.",
82
+ )
83
+
84
+ app.add_typer(
85
+ codegen.app,
86
+ name="codegen",
87
+ help="Code generation utilities.",
88
+ )
89
+
90
+ if has_sdk_dep:
91
+ app.add_typer(
92
+ plugins.app,
93
+ name="plugins",
94
+ help="Manage plugins.",
95
+ )
96
+
97
+ if has_ai_dep:
98
+ app.add_typer(
99
+ agent.app,
100
+ name="agent",
101
+ help="Karrio AI agent.",
102
+ )
103
+
104
+ if __name__ == "__main__":
105
+ app()
@@ -0,0 +1,335 @@
1
+ # Karrio ADK Agent - Advanced Carrier Integration Generator
2
+
3
+ A sophisticated AI agent system built with Google's Agent Development Kit (ADK) for generating 95% complete shipping carrier integrations for the Karrio platform.
4
+
5
+ ## šŸš€ Features
6
+
7
+ ### Multi-Agent Architecture
8
+ - **Schema Agent**: Converts API documentation to Python dataclasses with proper typing
9
+ - **Mapping Agent**: Generates request/response mappings and transformations
10
+ - **Testing Agent**: Creates comprehensive test suites with fixtures and mocks
11
+ - **Integration Agent**: Orchestrates the complete integration process
12
+
13
+ ### RAG (Retrieval-Augmented Generation) System
14
+ - **Pattern Extraction**: Analyzes 40+ existing Karrio connectors for best practices
15
+ - **Semantic Search**: Finds similar implementations and code patterns
16
+ - **Code Reuse**: Leverages proven patterns from existing integrations
17
+ - **Quality Assurance**: Ensures consistency with Karrio standards
18
+
19
+ ### Comprehensive Generation
20
+ - **Python Schemas**: Complete dataclass definitions with attrs and jstruct
21
+ - **API Mappings**: Request/response transformations for all operations
22
+ - **Authentication**: Support for various auth methods (API keys, OAuth, certificates)
23
+ - **Error Handling**: Robust error processing and validation
24
+ - **Test Suites**: Unit, integration, and performance tests
25
+ - **Documentation**: Complete README, usage examples, and API reference
26
+ - **Project Structure**: Proper directory organization and configuration files
27
+
28
+ ## šŸ“ Project Structure
29
+
30
+ ```
31
+ modules/cli/karrio_cli/ai/
32
+ ā”œā”€ā”€ README.md # This documentation
33
+ ā”œā”€ā”€ karrio/ # Main agent module
34
+ │ ā”œā”€ā”€ __init__.py # Module initialization
35
+ │ ā”œā”€ā”€ agent.py # Multi-agent architecture
36
+ │ ā”œā”€ā”€ rag_system.py # RAG implementation
37
+ │ ā”œā”€ā”€ SCHEMA_AGENT_PROMPT.md # Schema agent instructions
38
+ │ ā”œā”€ā”€ MAPPING_AGENT_PROMPT.md # Mapping agent instructions
39
+ │ ā”œā”€ā”€ TESTING_AGENT_PROMPT.md # Testing agent instructions
40
+ │ └── INTEGRATION_AGENT_PROMPT.md # Integration agent instructions
41
+ ā”œā”€ā”€ coomands.py # CLI commands
42
+ └── test_agent.py # Comprehensive test suite
43
+ ```
44
+
45
+ ## šŸ› ļø Installation & Setup
46
+
47
+ ### Prerequisites
48
+ - Python 3.8+
49
+ - Google ADK installed (`pip install google-adk`)
50
+ - Karrio CLI with development dependencies
51
+
52
+ ### Environment Setup
53
+ 1. Set your Google API key:
54
+ ```bash
55
+ export GOOGLE_API_KEY="your_api_key_here"
56
+ ```
57
+
58
+ 2. Optional: Configure for Vertex AI:
59
+ ```bash
60
+ export GOOGLE_GENAI_USE_VERTEXAI="TRUE"
61
+ ```
62
+
63
+ ### Verify Installation
64
+ ```bash
65
+ cd modules/cli/karrio_cli/ai
66
+ python test_agent.py
67
+ ```
68
+
69
+ ## šŸŽÆ Usage
70
+
71
+ ### Launch the Web UI
72
+ ```bash
73
+ karrio ai web
74
+ ```
75
+
76
+ ### Command Line Usage
77
+ The agent can be used through the ADK CLI or integrated into your development workflow.
78
+
79
+ ### Generating a New Carrier Integration
80
+
81
+ 1. **Analysis Phase**: Study similar carriers
82
+ ```python
83
+ # Analyze existing patterns
84
+ analysis = analyze_existing_connector("ups", "all")
85
+
86
+ # Extract patterns from similar carriers
87
+ patterns = extract_carrier_patterns(
88
+ similar_carriers=["ups", "fedex", "canadapost"],
89
+ pattern_type="all"
90
+ )
91
+ ```
92
+
93
+ 2. **Schema Generation**: Convert API docs to Python
94
+ ```python
95
+ schema_result = generate_carrier_schema(
96
+ carrier_name="new_carrier",
97
+ api_documentation=json_schema,
98
+ schema_type="complete"
99
+ )
100
+ ```
101
+
102
+ 3. **Mapping Generation**: Create API transformations
103
+ ```python
104
+ mapping_result = generate_carrier_mappings(
105
+ carrier_name="new_carrier",
106
+ api_endpoints=endpoints,
107
+ operation_type="complete"
108
+ )
109
+ ```
110
+
111
+ 4. **Test Generation**: Build comprehensive test suite
112
+ ```python
113
+ test_result = generate_integration_tests(
114
+ carrier_name="new_carrier",
115
+ test_data=test_config,
116
+ test_type="complete"
117
+ )
118
+ ```
119
+
120
+ 5. **Final Assembly**: Create complete integration
121
+ ```python
122
+ integration = assemble_complete_integration(
123
+ carrier_name="new_carrier",
124
+ integration_config=config
125
+ )
126
+ ```
127
+
128
+ ## 🧠 RAG System
129
+
130
+ ### Pattern Recognition
131
+ The RAG system automatically indexes and analyzes:
132
+
133
+ - **Authentication Patterns**: API keys, OAuth, certificates
134
+ - **Mapping Patterns**: Request/response transformations
135
+ - **Schema Patterns**: Data model definitions
136
+ - **Error Handling**: Exception processing and validation
137
+ - **Testing Patterns**: Test structures and mock data
138
+
139
+ ### Similarity Detection
140
+ Finds carriers with similar characteristics:
141
+ - API type (REST, SOAP, GraphQL)
142
+ - Authentication methods
143
+ - Supported operations
144
+ - Data formats
145
+ - Geographic coverage
146
+
147
+ ### Code Examples
148
+ Extracts working code examples from existing connectors:
149
+ - Rate calculation functions
150
+ - Shipment creation workflows
151
+ - Tracking implementations
152
+ - Error handling patterns
153
+
154
+ ## šŸ—ļø Agent Architecture
155
+
156
+ ### Schema Agent
157
+ **Responsibility**: Convert API documentation to Python dataclasses
158
+ - JSON schema parsing
159
+ - Type annotation generation
160
+ - attrs/jstruct integration
161
+ - Karrio convention compliance
162
+
163
+ ### Mapping Agent
164
+ **Responsibility**: Create API request/response mappings
165
+ - Request transformation
166
+ - Response parsing
167
+ - Authentication handling
168
+ - Error processing
169
+ - Unit conversions
170
+
171
+ ### Testing Agent
172
+ **Responsibility**: Generate comprehensive test suites
173
+ - Unit test creation
174
+ - Integration test scenarios
175
+ - Mock data generation
176
+ - Performance benchmarks
177
+ - Error case coverage
178
+
179
+ ### Integration Agent
180
+ **Responsibility**: Orchestrate complete integration assembly
181
+ - Pattern analysis
182
+ - Component coordination
183
+ - Quality validation
184
+ - Project structure
185
+ - Documentation generation
186
+
187
+ ## šŸ“Š Quality Standards
188
+
189
+ ### Completion Criteria
190
+ - āœ… **95% Functional Completeness**: All major operations implemented
191
+ - āœ… **90% Test Coverage**: Comprehensive test suite
192
+ - āœ… **Zero Critical Issues**: No blocking problems
193
+ - āœ… **Documentation Complete**: All required documentation present
194
+ - āœ… **Pattern Compliance**: Follows established Karrio patterns
195
+
196
+ ### Code Quality
197
+ - **Type Safety**: Full type annotations with mypy compliance
198
+ - **Error Handling**: Robust exception processing
199
+ - **Performance**: Optimized for production use
200
+ - **Maintainability**: Clean, documented code
201
+ - **Testing**: Comprehensive test coverage
202
+
203
+ ## 🧪 Testing
204
+
205
+ ### Run All Tests
206
+ ```bash
207
+ python test_agent.py
208
+ ```
209
+
210
+ ### Test Categories
211
+ - **RAG System Tests**: Pattern extraction and search
212
+ - **Tool Function Tests**: Individual agent capabilities
213
+ - **Integration Tests**: End-to-end workflows
214
+ - **Quality Tests**: Code standards and compliance
215
+
216
+ ### Expected Output
217
+ ```
218
+ šŸš€ Starting Karrio ADK Agent Tests
219
+ === Testing RAG System ===
220
+ Found 25 authentication patterns
221
+ Found 43 mapping patterns
222
+ Found 31 schema patterns
223
+ āœ… RAG system tests passed
224
+
225
+ === Testing Connector Analysis ===
226
+ UPS analysis completed for carrier: ups
227
+ Found 147 files
228
+ āœ… Connector analysis tests passed
229
+
230
+ šŸ“Š Test Results: 8 passed, 0 failed
231
+ šŸŽ‰ All tests passed! The ADK agent is ready for use.
232
+ ```
233
+
234
+ ## šŸ”§ Customization
235
+
236
+ ### Adding New Pattern Types
237
+ 1. Extend the RAG system in `rag_system.py`
238
+ 2. Add pattern recognition logic
239
+ 3. Update agent prompts
240
+ 4. Add tool functions
241
+
242
+ ### Custom Templates
243
+ 1. Add templates to `modules/cli/karrio_cli/templates/`
244
+ 2. Update template integration in agent tools
245
+ 3. Test with existing carriers
246
+
247
+ ### Agent Prompts
248
+ Each agent has a dedicated prompt file:
249
+ - `SCHEMA_AGENT_PROMPT.md`: Schema generation instructions
250
+ - `MAPPING_AGENT_PROMPT.md`: Mapping creation guidance
251
+ - `TESTING_AGENT_PROMPT.md`: Test generation standards
252
+ - `INTEGRATION_AGENT_PROMPT.md`: Integration orchestration
253
+
254
+ ## šŸ“ˆ Performance
255
+
256
+ ### RAG System Metrics
257
+ - **Index Size**: ~40 carrier connectors analyzed
258
+ - **Pattern Count**: 200+ identified patterns
259
+ - **Search Speed**: <100ms for pattern queries
260
+ - **Memory Usage**: ~50MB for full knowledge base
261
+
262
+ ### Generation Speed
263
+ - **Schema Generation**: 2-5 seconds
264
+ - **Mapping Generation**: 5-10 seconds
265
+ - **Test Generation**: 3-7 seconds
266
+ - **Complete Integration**: 15-30 seconds
267
+
268
+ ## šŸ¤ Contributing
269
+
270
+ ### Development Setup
271
+ 1. Clone the repository
272
+ 2. Install dependencies: `pip install -r requirements.dev.txt`
273
+ 3. Set up pre-commit hooks
274
+ 4. Run tests: `python test_agent.py`
275
+
276
+ ### Adding New Carriers
277
+ 1. Use the agent to generate 95% of the integration
278
+ 2. Test with real API credentials
279
+ 3. Add carrier-specific customizations
280
+ 4. Submit pull request with tests
281
+
282
+ ### Improving Patterns
283
+ 1. Analyze new carrier implementations
284
+ 2. Update RAG system with findings
285
+ 3. Enhance agent prompts
286
+ 4. Test with existing carriers
287
+
288
+ ## šŸ› Troubleshooting
289
+
290
+ ### Common Issues
291
+
292
+ **ImportError: No module named 'google.adk'**
293
+ ```bash
294
+ pip install google-adk
295
+ ```
296
+
297
+ **RAG system not finding patterns**
298
+ - Ensure connectors directory exists
299
+ - Check file permissions
300
+ - Verify Python file syntax
301
+
302
+ **Agent generation errors**
303
+ - Check API key configuration
304
+ - Verify input parameters
305
+ - Review error logs
306
+
307
+ ### Debug Mode
308
+ Enable verbose logging:
309
+ ```python
310
+ import logging
311
+ logging.basicConfig(level=logging.DEBUG)
312
+ ```
313
+
314
+ ## šŸ“š Resources
315
+
316
+ - [Karrio Documentation](https://docs.karrio.io)
317
+ - [Google ADK Documentation](https://developers.google.com/adk)
318
+ - [Existing Carrier Examples](../../connectors/)
319
+ - [CLI Templates](../templates/)
320
+
321
+ ## šŸ“„ License
322
+
323
+ This project is licensed under the Apache License 2.0 - see the [LICENSE](../../../../LICENSE) file for details.
324
+
325
+ ## šŸ™ Acknowledgments
326
+
327
+ - Karrio community for connector patterns
328
+ - Google ADK team for the agent framework
329
+ - Contributors to existing carrier integrations
330
+
331
+ ---
332
+
333
+ **Ready to generate your first carrier integration?** šŸš€
334
+
335
+ Try: `karrio ai web` and follow the interactive prompts!
File without changes
@@ -0,0 +1,102 @@
1
+ import os
2
+ import sys
3
+ import typer
4
+ import subprocess
5
+ import decouple
6
+ from pathlib import Path
7
+
8
+ app = typer.Typer()
9
+
10
+ # Find the workspace root (where .env should be located)
11
+ # Work relative to current working directory instead of going up levels
12
+ current_file = Path(__file__).resolve()
13
+ current_working_dir = Path.cwd() # This will be the patch directory
14
+ workspace_root = current_working_dir # Use current directory as workspace root
15
+
16
+ # Look for .env files in multiple locations (prioritizing current working directory)
17
+ env_locations = [
18
+ workspace_root / ".env", # Current working directory .env (patch/.env)
19
+ current_file.parent / ".env", # Local AI directory .env
20
+ workspace_root / ".env.local", # Alternative naming in current dir
21
+ ]
22
+
23
+ # Find the first existing .env file
24
+ env_file = None
25
+ for location in env_locations:
26
+ if location.exists():
27
+ env_file = location
28
+ break
29
+
30
+ # Configure decouple to use the found .env file or system environment
31
+ if env_file:
32
+ config = decouple.Config(decouple.RepositoryEnv(str(env_file)))
33
+ print(f"Loading environment from: {env_file}")
34
+ else:
35
+ config = decouple.AutoConfig() # Use AutoConfig instead of RepositoryEnv without source
36
+ print("No .env file found, using system environment variables only")
37
+
38
+ @app.command()
39
+ def web():
40
+ """
41
+ Launches the Karrio AI agent web UI.
42
+ This function loads environment variables, and then uses the `adk` command-line
43
+ tool to start the agent's web UI.
44
+ """
45
+ # Load environment variables using python-decouple
46
+ google_api_key = config('GOOGLE_API_KEY', default='YOUR_API_KEY_HERE')
47
+ google_genai_use_vertexai = config('GOOGLE_GENAI_USE_VERTEXAI', default='FALSE')
48
+
49
+ # Verify API key is properly set
50
+ if google_api_key == 'YOUR_API_KEY_HERE':
51
+ print("āŒ Error: GOOGLE_API_KEY not found!")
52
+ print(f"šŸ“ Searched for .env files in:")
53
+ for location in env_locations:
54
+ exists = "āœ…" if location.exists() else "āŒ"
55
+ print(f" {exists} {location}")
56
+ print("\nšŸ’” To fix this:")
57
+ print(f" 1. Create a .env file in: {workspace_root}")
58
+ print(" 2. Add your Google API key: GOOGLE_API_KEY=your_actual_api_key_here")
59
+ print(" 3. Get an API key from: https://console.cloud.google.com/apis/credentials")
60
+ sys.exit(1)
61
+ else:
62
+ # Mask the API key for security when displaying
63
+ masked_key = google_api_key[:8] + "..." + google_api_key[-4:] if len(google_api_key) > 12 else "***"
64
+ print(f"āœ… Google API Key loaded: {masked_key}")
65
+
66
+ # Prepare environment for the ADK process
67
+ env = os.environ.copy() # Copy current environment
68
+ env['GOOGLE_API_KEY'] = google_api_key
69
+ env['GOOGLE_GENAI_USE_VERTEXAI'] = google_genai_use_vertexai
70
+
71
+ # Debug: Show environment variables being passed
72
+ print(f"šŸ”§ Environment variables for ADK:")
73
+ print(f" GOOGLE_API_KEY: {google_api_key[:8]}...{google_api_key[-4:] if len(google_api_key) > 12 else '***'}")
74
+ print(f" GOOGLE_GENAI_USE_VERTEXAI: {google_genai_use_vertexai}")
75
+
76
+ # The `adk` command expects to be run from the parent of the agent module
77
+ agent_module_parent_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
78
+
79
+ # The agent directory path (not module name)
80
+ agent_dir = os.path.join(agent_module_parent_dir, 'ai')
81
+
82
+ command = [
83
+ "adk",
84
+ "web",
85
+ agent_dir,
86
+ ]
87
+
88
+ try:
89
+ # Run the adk command with explicit environment
90
+ print(f"Running agent from: {agent_module_parent_dir}")
91
+ print(f"Using agent directory: {agent_dir}")
92
+ subprocess.run(command, check=True, cwd=agent_module_parent_dir, env=env)
93
+ except FileNotFoundError:
94
+ print("Error: 'adk' command not found.")
95
+ print("Please ensure the Google Agent Development Kit is installed ('pip install karrio-cli[dev]') and in your PATH.")
96
+ sys.exit(1)
97
+ except subprocess.CalledProcessError as e:
98
+ print(f"Error running agent: {e}")
99
+ sys.exit(1)
100
+
101
+ if __name__ == '__main__':
102
+ app()
@@ -0,0 +1 @@
1
+ from karrio_ai import agent