idun-agent-engine 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.
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""Idun Agent Engine - A framework for building and deploying conversational AI agents.
|
|
2
|
+
|
|
3
|
+
This Engine provides a unified interface for different agent frameworks (LangGraph, CrewAI, etc.)
|
|
4
|
+
and automatically generates a production-ready FastAPI server for your agents.
|
|
5
|
+
|
|
6
|
+
Quick Start:
|
|
7
|
+
from idun_agent_engine import ConfigBuilder, create_app, run_server
|
|
8
|
+
|
|
9
|
+
# Method 1: Using ConfigBuilder (Recommended)
|
|
10
|
+
config = (ConfigBuilder()
|
|
11
|
+
.with_langgraph_agent(name="My Agent", graph_definition="agent.py:graph")
|
|
12
|
+
.build())
|
|
13
|
+
app = create_app(engine_config=config)
|
|
14
|
+
run_server(app)
|
|
15
|
+
|
|
16
|
+
# Method 2: Using YAML config file
|
|
17
|
+
app = create_app(config_path="config.yaml")
|
|
18
|
+
run_server(app, port=8000)
|
|
19
|
+
|
|
20
|
+
# Method 3: One-liner from config file
|
|
21
|
+
from idun_agent_engine.core.server_runner import run_server_from_config
|
|
22
|
+
run_server_from_config("config.yaml")
|
|
23
|
+
|
|
24
|
+
For more advanced usage, see the documentation.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
# Version information - import from separate module to avoid circular imports
|
|
28
|
+
from ._version import __version__
|
|
29
|
+
from .agent.base import BaseAgent
|
|
30
|
+
from .core.app_factory import create_app
|
|
31
|
+
from .core.config_builder import ConfigBuilder
|
|
32
|
+
from .core.server_runner import (
|
|
33
|
+
run_server,
|
|
34
|
+
run_server_from_builder,
|
|
35
|
+
run_server_from_config,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
# Main public API
|
|
39
|
+
__all__ = [
|
|
40
|
+
"create_app",
|
|
41
|
+
"run_server",
|
|
42
|
+
"run_server_from_config",
|
|
43
|
+
"run_server_from_builder",
|
|
44
|
+
"ConfigBuilder",
|
|
45
|
+
"BaseAgent",
|
|
46
|
+
"__version__",
|
|
47
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Marker file to indicate that this package is PEP 561 typed
|
|
@@ -0,0 +1,317 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: idun-agent-engine
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Python SDK and runtime to serve AI agents with FastAPI, LangGraph, and observability.
|
|
5
|
+
License: MIT
|
|
6
|
+
Keywords: agents,langgraph,fastapi,sdk,llm,observability
|
|
7
|
+
Author: Geoffrey HARRAZI
|
|
8
|
+
Author-email: geoffreyharrazi@gmail.com
|
|
9
|
+
Requires-Python: >=3.13,<3.14
|
|
10
|
+
Classifier: Framework :: FastAPI
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Classifier: Typing :: Typed
|
|
18
|
+
Requires-Dist: ag-ui-protocol (>=0.1.8,<0.2.0)
|
|
19
|
+
Requires-Dist: aiosqlite (>=0.21.0,<0.22.0)
|
|
20
|
+
Requires-Dist: arize-phoenix (>=11.22.0,<12.0.0)
|
|
21
|
+
Requires-Dist: arize-phoenix-otel (>=0.2.0,<1.0.0)
|
|
22
|
+
Requires-Dist: fastapi (>=0.116.1,<0.117.0)
|
|
23
|
+
Requires-Dist: google-adk (>=1.9.0,<2.0.0)
|
|
24
|
+
Requires-Dist: httpx (>=0.28.1,<0.29.0)
|
|
25
|
+
Requires-Dist: langchain (>=0.3.27,<0.4.0)
|
|
26
|
+
Requires-Dist: langchain-core (>=0.3.72,<0.4.0)
|
|
27
|
+
Requires-Dist: langchain-google-vertexai (>=2.0.27,<3.0.0)
|
|
28
|
+
Requires-Dist: langfuse (>=3.2.2,<4.0.0)
|
|
29
|
+
Requires-Dist: langgraph (>=0.6.3,<0.7.0)
|
|
30
|
+
Requires-Dist: langgraph-checkpoint-sqlite (>=2.0.11,<3.0.0)
|
|
31
|
+
Requires-Dist: openinference-instrumentation-langchain (>=0.1.13,<1.0.0)
|
|
32
|
+
Requires-Dist: pydantic (>=2.11.7,<3.0.0)
|
|
33
|
+
Requires-Dist: streamlit (>=1.47.1,<2.0.0)
|
|
34
|
+
Requires-Dist: uvicorn (>=0.35.0,<0.36.0)
|
|
35
|
+
Project-URL: Documentation, https://github.com/geoffreyharrazi/idun-agent-manager/tree/main/libs/idun_agent_engine
|
|
36
|
+
Project-URL: Homepage, https://github.com/geoffreyharrazi/idun-agent-manager
|
|
37
|
+
Project-URL: Issues, https://github.com/geoffreyharrazi/idun-agent-manager/issues
|
|
38
|
+
Project-URL: Repository, https://github.com/geoffreyharrazi/idun-agent-manager
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
# Idun Agent Engine - User Guide
|
|
42
|
+
|
|
43
|
+
The Idun Agent Engine provides a simple, powerful way to turn your conversational AI agents into production-ready web services. With just a few lines of code, you can expose your LangGraph, CrewAI, or custom agents through a FastAPI server with built-in features like streaming, persistence, and monitoring.
|
|
44
|
+
|
|
45
|
+
## 🚀 Quick Start
|
|
46
|
+
|
|
47
|
+
### Installation
|
|
48
|
+
```bash
|
|
49
|
+
pip install idun-agent-engine
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Basic Usage
|
|
53
|
+
|
|
54
|
+
```python
|
|
55
|
+
from idun_agent_engine import create_app, run_server
|
|
56
|
+
|
|
57
|
+
# Create your FastAPI app with your agent
|
|
58
|
+
app = create_app(config_path="config.yaml")
|
|
59
|
+
|
|
60
|
+
# Run the server
|
|
61
|
+
run_server(app, port=8000)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
That's it! Your agent is now running at `http://localhost:8000` with full API documentation at `http://localhost:8000/docs`.
|
|
65
|
+
|
|
66
|
+
## 📋 Configuration
|
|
67
|
+
|
|
68
|
+
### Option 1: YAML Configuration File
|
|
69
|
+
|
|
70
|
+
Create a `config.yaml` file:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
engine:
|
|
74
|
+
api:
|
|
75
|
+
port: 8000
|
|
76
|
+
telemetry:
|
|
77
|
+
provider: "langfuse"
|
|
78
|
+
|
|
79
|
+
agent:
|
|
80
|
+
type: "langgraph"
|
|
81
|
+
config:
|
|
82
|
+
name: "My Awesome Agent"
|
|
83
|
+
graph_definition: "my_agent.py:graph"
|
|
84
|
+
checkpointer:
|
|
85
|
+
type: "sqlite"
|
|
86
|
+
db_url: "sqlite:///agent.db"
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Option 2: Programmatic Configuration
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from idun_agent_engine import ConfigBuilder, create_app, run_server
|
|
93
|
+
|
|
94
|
+
config = (ConfigBuilder()
|
|
95
|
+
.with_api_port(8080)
|
|
96
|
+
.with_langgraph_agent(
|
|
97
|
+
name="My Agent",
|
|
98
|
+
graph_definition="my_agent.py:graph",
|
|
99
|
+
sqlite_checkpointer="agent.db")
|
|
100
|
+
.build())
|
|
101
|
+
|
|
102
|
+
app = create_app(config_dict=config)
|
|
103
|
+
run_server(app)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## 🤖 Supported Agent Types
|
|
107
|
+
|
|
108
|
+
### LangGraph Agents
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
# Your LangGraph agent file (my_agent.py)
|
|
112
|
+
from langgraph.graph import StateGraph, END
|
|
113
|
+
from typing import TypedDict
|
|
114
|
+
|
|
115
|
+
class AgentState(TypedDict):
|
|
116
|
+
messages: list
|
|
117
|
+
|
|
118
|
+
def my_node(state):
|
|
119
|
+
# Your agent logic here
|
|
120
|
+
return {"messages": [("ai", "Hello from LangGraph!")]}
|
|
121
|
+
|
|
122
|
+
graph = StateGraph(AgentState)
|
|
123
|
+
graph.add_node("agent", my_node)
|
|
124
|
+
graph.set_entry_point("agent")
|
|
125
|
+
graph.add_edge("agent", END)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Future Agent Types
|
|
129
|
+
- CrewAI agents (coming soon)
|
|
130
|
+
- AutoGen agents (coming soon)
|
|
131
|
+
- Custom agent implementations
|
|
132
|
+
|
|
133
|
+
## 🌐 API Endpoints
|
|
134
|
+
|
|
135
|
+
Once your server is running, you get these endpoints automatically:
|
|
136
|
+
|
|
137
|
+
### POST `/agent/invoke`
|
|
138
|
+
Send a single message and get a complete response:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
curl -X POST "http://localhost:8000/agent/invoke" \
|
|
142
|
+
-H "Content-Type: application/json" \
|
|
143
|
+
-d '{
|
|
144
|
+
"query": "Hello, how are you?",
|
|
145
|
+
"session_id": "user-123"
|
|
146
|
+
}'
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### POST `/agent/stream`
|
|
150
|
+
Stream responses in real-time:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
curl -X POST "http://localhost:8000/agent/stream" \
|
|
154
|
+
-H "Content-Type: application/json" \
|
|
155
|
+
-d '{
|
|
156
|
+
"query": "Tell me a story",
|
|
157
|
+
"session_id": "user-123"
|
|
158
|
+
}'
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### GET `/health`
|
|
162
|
+
Health check for monitoring:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
curl "http://localhost:8000/health"
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## 🔧 Advanced Usage
|
|
169
|
+
|
|
170
|
+
### Development Mode
|
|
171
|
+
```python
|
|
172
|
+
# Enable auto-reload for development
|
|
173
|
+
run_server(app, reload=True)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Production Deployment
|
|
177
|
+
```python
|
|
178
|
+
# Run with multiple workers for production
|
|
179
|
+
run_server(app, workers=4, host="0.0.0.0", port=8000)
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### One-Line Server
|
|
183
|
+
```python
|
|
184
|
+
from idun_agent_engine.core.server_runner import run_server_from_config
|
|
185
|
+
|
|
186
|
+
# Create and run server in one call
|
|
187
|
+
run_server_from_config("config.yaml", port=8080, reload=True)
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Custom FastAPI Configuration
|
|
191
|
+
```python
|
|
192
|
+
from idun_agent_engine import create_app
|
|
193
|
+
from fastapi.middleware.cors import CORSMiddleware
|
|
194
|
+
|
|
195
|
+
app = create_app("config.yaml")
|
|
196
|
+
|
|
197
|
+
# Add custom middleware
|
|
198
|
+
app.add_middleware(
|
|
199
|
+
CORSMiddleware,
|
|
200
|
+
allow_origins=["*"],
|
|
201
|
+
allow_methods=["*"],
|
|
202
|
+
allow_headers=["*"],
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
# Add custom routes
|
|
206
|
+
@app.get("/custom")
|
|
207
|
+
def custom_endpoint():
|
|
208
|
+
return {"message": "Custom endpoint"}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
## 🛠️ Configuration Reference
|
|
212
|
+
|
|
213
|
+
### Engine Configuration
|
|
214
|
+
```yaml
|
|
215
|
+
engine:
|
|
216
|
+
api:
|
|
217
|
+
port: 8000 # Server port
|
|
218
|
+
telemetry:
|
|
219
|
+
provider: "langfuse" # Telemetry provider
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### LangGraph Agent Configuration
|
|
223
|
+
```yaml
|
|
224
|
+
agent:
|
|
225
|
+
type: "langgraph"
|
|
226
|
+
config:
|
|
227
|
+
name: "Agent Name" # Human-readable name
|
|
228
|
+
graph_definition: "path.py:graph" # Path to your graph
|
|
229
|
+
checkpointer: # Optional persistence
|
|
230
|
+
type: "sqlite"
|
|
231
|
+
db_url: "sqlite:///agent.db"
|
|
232
|
+
store: # Optional store (future)
|
|
233
|
+
type: "memory"
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## 📚 Examples
|
|
237
|
+
|
|
238
|
+
Check out the `examples/` directory for complete working examples:
|
|
239
|
+
|
|
240
|
+
- **Basic LangGraph Agent**: Simple question-answering agent
|
|
241
|
+
- **ConfigBuilder Usage**: Programmatic configuration
|
|
242
|
+
- **Custom Middleware**: Adding authentication and CORS
|
|
243
|
+
- **Production Setup**: Multi-worker deployment configuration
|
|
244
|
+
|
|
245
|
+
## 🔍 Validation and Debugging
|
|
246
|
+
|
|
247
|
+
```python
|
|
248
|
+
from idun_agent_engine.utils.validation import validate_config_dict, diagnose_setup
|
|
249
|
+
|
|
250
|
+
# Validate your configuration
|
|
251
|
+
config = {...}
|
|
252
|
+
errors = validate_config_dict(config)
|
|
253
|
+
if errors:
|
|
254
|
+
print("Configuration errors:", errors)
|
|
255
|
+
|
|
256
|
+
# Diagnose your setup
|
|
257
|
+
diagnosis = diagnose_setup()
|
|
258
|
+
print("System diagnosis:", diagnosis)
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
## 🚀 Deployment
|
|
262
|
+
|
|
263
|
+
### Docker
|
|
264
|
+
```dockerfile
|
|
265
|
+
FROM python:3.11-slim
|
|
266
|
+
|
|
267
|
+
COPY requirements.txt .
|
|
268
|
+
RUN pip install -r requirements.txt
|
|
269
|
+
|
|
270
|
+
COPY . .
|
|
271
|
+
|
|
272
|
+
CMD ["python", "-m", "idun_agent_engine", "run", "config.yaml"]
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Cloud Platforms
|
|
276
|
+
- Heroku: `Procfile` with `web: python main.py`
|
|
277
|
+
- Railway: Deploy with one click
|
|
278
|
+
- AWS Lambda: Use with Mangum adapter
|
|
279
|
+
- Google Cloud Run: Deploy Docker container
|
|
280
|
+
|
|
281
|
+
## 🤝 Contributing
|
|
282
|
+
|
|
283
|
+
The Idun Agent Engine is designed to be extensible. To add support for new agent frameworks:
|
|
284
|
+
|
|
285
|
+
1. Implement the `BaseAgent` interface
|
|
286
|
+
2. Add configuration models for your agent type
|
|
287
|
+
3. Register your agent in the factory
|
|
288
|
+
4. Submit a pull request!
|
|
289
|
+
|
|
290
|
+
## 📖 Documentation
|
|
291
|
+
|
|
292
|
+
- [Full API Documentation](https://docs.idun-agent-engine.com)
|
|
293
|
+
- [Agent Framework Guide](https://docs.idun-agent-engine.com/frameworks)
|
|
294
|
+
- [Deployment Guide](https://docs.idun-agent-engine.com/deployment)
|
|
295
|
+
- [Contributing Guide](https://docs.idun-agent-engine.com/contributing)
|
|
296
|
+
|
|
297
|
+
## 📄 License
|
|
298
|
+
|
|
299
|
+
MIT License - see LICENSE file for details.
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
### Release & Publishing
|
|
304
|
+
|
|
305
|
+
This package is built with Poetry. To publish a new release to PyPI:
|
|
306
|
+
|
|
307
|
+
1. Update version in `pyproject.toml`.
|
|
308
|
+
2. Commit and tag with the pattern `idun-agent-engine-vX.Y.Z`.
|
|
309
|
+
3. Push the tag to GitHub. The `Publish idun-agent-engine` workflow will build and publish to PyPI using `PYPI_API_TOKEN` secret.
|
|
310
|
+
|
|
311
|
+
Manual build (optional):
|
|
312
|
+
|
|
313
|
+
```bash
|
|
314
|
+
cd libs/idun_agent_engine
|
|
315
|
+
poetry build
|
|
316
|
+
```
|
|
317
|
+
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
idun_agent_engine/__init__.py,sha256=26POsr5dcEKjaasCyghn5xq1iBnEzyripAj-OaKhFrI,1471
|
|
2
|
+
idun_agent_engine/_version.py,sha256=6TpxMitT_P6rTobGO07lWrTBf1CNK8giofFXhNSBnS0,72
|
|
3
|
+
idun_agent_engine/py.typed,sha256=cJop7713r6RxY0ks5pWo7USgH7UFlZsBhyByVzA4q_o,61
|
|
4
|
+
idun_agent_engine-0.1.0.dist-info/METADATA,sha256=2he27WE8SahXhQPOj5rTQDLJuCtc535x3c-IC4zozzU,8306
|
|
5
|
+
idun_agent_engine-0.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
|
6
|
+
idun_agent_engine-0.1.0.dist-info/RECORD,,
|