kite-agent 0.1.0__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.
- kite/__init__.py +46 -0
- kite/ab_testing.py +384 -0
- kite/agent.py +556 -0
- kite/agents/__init__.py +3 -0
- kite/agents/plan_execute.py +191 -0
- kite/agents/react_agent.py +509 -0
- kite/agents/reflective_agent.py +90 -0
- kite/agents/rewoo.py +119 -0
- kite/agents/tot.py +151 -0
- kite/conversation.py +125 -0
- kite/core.py +974 -0
- kite/data_loaders.py +111 -0
- kite/embedding_providers.py +372 -0
- kite/llm_providers.py +1278 -0
- kite/memory/__init__.py +6 -0
- kite/memory/advanced_rag.py +333 -0
- kite/memory/graph_rag.py +719 -0
- kite/memory/session_memory.py +423 -0
- kite/memory/vector_memory.py +579 -0
- kite/monitoring.py +611 -0
- kite/observers.py +107 -0
- kite/optimization/__init__.py +9 -0
- kite/optimization/resource_router.py +80 -0
- kite/persistence.py +42 -0
- kite/pipeline/__init__.py +5 -0
- kite/pipeline/deterministic_pipeline.py +323 -0
- kite/pipeline/reactive_pipeline.py +171 -0
- kite/pipeline_manager.py +15 -0
- kite/routing/__init__.py +6 -0
- kite/routing/aggregator_router.py +325 -0
- kite/routing/llm_router.py +149 -0
- kite/routing/semantic_router.py +228 -0
- kite/safety/__init__.py +6 -0
- kite/safety/circuit_breaker.py +360 -0
- kite/safety/guardrails.py +82 -0
- kite/safety/idempotency_manager.py +304 -0
- kite/safety/kill_switch.py +75 -0
- kite/tool.py +183 -0
- kite/tool_registry.py +87 -0
- kite/tools/__init__.py +21 -0
- kite/tools/code_execution.py +53 -0
- kite/tools/contrib/__init__.py +19 -0
- kite/tools/contrib/calculator.py +26 -0
- kite/tools/contrib/datetime_utils.py +20 -0
- kite/tools/contrib/linkedin.py +428 -0
- kite/tools/contrib/web_search.py +30 -0
- kite/tools/mcp/__init__.py +31 -0
- kite/tools/mcp/database_mcp.py +267 -0
- kite/tools/mcp/gdrive_mcp_server.py +503 -0
- kite/tools/mcp/gmail_mcp_server.py +601 -0
- kite/tools/mcp/postgres_mcp_server.py +490 -0
- kite/tools/mcp/slack_mcp_server.py +538 -0
- kite/tools/mcp/stripe_mcp_server.py +219 -0
- kite/tools/search.py +90 -0
- kite/tools/system_tools.py +54 -0
- kite/tools_manager.py +27 -0
- kite_agent-0.1.0.dist-info/METADATA +621 -0
- kite_agent-0.1.0.dist-info/RECORD +61 -0
- kite_agent-0.1.0.dist-info/WHEEL +5 -0
- kite_agent-0.1.0.dist-info/licenses/LICENSE +21 -0
- kite_agent-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,621 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kite-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Production-Ready Agentic AI Framework with Enterprise Safety
|
|
5
|
+
Home-page: https://github.com/thienzz/Kite
|
|
6
|
+
Author: Thien Nguyen
|
|
7
|
+
Project-URL: Bug Tracker, https://github.com/thienzz/Kite/issues
|
|
8
|
+
Project-URL: Documentation, https://github.com/thienzz/Kite/tree/main/docs
|
|
9
|
+
Project-URL: Source Code, https://github.com/thienzz/Kite
|
|
10
|
+
Keywords: ai agents llm production-ready safety circuit-breaker agentic-ai
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
15
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
26
|
+
Requires-Dist: requests>=2.31.0
|
|
27
|
+
Requires-Dist: httpx>=0.25.0
|
|
28
|
+
Requires-Dist: pydantic>=2.0.0
|
|
29
|
+
Requires-Dist: tenacity>=8.2.0
|
|
30
|
+
Requires-Dist: numpy>=1.24.0
|
|
31
|
+
Requires-Dist: anthropic>=0.18.0
|
|
32
|
+
Requires-Dist: openai>=1.0.0
|
|
33
|
+
Requires-Dist: groq>=0.4.0
|
|
34
|
+
Requires-Dist: together>=0.2.0
|
|
35
|
+
Requires-Dist: ollama>=0.1.0
|
|
36
|
+
Provides-Extra: llm
|
|
37
|
+
Requires-Dist: anthropic>=0.18.0; extra == "llm"
|
|
38
|
+
Requires-Dist: openai>=1.0.0; extra == "llm"
|
|
39
|
+
Requires-Dist: groq>=0.4.0; extra == "llm"
|
|
40
|
+
Requires-Dist: together>=0.2.0; extra == "llm"
|
|
41
|
+
Requires-Dist: ollama>=0.1.0; extra == "llm"
|
|
42
|
+
Provides-Extra: memory
|
|
43
|
+
Requires-Dist: faiss-cpu>=1.7.4; extra == "memory"
|
|
44
|
+
Requires-Dist: chromadb>=0.4.0; extra == "memory"
|
|
45
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == "memory"
|
|
46
|
+
Requires-Dist: fastembed>=0.1.0; extra == "memory"
|
|
47
|
+
Requires-Dist: rank-bm25>=0.2.2; extra == "memory"
|
|
48
|
+
Requires-Dist: cohere>=5.0.0; extra == "memory"
|
|
49
|
+
Provides-Extra: database
|
|
50
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "database"
|
|
51
|
+
Requires-Dist: redis>=5.0.0; extra == "database"
|
|
52
|
+
Requires-Dist: mysql-connector-python>=8.0.0; extra == "database"
|
|
53
|
+
Requires-Dist: motor>=3.3.0; extra == "database"
|
|
54
|
+
Provides-Extra: monitoring
|
|
55
|
+
Requires-Dist: prometheus-client>=0.19.0; extra == "monitoring"
|
|
56
|
+
Requires-Dist: fastapi>=0.100.0; extra == "monitoring"
|
|
57
|
+
Requires-Dist: uvicorn>=0.22.0; extra == "monitoring"
|
|
58
|
+
Requires-Dist: python-multipart>=0.0.6; extra == "monitoring"
|
|
59
|
+
Provides-Extra: dev
|
|
60
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
61
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
62
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
63
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
64
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
65
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
66
|
+
Provides-Extra: all
|
|
67
|
+
Requires-Dist: anthropic>=0.18.0; extra == "all"
|
|
68
|
+
Requires-Dist: openai>=1.0.0; extra == "all"
|
|
69
|
+
Requires-Dist: groq>=0.4.0; extra == "all"
|
|
70
|
+
Requires-Dist: together>=0.2.0; extra == "all"
|
|
71
|
+
Requires-Dist: ollama>=0.1.0; extra == "all"
|
|
72
|
+
Requires-Dist: faiss-cpu>=1.7.4; extra == "all"
|
|
73
|
+
Requires-Dist: chromadb>=0.4.0; extra == "all"
|
|
74
|
+
Requires-Dist: sentence-transformers>=2.2.0; extra == "all"
|
|
75
|
+
Requires-Dist: fastembed>=0.1.0; extra == "all"
|
|
76
|
+
Requires-Dist: rank-bm25>=0.2.2; extra == "all"
|
|
77
|
+
Requires-Dist: cohere>=5.0.0; extra == "all"
|
|
78
|
+
Requires-Dist: psycopg2-binary>=2.9.0; extra == "all"
|
|
79
|
+
Requires-Dist: redis>=5.0.0; extra == "all"
|
|
80
|
+
Requires-Dist: mysql-connector-python>=8.0.0; extra == "all"
|
|
81
|
+
Requires-Dist: motor>=3.3.0; extra == "all"
|
|
82
|
+
Requires-Dist: prometheus-client>=0.19.0; extra == "all"
|
|
83
|
+
Requires-Dist: fastapi>=0.100.0; extra == "all"
|
|
84
|
+
Requires-Dist: uvicorn>=0.22.0; extra == "all"
|
|
85
|
+
Requires-Dist: python-multipart>=0.0.6; extra == "all"
|
|
86
|
+
Dynamic: author
|
|
87
|
+
Dynamic: classifier
|
|
88
|
+
Dynamic: description
|
|
89
|
+
Dynamic: description-content-type
|
|
90
|
+
Dynamic: home-page
|
|
91
|
+
Dynamic: keywords
|
|
92
|
+
Dynamic: license-file
|
|
93
|
+
Dynamic: project-url
|
|
94
|
+
Dynamic: provides-extra
|
|
95
|
+
Dynamic: requires-dist
|
|
96
|
+
Dynamic: requires-python
|
|
97
|
+
Dynamic: summary
|
|
98
|
+
|
|
99
|
+
ο»Ώ# πͺ Kite
|
|
100
|
+
|
|
101
|
+
**Build Production-Ready AI Agents That Actually Work**
|
|
102
|
+
|
|
103
|
+
*Fast β’ Safe β’ Simple β’ Powerful*
|
|
104
|
+
|
|
105
|
+
[](LICENSE)
|
|
106
|
+
[](https://www.python.org/downloads/)
|
|
107
|
+
[](https://github.com/thienzz/Kite/releases)
|
|
108
|
+
|
|
109
|
+
> π **What is Kite?** A lightweight Python framework that turns LLMs into reliable AI agents you can deploy with confidence. No PhD required.
|
|
110
|
+
|
|
111
|
+
## π¦ Installation
|
|
112
|
+
|
|
113
|
+
**Via pip (recommended):**
|
|
114
|
+
```bash
|
|
115
|
+
pip install kite-agent
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**From source:**
|
|
119
|
+
```bash
|
|
120
|
+
git clone https://github.com/thienzz/Kite.git
|
|
121
|
+
cd Kite
|
|
122
|
+
pip install -e .
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
[Quick Start](#-quick-start) β’ [Examples](#-production-examples) β’ [Features](#-core-features) β’ [Documentation](#-documentation)
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## β¨ Why Developers Choose Kite
|
|
130
|
+
|
|
131
|
+
Most AI frameworks overwhelm you with complexity. Kite gives you **production-grade reliability** with **dead-simple APIs**:
|
|
132
|
+
|
|
133
|
+
```python
|
|
134
|
+
from kite import Kite
|
|
135
|
+
|
|
136
|
+
# Initialize once
|
|
137
|
+
ai = Kite()
|
|
138
|
+
|
|
139
|
+
# Create a specialist agent
|
|
140
|
+
support_agent = ai.create_agent(
|
|
141
|
+
name="CustomerSupport",
|
|
142
|
+
system_prompt="You are a helpful e-commerce support agent.",
|
|
143
|
+
tools=[search_orders, process_refunds],
|
|
144
|
+
agent_type="react" # Autonomous reasoning loop
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
# Run it
|
|
148
|
+
result = await support_agent.run("Where is order ORD-12345?")
|
|
149
|
+
print(result['response'])
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**That's it.** Behind the scenes, Kite handles:
|
|
153
|
+
- β
Circuit breakers (prevent cascading failures)
|
|
154
|
+
- β
Retry logic (auto-recovery from API errors)
|
|
155
|
+
- β
Memory management (RAG, sessions, graph knowledge)
|
|
156
|
+
- β
Multi-provider support (OpenAI, Anthropic, Groq, local models)
|
|
157
|
+
- β
Cost tracking & monitoring
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## π― Built for Real-World Problems
|
|
162
|
+
|
|
163
|
+
Stop building MVP demos. Start shipping production systems:
|
|
164
|
+
|
|
165
|
+
| Your Challenge | Kite's Solution |
|
|
166
|
+
|---------------|----------------|
|
|
167
|
+
| "LLMs hallucinate in production" | **Vector RAG + Graph RAG** for grounded responses |
|
|
168
|
+
| "API failures crash my agents" | **Circuit breakers** auto-pause failing services |
|
|
169
|
+
| "Too slow & expensive" | **Smart/Fast model routing** - use cheap models when possible |
|
|
170
|
+
| "Can't track what agents are doing" | **Event bus + metrics** for full observability |
|
|
171
|
+
| "Hard to prevent dangerous actions" | **Guardrails & shell whitelisting** built-in |
|
|
172
|
+
| "Need human approval for critical tasks" | **HITL workflows** with checkpoints |
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## β‘ Quick Start
|
|
177
|
+
|
|
178
|
+
### Installation
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
git clone https://github.com/thienzz/Kite.git
|
|
182
|
+
cd Kite
|
|
183
|
+
pip install -r requirements.txt
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Setup Environment
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
cp .env.example .env
|
|
190
|
+
# Edit .env with your API keys
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
**Minimum config:**
|
|
194
|
+
```bash
|
|
195
|
+
LLM_PROVIDER=openai # or anthropic, groq, ollama
|
|
196
|
+
OPENAI_API_KEY=sk-...
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Your First Agent (30 seconds)
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
import asyncio
|
|
203
|
+
from kite import Kite
|
|
204
|
+
|
|
205
|
+
async def main():
|
|
206
|
+
# Auto-loads from .env
|
|
207
|
+
ai = Kite()
|
|
208
|
+
|
|
209
|
+
# Create a tool
|
|
210
|
+
def get_weather(city: str) -> str:
|
|
211
|
+
return f"Sunny, 72Β°F in {city}"
|
|
212
|
+
|
|
213
|
+
weather_tool = ai.create_tool("get_weather", get_weather,
|
|
214
|
+
"Get current weather for a city")
|
|
215
|
+
|
|
216
|
+
# Create agent
|
|
217
|
+
agent = ai.create_agent(
|
|
218
|
+
name="WeatherBot",
|
|
219
|
+
system_prompt="You help users check weather. Always use the tool.",
|
|
220
|
+
tools=[weather_tool],
|
|
221
|
+
agent_type="react"
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
# Run
|
|
225
|
+
result = await agent.run("What's the weather in San Francisco?")
|
|
226
|
+
print(result['response'])
|
|
227
|
+
|
|
228
|
+
asyncio.run(main())
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
---
|
|
232
|
+
|
|
233
|
+
## ποΈ Architecture Overview
|
|
234
|
+
|
|
235
|
+
Kite's modular design lets you use what you need:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
kite/
|
|
239
|
+
βββ agents/ # π€ Reasoning patterns (ReAct, ReWOO, ToT, Plan-Execute)
|
|
240
|
+
βββ memory/ # π§ Vector RAG, Graph RAG, Session Memory
|
|
241
|
+
βββ safety/ # π‘οΈ Circuit Breakers, Idempotency, Kill Switches
|
|
242
|
+
βββ routing/ # π§ Semantic Routing, Aggregator Routing, Smart/Fast Model Selection
|
|
243
|
+
βββ tools/ # π§ Built-in utilities (Web Search, Code Execution, Shell, MCP integrations)
|
|
244
|
+
βββ pipeline/ # βοΈ Deterministic workflows with HITL support
|
|
245
|
+
βββ monitoring/ # π Metrics, Tracing, Event Bus
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
### Core Components (Lazy-Loaded)
|
|
249
|
+
|
|
250
|
+
```python
|
|
251
|
+
ai = Kite()
|
|
252
|
+
|
|
253
|
+
# These initialize only when accessed:
|
|
254
|
+
ai.llm # LLM provider (OpenAI, Anthropic, Groq, Ollama)
|
|
255
|
+
ai.embeddings # Embedding provider (FastEmbed, OpenAI)
|
|
256
|
+
ai.vector_memory # Vector similarity search (FAISS, ChromaDB, or in-memory)
|
|
257
|
+
ai.graph_rag # Knowledge graph for relationships
|
|
258
|
+
ai.session_memory # Conversation history
|
|
259
|
+
ai.semantic_router # Intent-based routing
|
|
260
|
+
ai.circuit_breaker # Fault tolerance
|
|
261
|
+
ai.idempotency # Duplicate request prevention
|
|
262
|
+
ai.tools # Tool registry
|
|
263
|
+
ai.pipeline # Workflow manager
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## π Core Features
|
|
269
|
+
|
|
270
|
+
### 1οΈβ£ Multiple Reasoning Patterns
|
|
271
|
+
|
|
272
|
+
Choose the right "brain" for your task:
|
|
273
|
+
|
|
274
|
+
```python
|
|
275
|
+
# ReAct: Standard loop (Think β Act β Observe β Repeat)
|
|
276
|
+
agent = ai.create_agent(..., agent_type="react")
|
|
277
|
+
|
|
278
|
+
# ReWOO: Plan everything upfront, execute in parallel (FAST!)
|
|
279
|
+
agent = ai.create_agent(..., agent_type="rewoo")
|
|
280
|
+
|
|
281
|
+
# Tree-of-Thoughts: Explore multiple solutions (creative tasks)
|
|
282
|
+
agent = ai.create_agent(..., agent_type="tot")
|
|
283
|
+
|
|
284
|
+
# Plan-Execute: Classic two-phase planning
|
|
285
|
+
agent = ai.create_agent(..., agent_type="plan_execute")
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**See them in action:** [examples/case6_reasoning_architectures.py](examples/case6_reasoning_architectures.py)
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
### 2οΈβ£ Production Safety Mechanisms
|
|
293
|
+
|
|
294
|
+
**Circuit Breakers** prevent cascading failures:
|
|
295
|
+
|
|
296
|
+
```python
|
|
297
|
+
ai.circuit_breaker.config.failure_threshold = 3 # Open after 3 failures
|
|
298
|
+
ai.circuit_breaker.config.timeout_seconds = 60 # Cool-down period
|
|
299
|
+
|
|
300
|
+
# Circuit auto-opens if LLM/tool fails 3x, preventing waste
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Idempotency** prevents duplicate operations:
|
|
304
|
+
|
|
305
|
+
```python
|
|
306
|
+
# Same operation_id within TTL returns cached result
|
|
307
|
+
result = ai.idempotency.execute(
|
|
308
|
+
operation_id="order_123_refund",
|
|
309
|
+
func=process_refund,
|
|
310
|
+
args=(order_id,)
|
|
311
|
+
)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
**Guardrails** for dangerous operations:
|
|
315
|
+
|
|
316
|
+
```python
|
|
317
|
+
from kite.tools.system_tools import ShellTool
|
|
318
|
+
|
|
319
|
+
# Whitelist safe commands only
|
|
320
|
+
shell = ShellTool(allowed_commands=["ls", "git", "df", "uptime"])
|
|
321
|
+
|
|
322
|
+
# Blocks 'rm -rf', 'sudo', etc. automatically
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
### 3οΈβ£ Advanced Memory Systems
|
|
328
|
+
|
|
329
|
+
**Vector Memory** for semantic search:
|
|
330
|
+
|
|
331
|
+
```python
|
|
332
|
+
# Add knowledge
|
|
333
|
+
ai.vector_memory.add_document("policy_001", "Returns accepted within 30 days...")
|
|
334
|
+
|
|
335
|
+
# Semantic search
|
|
336
|
+
results = ai.vector_memory.search("What's the return policy?", top_k=3)
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
**Graph RAG** for relationship-aware knowledge:
|
|
340
|
+
|
|
341
|
+
```python
|
|
342
|
+
ai.graph_rag.add_entity("Kite", "framework", {"language": "Python"})
|
|
343
|
+
ai.graph_rag.add_relationship("Kite", "uses", "OpenAI")
|
|
344
|
+
|
|
345
|
+
# Query walks the graph
|
|
346
|
+
answer = ai.graph_rag.query("What providers does Kite support?")
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
**Session Memory** for conversations:
|
|
350
|
+
|
|
351
|
+
```python
|
|
352
|
+
ai.session_memory.add_message(session_id="user_123", role="user", content="Hi!")
|
|
353
|
+
history = ai.session_memory.get_history(session_id="user_123")
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
---
|
|
357
|
+
|
|
358
|
+
### 4οΈβ£ Smart Multi-Provider Support
|
|
359
|
+
|
|
360
|
+
Switch between providers without changing code:
|
|
361
|
+
|
|
362
|
+
```python
|
|
363
|
+
# OpenAI
|
|
364
|
+
ai.config['llm_provider'] = 'openai'
|
|
365
|
+
ai.config['llm_model'] = 'gpt-4o'
|
|
366
|
+
|
|
367
|
+
# Anthropic
|
|
368
|
+
ai.config['llm_provider'] = 'anthropic'
|
|
369
|
+
ai.config['llm_model'] = 'claude-3-5-sonnet-20241022'
|
|
370
|
+
|
|
371
|
+
# Groq (ultra-fast inference)
|
|
372
|
+
ai.config['llm_provider'] = 'groq'
|
|
373
|
+
ai.config['llm_model'] = 'llama-3.3-70b-versatile'
|
|
374
|
+
|
|
375
|
+
# Local with Ollama
|
|
376
|
+
ai.config['llm_provider'] = 'ollama'
|
|
377
|
+
ai.config['llm_model'] = 'qwen2.5:1.5b'
|
|
378
|
+
```
|
|
379
|
+
|
|
380
|
+
**Cost Optimization**: Use resource-aware routing:
|
|
381
|
+
|
|
382
|
+
```python
|
|
383
|
+
from kite.optimization.resource_router import ResourceAwareRouter
|
|
384
|
+
|
|
385
|
+
router = ResourceAwareRouter(ai.config)
|
|
386
|
+
|
|
387
|
+
# Automatically uses:
|
|
388
|
+
# - FAST model (cheap) for routing, simple tasks
|
|
389
|
+
# - SMART model (powerful) for complex reasoning
|
|
390
|
+
analyst = ai.create_agent(
|
|
391
|
+
name="Analyst",
|
|
392
|
+
model=router.smart_model, # gpt-4o for hard problems
|
|
393
|
+
...
|
|
394
|
+
)
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
---
|
|
398
|
+
|
|
399
|
+
### 5οΈβ£ Human-in-the-Loop Workflows
|
|
400
|
+
|
|
401
|
+
Build approval workflows for critical operations:
|
|
402
|
+
|
|
403
|
+
```python
|
|
404
|
+
from kite.pipeline import DeterministicPipeline
|
|
405
|
+
|
|
406
|
+
# Define workflow
|
|
407
|
+
def draft_email(state):
|
|
408
|
+
return {"draft": "Dear Customer, ..."}
|
|
409
|
+
|
|
410
|
+
def send_email(state):
|
|
411
|
+
return {"status": "sent"}
|
|
412
|
+
|
|
413
|
+
# Create pipeline with checkpoint
|
|
414
|
+
pipeline = ai.pipeline.create("approval_flow")
|
|
415
|
+
pipeline.add_step("draft", draft_email)
|
|
416
|
+
pipeline.add_checkpoint("draft") # Pauses here for approval
|
|
417
|
+
pipeline.add_step("send", send_email)
|
|
418
|
+
|
|
419
|
+
# Execute (stops at checkpoint)
|
|
420
|
+
state = await pipeline.execute_async({"to": "user@example.com"})
|
|
421
|
+
|
|
422
|
+
# Human reviews, then resume
|
|
423
|
+
final = await pipeline.resume_async(state.task_id, approved=True)
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
**Real example:** [case4_multi_agent_collab.py](examples/case4_multi_agent_collab.py)
|
|
427
|
+
|
|
428
|
+
---
|
|
429
|
+
|
|
430
|
+
## π Production Examples
|
|
431
|
+
|
|
432
|
+
We built **6 real-world case studies** to show you exactly how to use Kite:
|
|
433
|
+
|
|
434
|
+
| Case | Scenario | Key Concepts | Difficulty |
|
|
435
|
+
|------|----------|--------------|-----------|
|
|
436
|
+
| **[Case 1](examples/case1_ecommerce_support.py)** | E-commerce Support Bot | LLM Routing, Tools, Multi-Agent | π’ Beginner |
|
|
437
|
+
| **[Case 2](examples/case2_enterprise_analytics.py)** | Data Analyst Agent | SQL + Python Execution, Charts | π‘ Intermediate |
|
|
438
|
+
| **[Case 3](examples/case3_research_assistant.py)** | Deep Research System | Web Scraping, Multi-Step Planning | π‘ Intermediate |
|
|
439
|
+
| **[Case 4](examples/case4_multi_agent_collab.py)** | Multi-Agent Collaboration | Supervisor Pattern, HITL, Iterative Refinement | π΄ Advanced |
|
|
440
|
+
| **[Case 5](examples/case5_devops_automation.py)** | DevOps Automation | Shell Tools, Safety Guardrails | π‘ Intermediate |
|
|
441
|
+
| **[Case 6](examples/case6_reasoning_architectures.py)** | Reasoning Pattern Comparison | ReAct vs ReWOO vs ToT | π΄ Advanced |
|
|
442
|
+
|
|
443
|
+
### Run an Example
|
|
444
|
+
|
|
445
|
+
```bash
|
|
446
|
+
# E-commerce support demo
|
|
447
|
+
PYTHONPATH=. python3 examples/case1_ecommerce_support.py
|
|
448
|
+
|
|
449
|
+
# Data analyst with charts
|
|
450
|
+
PYTHONPATH=. python3 examples/case2_enterprise_analytics.py
|
|
451
|
+
```
|
|
452
|
+
|
|
453
|
+
**π [See detailed tutorials for each case β](examples/README.md)**
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## π Performance Benchmarks
|
|
458
|
+
|
|
459
|
+
| Metric | Value |
|
|
460
|
+
|--------|-------|
|
|
461
|
+
| **Framework Startup** | ~50ms (lazy loading) |
|
|
462
|
+
| **Memory Footprint** | <100MB (base) |
|
|
463
|
+
| **Agent Latency** | 500ms - 2s (depends on LLM provider) |
|
|
464
|
+
| **Throughput** | 100+ req/s with caching |
|
|
465
|
+
|
|
466
|
+
**Real data** (M1 Mac, Ollama qwen2.5:1.5b):
|
|
467
|
+
- Simple completion: **50-200ms**
|
|
468
|
+
- ReAct agent (3 tool calls): **800ms-1.5s**
|
|
469
|
+
- Plan-Execute (5 steps): **3-5s**
|
|
470
|
+
|
|
471
|
+
---
|
|
472
|
+
|
|
473
|
+
## π οΈ Production Deployment
|
|
474
|
+
|
|
475
|
+
### Docker Compose (Recommended)
|
|
476
|
+
|
|
477
|
+
```bash
|
|
478
|
+
docker-compose up -d
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Includes:**
|
|
482
|
+
- Kite API server (FastAPI)
|
|
483
|
+
- Redis (caching)
|
|
484
|
+
- PostgreSQL (session storage)
|
|
485
|
+
- Prometheus + Grafana (monitoring)
|
|
486
|
+
|
|
487
|
+
### Environment Variables
|
|
488
|
+
|
|
489
|
+
See [.env.example](.env.example) for all options. Key configs:
|
|
490
|
+
|
|
491
|
+
```bash
|
|
492
|
+
# LLM Provider
|
|
493
|
+
LLM_PROVIDER=openai
|
|
494
|
+
LLM_MODEL=gpt-4o
|
|
495
|
+
OPENAI_API_KEY=sk-...
|
|
496
|
+
|
|
497
|
+
# Embeddings
|
|
498
|
+
EMBEDDING_PROVIDER=fastembed
|
|
499
|
+
EMBEDDING_MODEL=BAAI/bge-small-en-v1.5
|
|
500
|
+
|
|
501
|
+
# Safety
|
|
502
|
+
CIRCUIT_BREAKER_FAILURE_THRESHOLD=3
|
|
503
|
+
CIRCUIT_BREAKER_TIMEOUT_SECONDS=60
|
|
504
|
+
IDEMPOTENCY_TTL=3600
|
|
505
|
+
|
|
506
|
+
# Memory
|
|
507
|
+
VECTOR_BACKEND=faiss
|
|
508
|
+
VECTOR_DIMENSION=384
|
|
509
|
+
|
|
510
|
+
# Optimization
|
|
511
|
+
FAST_LLM_MODEL=groq/llama-3.1-8b-instant # Cheap routing
|
|
512
|
+
SMART_LLM_MODEL=openai/gpt-4o # Complex tasks
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## π Documentation
|
|
518
|
+
|
|
519
|
+
### Guides
|
|
520
|
+
|
|
521
|
+
- **[Quick Start Guide](docs/quickstart.md)** - Get running in 5 minutes
|
|
522
|
+
- **[Architecture Deep Dive](docs/architecture.md)** - How Kite works internally
|
|
523
|
+
- **[API Reference](docs/api_reference.md)** - Complete API docs
|
|
524
|
+
- **[Deployment Guide](docs/deployment.md)** - Docker, scaling, monitoring
|
|
525
|
+
- **[Safety Patterns](docs/safety.md)** - Circuit breakers, guardrails, idempotency
|
|
526
|
+
- **[Memory Systems](docs/memory.md)** - Vector, Graph RAG, sessions
|
|
527
|
+
|
|
528
|
+
### Examples
|
|
529
|
+
|
|
530
|
+
All examples include detailed inline comments and step-by-step walkthroughs:
|
|
531
|
+
|
|
532
|
+
- [E-commerce Support](examples/case1_ecommerce_support.py) - Multi-agent routing
|
|
533
|
+
- [Enterprise Analytics](examples/case2_enterprise_analytics.py) - SQL + Python
|
|
534
|
+
- [Research Assistant](examples/case3_research_assistant.py) - Web research
|
|
535
|
+
- [Multi-Agent Workflow](examples/case4_multi_agent_collab.py) - Supervisor pattern
|
|
536
|
+
- [DevOps Automation](examples/case5_devops_automation.py) - Safe shell execution
|
|
537
|
+
- [Reasoning Patterns](examples/case6_reasoning_architectures.py) - ReAct/ReWOO/ToT
|
|
538
|
+
|
|
539
|
+
---
|
|
540
|
+
|
|
541
|
+
## π§ͺ Testing
|
|
542
|
+
|
|
543
|
+
```bash
|
|
544
|
+
# Run all tests
|
|
545
|
+
pytest tests/
|
|
546
|
+
|
|
547
|
+
# Specific suites
|
|
548
|
+
pytest tests/test_framework.py # Core functionality
|
|
549
|
+
pytest tests/test_async_concurrency.py # Async patterns
|
|
550
|
+
pytest tests/test_exports.py # Module exports
|
|
551
|
+
|
|
552
|
+
# With coverage
|
|
553
|
+
pytest --cov=kite tests/
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
---
|
|
557
|
+
|
|
558
|
+
## π€ Contributing
|
|
559
|
+
|
|
560
|
+
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for:
|
|
561
|
+
|
|
562
|
+
- π Bug reports & feature requests
|
|
563
|
+
- π Documentation improvements
|
|
564
|
+
- π§ New reasoning patterns
|
|
565
|
+
- π Additional LLM integrations
|
|
566
|
+
- β‘ Performance optimizations
|
|
567
|
+
|
|
568
|
+
**Priority areas:**
|
|
569
|
+
- More agent architectures (LATS, Reflexion)
|
|
570
|
+
- Streaming response support
|
|
571
|
+
- Multi-agent orchestration patterns
|
|
572
|
+
- Integration tests for all examples
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
## πΊοΈ Roadmap
|
|
577
|
+
|
|
578
|
+
- [x] **v0.1.0**: Core framework, ReAct/ReWOO/ToT agents
|
|
579
|
+
- [ ] **v0.2.0**: Streaming responses, async batch processing
|
|
580
|
+
- [ ] **v0.3.0**: Multi-agent coordination primitives
|
|
581
|
+
- [ ] **v0.4.0**: Fine-tuning integration
|
|
582
|
+
- [ ] **v1.0.0**: Production-ready release with full test coverage
|
|
583
|
+
|
|
584
|
+
---
|
|
585
|
+
|
|
586
|
+
## π License
|
|
587
|
+
|
|
588
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
589
|
+
|
|
590
|
+
**TLDR:** Use it however you want. Commercial use welcome. No warranty.
|
|
591
|
+
|
|
592
|
+
---
|
|
593
|
+
|
|
594
|
+
## π Acknowledgments
|
|
595
|
+
|
|
596
|
+
Built with amazing open-source tools:
|
|
597
|
+
|
|
598
|
+
- [Ollama](https://ollama.ai/) - Local LLM runtime
|
|
599
|
+
- [FastEmbed](https://github.com/qdrant/fastembed) - Lightning-fast embeddings
|
|
600
|
+
- [FAISS](https://github.com/facebookresearch/faiss) - Facebook's vector search
|
|
601
|
+
- [ChromaDB](https://www.trychroma.com/) - Vector database
|
|
602
|
+
- [LangChain](https://python.langchain.com/) - Inspiration for tool abstractions
|
|
603
|
+
|
|
604
|
+
---
|
|
605
|
+
|
|
606
|
+
## π¬ Community & Support
|
|
607
|
+
|
|
608
|
+
- **π Bug Reports:** [GitHub Issues](https://github.com/thienzz/Kite/issues)
|
|
609
|
+
- **π‘ Feature Requests:** [GitHub Discussions](https://github.com/thienzz/Kite/discussions)
|
|
610
|
+
- **π§ Contact:** thien@beevr.ai
|
|
611
|
+
|
|
612
|
+
---
|
|
613
|
+
|
|
614
|
+
<p align="center">
|
|
615
|
+
<strong>Stop building demos. Start shipping AI agents to production.</strong><br>
|
|
616
|
+
β Star this repo if Kite helps you build better AI systems!
|
|
617
|
+
</p>
|
|
618
|
+
|
|
619
|
+
<p align="center">
|
|
620
|
+
Made with β€οΈ by developers who ship production AI
|
|
621
|
+
</p>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
kite/__init__.py,sha256=OL7esRsCXD1Z-dWaPK3jE1xQy3gwQ63N8AmJZTvaU7Q,1026
|
|
2
|
+
kite/ab_testing.py,sha256=9VVHmOCPJqb_vi9EMk2V1dhp4rdLTCawzpk35PzATpM,12744
|
|
3
|
+
kite/agent.py,sha256=lkIx22ICIb4wn3-FxFWq2F2YcSZzBlLMgj85j9DevGI,26168
|
|
4
|
+
kite/conversation.py,sha256=ZJ8moX3ytJ4GlKbLJNwCOEZXOdbSmjNfcww1Wy32rmo,4367
|
|
5
|
+
kite/core.py,sha256=YUyFhRP3K5opV24_SS2KC4I464hqg9bvQqZgQq4lbvk,39908
|
|
6
|
+
kite/data_loaders.py,sha256=BQ-23snclo0ZmThfJS8wjEAYb_SgpyamZdKXNnkF3bk,3981
|
|
7
|
+
kite/embedding_providers.py,sha256=B1_KIAscldIcHInaapWpERe5gUlBqijr6j3d-hTwoxk,11340
|
|
8
|
+
kite/llm_providers.py,sha256=2UmyoB3REZFE8nOBFjnhcKbcXLDDEkQpbUB-KiVSAaA,46043
|
|
9
|
+
kite/monitoring.py,sha256=C1ZLI1WOHDcl5HzEpvIbjCOhCI3VUWmhNvgzDBYz2wk,19011
|
|
10
|
+
kite/observers.py,sha256=aZPN_tTYB5oSwseRjx4B-8eGQ28gXMShiDRCcpIoxpc,4030
|
|
11
|
+
kite/persistence.py,sha256=R2-FIkQmKp2CK3-U3pPsu1OGIFxW9SUZEmPw-Jnyzwo,1442
|
|
12
|
+
kite/pipeline_manager.py,sha256=NF24GQGwOyhU0hUpHpx6uyN4aQV5SsTJElvjGcog4BQ,458
|
|
13
|
+
kite/tool.py,sha256=xj-ROMAzgg3-GzsuDnNai-gdCIYQY15Ykm7hEFzx848,6717
|
|
14
|
+
kite/tool_registry.py,sha256=sIqEz4AAY4jpCb-upHgYI90yPN-Kqj5YQ-SCpu28HNI,2618
|
|
15
|
+
kite/tools_manager.py,sha256=2FCRlWB2V067-mgO38nw9xrfLAx1Hg8NgKVCMyFYM7k,969
|
|
16
|
+
kite/agents/__init__.py,sha256=J6mKjqdbAnpBsYQVMH-OE_DKOb85SCoRJp2SWiUC-7A,62
|
|
17
|
+
kite/agents/plan_execute.py,sha256=1Wnubl-3y-SsnkkH0LfqAPUDJUW1nJSB0gFR3b_CL64,7023
|
|
18
|
+
kite/agents/react_agent.py,sha256=p1-FshoKYda5KfFD6uUu-FRngY_IHe7fCy12ZLWfTbs,23263
|
|
19
|
+
kite/agents/reflective_agent.py,sha256=4fmr7fE87OUd3dMw5Q1Er8KZsWqd70jhUe3Ri4YqARE,3753
|
|
20
|
+
kite/agents/rewoo.py,sha256=GqnUHxWhhTV7fgd2bwS9g0aZ3e8p3VHSElULn9WgB8Q,4293
|
|
21
|
+
kite/agents/tot.py,sha256=4dtmJBXz3du7EtbvNOUG00evCblAFs7uTID9oDAcR2w,5619
|
|
22
|
+
kite/memory/__init__.py,sha256=8YSe81QRhzJ9-DCD4BXxCj67CcKpol7wPnCrhRgtJcA,200
|
|
23
|
+
kite/memory/advanced_rag.py,sha256=hsjtfzUbtdyJBbDXckDkfezY3mIXHnQ_ZywGGuxKAoE,13313
|
|
24
|
+
kite/memory/graph_rag.py,sha256=mg-zpNRq5HVtoqB1BRgfj9bNXUJQzVhaYNgm40-k6Lk,24343
|
|
25
|
+
kite/memory/session_memory.py,sha256=erVhbCIIk5JphTsbby44TwNq5ziSXcRHO6vTTnWMEmI,14107
|
|
26
|
+
kite/memory/vector_memory.py,sha256=-BkthLm7XgetkJp6DWiGv-mp1Rbmc2M7aYuTyS-Ua24,23026
|
|
27
|
+
kite/optimization/__init__.py,sha256=OVKEpz5Wm8XgVeofSCidBZCNs1AknGyT2dlRSBsXGhM,183
|
|
28
|
+
kite/optimization/resource_router.py,sha256=f5xGoBhG79WlP9dZhYi5u25xm1BLw8Ri-H8lvSzqRiA,3541
|
|
29
|
+
kite/pipeline/__init__.py,sha256=Cc6KniFiv6HOHAx2HUdoRrqKUxyFjPc468cIY3JwN-k,195
|
|
30
|
+
kite/pipeline/deterministic_pipeline.py,sha256=90HbYvtPG-Qq2sYFyk6ScHq4pNeK_imHSo21aKqi9gQ,13689
|
|
31
|
+
kite/pipeline/reactive_pipeline.py,sha256=L-v42fwadkU0XjRNoC3NnRidVx9c9qfhs5wDsaQWPys,6766
|
|
32
|
+
kite/routing/__init__.py,sha256=wGOvU8eQ8Z_3B8FtdLKB0WYwejBs54p2_iK9YmYQ-yk,219
|
|
33
|
+
kite/routing/aggregator_router.py,sha256=uJjzt0Hs6fRo_i-iGZbw0jnk0h8i6p5wQisJBophdl0,11240
|
|
34
|
+
kite/routing/llm_router.py,sha256=btFQ6QjY3WrS-XKc-D4ZcL_ZvRSfJHyb2e_cb-Bv7jk,5375
|
|
35
|
+
kite/routing/semantic_router.py,sha256=D0j2rZwmncasBxCzzxj0mTAA0Fz1E22pbi0Q9JB3oXU,7866
|
|
36
|
+
kite/safety/__init__.py,sha256=cxEoK8DDutUYiWgiZg39ydDALrxMmoX-0GfTp2ajDAI,344
|
|
37
|
+
kite/safety/circuit_breaker.py,sha256=GupFhThpNT6h1zWFXKsrZ7QP1YECGBIxUuD48mYp1WU,11303
|
|
38
|
+
kite/safety/guardrails.py,sha256=rikw05BKO_gxaVLTBoW3vVvK0csQP6NuaZpLcqjpBUM,3095
|
|
39
|
+
kite/safety/idempotency_manager.py,sha256=3ujRVwiyAZM9CHHmqziy_7VQUckFq-hZI0g5Gy_dTW8,9336
|
|
40
|
+
kite/safety/kill_switch.py,sha256=_YqXyHPqShO-v-OuRZNrFWHBG7V70rBqaqJaPLDbMFU,2827
|
|
41
|
+
kite/tools/__init__.py,sha256=X2T8Z0jkXvUEZhqpadL4o12OY2UjBjHTBnyj8iH4YME,449
|
|
42
|
+
kite/tools/code_execution.py,sha256=410ykFhTOWBM7aaeTzO0eez_U0AQzJbT87FWEKt8VGw,1813
|
|
43
|
+
kite/tools/search.py,sha256=7d_Bv3nclPomB-EwZdup5M6WSi9dw6DCX-TDhFGmzEI,3537
|
|
44
|
+
kite/tools/system_tools.py,sha256=w3P7SA3m610T2TmnQSFdzkPsuiBkPZMQyaHHN7p84ac,1821
|
|
45
|
+
kite/tools/contrib/__init__.py,sha256=AV0NHfrDbbTpKsE_Ho1kYWNhpYbS7disQM2iRR_HQNc,496
|
|
46
|
+
kite/tools/contrib/calculator.py,sha256=bDzQzDLiZmT5fbU5YOXAnTM2YbTDlr0CcgwOBDn-ULs,805
|
|
47
|
+
kite/tools/contrib/datetime_utils.py,sha256=n-VruusjgRj3P_lhe_7g0_I5iZWwZcRzlAGSvoNU-D4,422
|
|
48
|
+
kite/tools/contrib/linkedin.py,sha256=I11SLVpxB8oW9k7ZYeIUTRMHfaLQUDQeq9qoKG8iVHU,21135
|
|
49
|
+
kite/tools/contrib/web_search.py,sha256=zjCW82qmbKWp3Av5211ULvxlpQrAigB3nGD0jMvvweY,691
|
|
50
|
+
kite/tools/mcp/__init__.py,sha256=k-JRa33keVw4hZPA3xHRHiW62f0gOra1apYMHjcuEgg,1011
|
|
51
|
+
kite/tools/mcp/database_mcp.py,sha256=66q8yZpfxp3meW00_1mWccUd_Flzcy7cxi4IiC4qA2U,10651
|
|
52
|
+
kite/tools/mcp/gdrive_mcp_server.py,sha256=lWOVVRZltyaVQKd5nJeENdZ6j-xc-6RGlOvutG1vFWY,16550
|
|
53
|
+
kite/tools/mcp/gmail_mcp_server.py,sha256=ip5RVBSxy0NT6BxruvmOv439D2AAqTi9N2JNXMhRB1c,19176
|
|
54
|
+
kite/tools/mcp/postgres_mcp_server.py,sha256=qUlqgCbAale3W2P6z5sptUrEX0qhm3y46wcSXTHEk3I,16114
|
|
55
|
+
kite/tools/mcp/slack_mcp_server.py,sha256=toLeOB5Jn3O5u5Xj7J2S8EUb_bacTgF4DJGDQMsqZVc,16281
|
|
56
|
+
kite/tools/mcp/stripe_mcp_server.py,sha256=nso7LMIiSXGYiZR42mY62qYfMt9z0RA8dJ_R6bC2J_s,8143
|
|
57
|
+
kite_agent-0.1.0.dist-info/licenses/LICENSE,sha256=hBkUlTtmVPdL7RV0feK55i6vJJfbW3y1ydVVQU7duRg,1069
|
|
58
|
+
kite_agent-0.1.0.dist-info/METADATA,sha256=xQoHTje2XR4Q6LkQIiqvGMFM81ecLoPx8MhxXaiaOAQ,18618
|
|
59
|
+
kite_agent-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
60
|
+
kite_agent-0.1.0.dist-info/top_level.txt,sha256=qod_sVyl6bgLyrPcOnWKltTIiJvBnrgo-Eircg2Zp9c,5
|
|
61
|
+
kite_agent-0.1.0.dist-info/RECORD,,
|