idun-agent-engine 0.3.4__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 (60) hide show
  1. idun_agent_engine/__init__.py +24 -0
  2. idun_agent_engine/_version.py +3 -0
  3. idun_agent_engine/agent/__init__.py +10 -0
  4. idun_agent_engine/agent/adk/__init__.py +5 -0
  5. idun_agent_engine/agent/adk/adk.py +296 -0
  6. idun_agent_engine/agent/base.py +112 -0
  7. idun_agent_engine/agent/haystack/__init__.py +9 -0
  8. idun_agent_engine/agent/haystack/haystack.py +274 -0
  9. idun_agent_engine/agent/haystack/haystack_model.py +13 -0
  10. idun_agent_engine/agent/haystack/utils.py +13 -0
  11. idun_agent_engine/agent/langgraph/__init__.py +7 -0
  12. idun_agent_engine/agent/langgraph/langgraph.py +553 -0
  13. idun_agent_engine/core/__init__.py +11 -0
  14. idun_agent_engine/core/app_factory.py +73 -0
  15. idun_agent_engine/core/config_builder.py +657 -0
  16. idun_agent_engine/core/engine_config.py +21 -0
  17. idun_agent_engine/core/server_runner.py +145 -0
  18. idun_agent_engine/guardrails/__init__.py +0 -0
  19. idun_agent_engine/guardrails/base.py +24 -0
  20. idun_agent_engine/guardrails/guardrails_hub/guardrails_hub.py +101 -0
  21. idun_agent_engine/guardrails/guardrails_hub/utils.py +1 -0
  22. idun_agent_engine/mcp/__init__.py +5 -0
  23. idun_agent_engine/mcp/helpers.py +97 -0
  24. idun_agent_engine/mcp/registry.py +109 -0
  25. idun_agent_engine/observability/__init__.py +17 -0
  26. idun_agent_engine/observability/base.py +172 -0
  27. idun_agent_engine/observability/gcp_logging/__init__.py +0 -0
  28. idun_agent_engine/observability/gcp_logging/gcp_logging_handler.py +52 -0
  29. idun_agent_engine/observability/gcp_trace/__init__.py +0 -0
  30. idun_agent_engine/observability/gcp_trace/gcp_trace_handler.py +116 -0
  31. idun_agent_engine/observability/langfuse/__init__.py +5 -0
  32. idun_agent_engine/observability/langfuse/langfuse_handler.py +79 -0
  33. idun_agent_engine/observability/phoenix/__init__.py +5 -0
  34. idun_agent_engine/observability/phoenix/phoenix_handler.py +65 -0
  35. idun_agent_engine/observability/phoenix_local/__init__.py +5 -0
  36. idun_agent_engine/observability/phoenix_local/phoenix_local_handler.py +123 -0
  37. idun_agent_engine/py.typed +0 -0
  38. idun_agent_engine/server/__init__.py +5 -0
  39. idun_agent_engine/server/dependencies.py +52 -0
  40. idun_agent_engine/server/lifespan.py +106 -0
  41. idun_agent_engine/server/routers/__init__.py +5 -0
  42. idun_agent_engine/server/routers/agent.py +204 -0
  43. idun_agent_engine/server/routers/agui.py +47 -0
  44. idun_agent_engine/server/routers/base.py +114 -0
  45. idun_agent_engine/server/server_config.py +8 -0
  46. idun_agent_engine/templates/__init__.py +1 -0
  47. idun_agent_engine/templates/correction.py +65 -0
  48. idun_agent_engine/templates/deep_research.py +40 -0
  49. idun_agent_engine/templates/translation.py +70 -0
  50. idun_agent_engine-0.3.4.dist-info/METADATA +335 -0
  51. idun_agent_engine-0.3.4.dist-info/RECORD +60 -0
  52. idun_agent_engine-0.3.4.dist-info/WHEEL +4 -0
  53. idun_agent_engine-0.3.4.dist-info/entry_points.txt +2 -0
  54. idun_platform_cli/__init__.py +0 -0
  55. idun_platform_cli/groups/__init__.py +0 -0
  56. idun_platform_cli/groups/agent/__init__.py +0 -0
  57. idun_platform_cli/groups/agent/main.py +16 -0
  58. idun_platform_cli/groups/agent/package.py +70 -0
  59. idun_platform_cli/groups/agent/serve.py +107 -0
  60. idun_platform_cli/main.py +14 -0
@@ -0,0 +1,335 @@
1
+ Metadata-Version: 2.4
2
+ Name: idun-agent-engine
3
+ Version: 0.3.4
4
+ Summary: Python SDK and runtime to serve AI agents with FastAPI, LangGraph, and observability.
5
+ Project-URL: Homepage, https://github.com/geoffreyharrazi/idun-agent-platform
6
+ Project-URL: Repository, https://github.com/geoffreyharrazi/idun-agent-platform
7
+ Project-URL: Documentation, https://github.com/geoffreyharrazi/idun-agent-platform/tree/main/libs/idun_agent_engine
8
+ Project-URL: Issues, https://github.com/geoffreyharrazi/idun-agent-platform/issues
9
+ Author-email: Geoffrey HARRAZI <geoffreyharrazi@gmail.com>
10
+ License-Expression: MIT
11
+ Keywords: agents,fastapi,langgraph,llm,observability,sdk
12
+ Classifier: Framework :: FastAPI
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: <3.14,>=3.12
22
+ Requires-Dist: ag-ui-adk<0.4.0,>=0.3.4
23
+ Requires-Dist: ag-ui-langgraph<0.1.0,>=0.0.20
24
+ Requires-Dist: ag-ui-protocol<0.2.0,>=0.1.8
25
+ Requires-Dist: aiosqlite<0.22.0,>=0.21.0
26
+ Requires-Dist: arize-phoenix-otel<1.0.0,>=0.2.0
27
+ Requires-Dist: arize-phoenix<12.0.0,>=11.22.0
28
+ Requires-Dist: click>=8.2.0
29
+ Requires-Dist: copilotkit<0.2.0,>=0.1.72
30
+ Requires-Dist: deepagents<1.0.0,>=0.2.8
31
+ Requires-Dist: fastapi<0.116.0,>=0.115.0
32
+ Requires-Dist: google-adk<2.0.0,>=1.19.0
33
+ Requires-Dist: google-cloud-logging<4.0.0,>=3.10.0
34
+ Requires-Dist: guardrails-ai<0.8.0,>=0.7.0
35
+ Requires-Dist: httpx<0.29.0,>=0.28.1
36
+ Requires-Dist: idun-agent-schema<1.0.0,>=0.3.1
37
+ Requires-Dist: langchain-core<2.0.0,>=1.0.0
38
+ Requires-Dist: langchain-google-vertexai<4.0.0,>=2.0.27
39
+ Requires-Dist: langchain-mcp-adapters<0.2.0,>=0.1.0
40
+ Requires-Dist: langchain<2.0.0,>=1.0.0
41
+ Requires-Dist: langfuse-haystack>=2.3.0
42
+ Requires-Dist: langfuse<4.0.0,>=2.60.8
43
+ Requires-Dist: langgraph-checkpoint-postgres<4.0.0,>=3.0.0
44
+ Requires-Dist: langgraph-checkpoint-sqlite<4.0.0,>=3.0.0
45
+ Requires-Dist: langgraph<2.0.0,>=1.0.0
46
+ Requires-Dist: mcp<2.0.0,>=1.0.0
47
+ Requires-Dist: openinference-instrumentation-google-adk<1.0.0,>=0.1.0
48
+ Requires-Dist: openinference-instrumentation-guardrails<1.0.0,>=0.1.0
49
+ Requires-Dist: openinference-instrumentation-langchain<1.0.0,>=0.1.13
50
+ Requires-Dist: openinference-instrumentation-mcp<2.0.0,>=1.0.0
51
+ Requires-Dist: openinference-instrumentation-vertexai<1.0.0,>=0.1.0
52
+ Requires-Dist: opentelemetry-exporter-gcp-trace<2.0.0,>=1.6.0
53
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http<2.0.0,>=1.22.0
54
+ Requires-Dist: pydantic<3.0.0,>=2.11.7
55
+ Requires-Dist: python-dotenv>=1.1.1
56
+ Requires-Dist: sqlalchemy<3.0.0,>=2.0.36
57
+ Requires-Dist: streamlit<2.0.0,>=1.47.1
58
+ Requires-Dist: tavily-python<0.8.0,>=0.7.9
59
+ Requires-Dist: uvicorn<0.36.0,>=0.35.0
60
+ Description-Content-Type: text/markdown
61
+
62
+ # Idun Agent Engine
63
+
64
+ Turn any LangGraph-based agent into a production-grade API in minutes.
65
+
66
+ Idun Agent Engine is a lightweight runtime and SDK that wraps your agent with a FastAPI server, adds streaming, structured responses, config validation, and optional observability — with zero boilerplate. Use a YAML file or a fluent builder to configure and run.
67
+
68
+ ## Installation
69
+
70
+ ```bash
71
+ pip install idun-agent-engine
72
+ ```
73
+
74
+ - Requires Python 3.13
75
+ - Ships with FastAPI, Uvicorn, LangGraph, SQLite checkpointing, and optional observability hooks
76
+
77
+ ## Quickstart
78
+
79
+ ### 1) Minimal one-liner (from a YAML config)
80
+
81
+ ```python
82
+ from idun_agent_engine.core.server_runner import run_server_from_config
83
+
84
+ run_server_from_config("config.yaml")
85
+ ```
86
+
87
+ Example `config.yaml`:
88
+
89
+ ```yaml
90
+ server:
91
+ api:
92
+ port: 8000
93
+
94
+ agent:
95
+ type: "langgraph"
96
+ config:
97
+ name: "My Example LangGraph Agent"
98
+ graph_definition: "./examples/01_basic_config_file/example_agent.py:app"
99
+ # Optional: conversation persistence
100
+ checkpointer:
101
+ type: "sqlite"
102
+ db_url: "sqlite:///example_checkpoint.db"
103
+ # Optional: provider-agnostic observability
104
+ observability:
105
+ provider: langfuse # or phoenix
106
+ enabled: true
107
+ options:
108
+ host: ${LANGFUSE_HOST}
109
+ public_key: ${LANGFUSE_PUBLIC_KEY}
110
+ secret_key: ${LANGFUSE_SECRET_KEY}
111
+ run_name: "idun-langgraph-run"
112
+ ```
113
+
114
+ Run and open docs at `http://localhost:8000/docs`.
115
+
116
+ ### 2) Programmatic setup with the fluent builder
117
+
118
+ ```python
119
+ from pathlib import Path
120
+ from idun_agent_engine import ConfigBuilder, create_app, run_server
121
+
122
+ config = (
123
+ ConfigBuilder()
124
+ .with_api_port(8000)
125
+ .with_langgraph_agent(
126
+ name="Programmatic Example Agent",
127
+ graph_definition=str(Path("./examples/02_programmatic_config/smart_agent.py:app")),
128
+ sqlite_checkpointer="programmatic_example.db",
129
+ )
130
+ .build()
131
+ )
132
+
133
+ app = create_app(engine_config=config)
134
+ run_server(app, reload=True)
135
+ ```
136
+
137
+ ## Endpoints
138
+
139
+ All servers expose these by default:
140
+
141
+ - POST `/agent/invoke`: single request/response
142
+ - POST `/agent/stream`: server-sent events stream of `ag-ui` protocol events
143
+ - GET `/health`: service health with engine version
144
+ - GET `/`: root landing with links
145
+
146
+ Invoke example:
147
+
148
+ ```bash
149
+ curl -X POST "http://localhost:8000/agent/invoke" \
150
+ -H "Content-Type: application/json" \
151
+ -d '{"query": "Hello!", "session_id": "user-123"}'
152
+ ```
153
+
154
+ Stream example:
155
+
156
+ ```bash
157
+ curl -N -X POST "http://localhost:8000/agent/stream" \
158
+ -H "Content-Type: application/json" \
159
+ -d '{"query": "Tell me a story", "session_id": "user-123"}'
160
+ ```
161
+
162
+ ## LangGraph integration
163
+
164
+ Point the engine to a `StateGraph` variable in your file using `graph_definition`:
165
+
166
+ ```python
167
+ # examples/01_basic_config_file/example_agent.py
168
+ import operator
169
+ from typing import Annotated, TypedDict
170
+ from langgraph.graph import END, StateGraph
171
+
172
+ class AgentState(TypedDict):
173
+ messages: Annotated[list, operator.add]
174
+
175
+ def greeting_node(state):
176
+ user_message = state["messages"][-1] if state["messages"] else ""
177
+ return {"messages": [("ai", f"Hello! You said: '{user_message}'")]}
178
+
179
+ graph = StateGraph(AgentState)
180
+ graph.add_node("greet", greeting_node)
181
+ graph.set_entry_point("greet")
182
+ graph.add_edge("greet", END)
183
+
184
+ # This variable name is referenced by graph_definition
185
+ app = graph
186
+ ```
187
+
188
+ Then reference it in config:
189
+
190
+ ```yaml
191
+ agent:
192
+ type: "langgraph"
193
+ config:
194
+ graph_definition: "./examples/01_basic_config_file/example_agent.py:app"
195
+ ```
196
+
197
+ Behind the scenes, the engine:
198
+
199
+ - Validates config with Pydantic models
200
+ - Loads your `StateGraph` from disk
201
+ - Optionally wires a SQLite checkpointer via `langgraph.checkpoint.sqlite`
202
+ - Exposes `invoke` and `stream` endpoints
203
+ - Bridges LangGraph events to `ag-ui` stream events
204
+
205
+ ## Observability (optional)
206
+
207
+ Enable provider-agnostic observability via the `observability` block in your agent config. Today supports Langfuse and Arize Phoenix (OpenInference) patterns; more coming soon.
208
+
209
+ ```yaml
210
+ agent:
211
+ type: "langgraph"
212
+ config:
213
+ observability:
214
+ provider: langfuse # or phoenix
215
+ enabled: true
216
+ options:
217
+ host: ${LANGFUSE_HOST}
218
+ public_key: ${LANGFUSE_PUBLIC_KEY}
219
+ secret_key: ${LANGFUSE_SECRET_KEY}
220
+ run_name: "idun-langgraph-run"
221
+ ```
222
+
223
+ ## Configuration reference
224
+
225
+ - `server.api.port` (int): HTTP port (default 8000)
226
+ - `agent.type` (enum): currently `langgraph` (CrewAI placeholder exists but not implemented)
227
+ - `agent.config.name` (str): human-readable name
228
+ - `agent.config.graph_definition` (str): absolute or relative `path/to/file.py:variable`
229
+ - `agent.config.checkpointer` (sqlite): `{ type: "sqlite", db_url: "sqlite:///file.db" }`
230
+ - `agent.config.observability` (optional): provider options as shown above
231
+ - `mcp_servers` (list, optional): collection of MCP servers that should be available to your agent runtime. Each entry matches the fields supported by `langchain-mcp-adapters` (name, transport, url/command, headers, etc.).
232
+
233
+ Config can be sourced by:
234
+
235
+ - `engine_config` (preferred): pass a validated `EngineConfig` to `create_app`
236
+ - `config_dict`: dict validated at runtime
237
+ - `config_path`: path to YAML; defaults to `config.yaml`
238
+
239
+ ### MCP Servers
240
+
241
+ You can mount MCP servers directly in your engine config. The engine will automatically
242
+ create a `MultiServerMCPClient` and expose it on `app.state.mcp_registry`.
243
+
244
+ ```yaml
245
+ mcp_servers:
246
+ - name: "math"
247
+ transport: "stdio"
248
+ command: "python"
249
+ args:
250
+ - "/path/to/math_server.py"
251
+ - name: "weather"
252
+ transport: "streamable_http"
253
+ url: "http://localhost:8000/mcp"
254
+ ```
255
+
256
+ Inside your FastAPI dependencies or handlers:
257
+
258
+ ```python
259
+ from idun_agent_engine.server.dependencies import get_mcp_registry
260
+
261
+ @router.get("/mcp/{server}/tools")
262
+ async def list_tools(server: str, registry = Depends(get_mcp_registry)):
263
+ return await registry.get_tools(server)
264
+ ```
265
+
266
+ Or outside of FastAPI:
267
+
268
+ ```python
269
+ from langchain_mcp_adapters.tools import load_mcp_tools
270
+
271
+ registry = app.state.mcp_registry
272
+ async with registry.get_session("math") as session:
273
+ tools = await load_mcp_tools(session)
274
+ ```
275
+
276
+ ## Examples
277
+
278
+ The `examples/` folder contains complete projects:
279
+
280
+ - `01_basic_config_file`: YAML config + simple agent
281
+ - `02_programmatic_config`: `ConfigBuilder` usage and advanced flows
282
+ - `03_minimal_setup`: one-line server from config
283
+
284
+ Run any example with Python 3.13 installed.
285
+
286
+ ## CLI and runtime helpers
287
+
288
+ Top-level imports for convenience:
289
+
290
+ ```python
291
+ from idun_agent_engine import (
292
+ create_app,
293
+ run_server,
294
+ run_server_from_config,
295
+ run_server_from_builder,
296
+ ConfigBuilder,
297
+ )
298
+ ```
299
+
300
+ - `create_app(...)` builds the FastAPI app and registers routes
301
+ - `run_server(app, ...)` runs with Uvicorn
302
+ - `run_server_from_config(path, ...)` loads config, builds app, and runs
303
+ - `run_server_from_builder(builder, ...)` builds from a builder and runs
304
+
305
+ ## Production notes
306
+
307
+ - Use a process manager (e.g., multiple Uvicorn workers behind a gateway). Note: `reload=True` is for development and incompatible with multi-worker mode.
308
+ - Mount behind a reverse proxy and enable TLS where appropriate.
309
+ - Persist conversations using the SQLite checkpointer in production or replace with a custom checkpointer when available.
310
+
311
+ ## Roadmap
312
+
313
+ - CrewAI adapter (placeholder exists, not yet implemented)
314
+ - Additional stores and checkpointers
315
+ - First-class CLI for `idun` commands
316
+
317
+ ## Contributing
318
+
319
+ Issues and PRs are welcome. See the repository:
320
+
321
+ - Repo: `https://github.com/geoffreyharrazi/idun-agent-platform`
322
+ - Package path: `libs/idun_agent_engine`
323
+ - Open an issue: `https://github.com/geoffreyharrazi/idun-agent-platform/issues`
324
+
325
+ Run locally:
326
+
327
+ ```bash
328
+ cd libs/idun_agent_engine
329
+ poetry install
330
+ poetry run pytest -q
331
+ ```
332
+
333
+ ## License
334
+
335
+ MIT — see `LICENSE` in the repo root.
@@ -0,0 +1,60 @@
1
+ idun_agent_engine/__init__.py,sha256=PhOL6foq5V0eXaoXw7xKUeCWXIWrOHrAFB8OuJnBqyM,550
2
+ idun_agent_engine/_version.py,sha256=Z-hDh5-bBX3-YmjcPv65QOTgYe4majrXwcs240OhBY8,72
3
+ idun_agent_engine/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ idun_agent_engine/agent/__init__.py,sha256=foyOoRdI_04q1b6f2A5EXEpWSCKjZxpgWMWrKcsHNl8,220
5
+ idun_agent_engine/agent/base.py,sha256=c-3gljSHQpm6aY0JNDmXkaPtcW55rXdsI8Cgv9l4bCs,3294
6
+ idun_agent_engine/agent/adk/__init__.py,sha256=jLV2Z9qQGZtBpF_0pQI1FRCPJ_J1G3Z6cEAzHnQyuu4,83
7
+ idun_agent_engine/agent/adk/adk.py,sha256=29YC5rgLjdod-CU3a2JqgAvzYcD5u2EY7pylozGNi9c,11375
8
+ idun_agent_engine/agent/haystack/__init__.py,sha256=y5ADrD8gWBeYIvV7tmu6OpPdJ8POHt-tyraIL7RkkWI,179
9
+ idun_agent_engine/agent/haystack/haystack.py,sha256=k4NAx_zTBO9uiExM9NtuDAN94H1lrCWtHf1GEWEN16g,10966
10
+ idun_agent_engine/agent/haystack/haystack_model.py,sha256=EtOYnsWRufcrQufTRMeB3V-rZVQqfnmwKwPsYGfZdCs,362
11
+ idun_agent_engine/agent/haystack/utils.py,sha256=sKRoPhzZWFw1NPsYwCockafzMBCCq3lGOrndbNE_C3M,609
12
+ idun_agent_engine/agent/langgraph/__init__.py,sha256=CoBdkp9P4livdy5B0bvj9o7ftoqKmXEr9cZv4TZLncs,107
13
+ idun_agent_engine/agent/langgraph/langgraph.py,sha256=vM5ppt0s_2izzZVbVXXGXGCVUGSN-GZhvQ5-6YbOgVM,22904
14
+ idun_agent_engine/core/__init__.py,sha256=F0DMDlWcSWS_1dvh3xMbrdcVvZRHVnoAFFgREuSJfBI,408
15
+ idun_agent_engine/core/app_factory.py,sha256=XiLrctFT_n8LP3flKFwJoJDbiWPiw98N9lbkpR8P1O0,2597
16
+ idun_agent_engine/core/config_builder.py,sha256=Q6f7lITqIHFlAfXEIfQvz_6s_GVFc4zVotOFF_YTFho,25641
17
+ idun_agent_engine/core/engine_config.py,sha256=IR8WhbenDstNSL7ORrUW8AnzgS3exFQxtwip66pFhcM,545
18
+ idun_agent_engine/core/server_runner.py,sha256=vLlgLQM-xyvFgJMgFW2eWZoN1oc0x9FGL6bH8WsF6O8,4897
19
+ idun_agent_engine/guardrails/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
+ idun_agent_engine/guardrails/base.py,sha256=vC554AbqOup9qjuOaTfG-w3fnd73J_7goMwab63jcIg,792
21
+ idun_agent_engine/guardrails/guardrails_hub/guardrails_hub.py,sha256=7fCFoL8soXVkFW6p-TUD6XyR5x3j3I2ekofUG__sXu8,3396
22
+ idun_agent_engine/guardrails/guardrails_hub/utils.py,sha256=bC6-MsCVF7xKTr48z7OzJJUeWvqAB7BiHeNTiKsme70,20
23
+ idun_agent_engine/mcp/__init__.py,sha256=tsX4sJa7UZD-lr8O1acMwDrdDWJc_hMlB9IrX1NH8Wk,255
24
+ idun_agent_engine/mcp/helpers.py,sha256=aFiLlk63pifBjGgctREFWxuSbb-um6QDOVpyikQ5NJ0,3224
25
+ idun_agent_engine/mcp/registry.py,sha256=K9-OLF_7FoKmyrwi65i6E3goZROHLRgISlF1yPwkEm8,3996
26
+ idun_agent_engine/observability/__init__.py,sha256=DCtK6b3xiX4dh0_8GBDOcSXQdcIJz2wTqqPa_ZFAES4,430
27
+ idun_agent_engine/observability/base.py,sha256=C6mY_ZafDEHkMz8_ZeaEh--pyYuzJYEUqhoJ0sVP2wY,5570
28
+ idun_agent_engine/observability/gcp_logging/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
+ idun_agent_engine/observability/gcp_logging/gcp_logging_handler.py,sha256=cMUKfukmSZhIdO2v5oWkqI2_c6umtYqlhzflnOeoq6A,1685
30
+ idun_agent_engine/observability/gcp_trace/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
31
+ idun_agent_engine/observability/gcp_trace/gcp_trace_handler.py,sha256=YBlUqUwPuOPi0yDNEy9x_g52nJBlSe9a0EEHDIHIr68,3898
32
+ idun_agent_engine/observability/langfuse/__init__.py,sha256=J8XcHV4aT1pF97k5EZiqrnYYPs9VjwfV5rUMihc5Pgk,128
33
+ idun_agent_engine/observability/langfuse/langfuse_handler.py,sha256=RP9MXiYDRe7zWTmZmzQBn6AjRn0y8jrBnWOaUUaMxNA,2795
34
+ idun_agent_engine/observability/phoenix/__init__.py,sha256=tEwJYijcvSGNhFW4QJmvBcTu1D0YVJkZRTmkNCGTteM,130
35
+ idun_agent_engine/observability/phoenix/phoenix_handler.py,sha256=lGqSq-L1vmoEhAr9rbWO3KlNX5HSgBhCKESHMdZ-AfY,2539
36
+ idun_agent_engine/observability/phoenix_local/__init__.py,sha256=m9dIw1GWGKAW4wP08jxA7j4yrOg0Nxq_08bwVh8YogE,146
37
+ idun_agent_engine/observability/phoenix_local/phoenix_local_handler.py,sha256=wjOZuMpAxdD5D33rzxycNEzFMunETpPnYjiHjbjz5GA,4252
38
+ idun_agent_engine/server/__init__.py,sha256=WaFektUsy37bNg2niAUy_TykzStukgWPnxC-t49CEwo,177
39
+ idun_agent_engine/server/dependencies.py,sha256=MVH8STOQ8wu-iYE_28y5dvw5FGT5PX0uQl0ldkpxw6Y,2080
40
+ idun_agent_engine/server/lifespan.py,sha256=whWv7Gsl3CI_C13vWxl4wODOzlxIPRKSe58-_8B4zI8,3840
41
+ idun_agent_engine/server/server_config.py,sha256=RYA7Y0c5aRw_WXaX8svFUIEtTPqzn3o-WQRm2p52C6g,213
42
+ idun_agent_engine/server/routers/__init__.py,sha256=BgNzSVvHtGPGn5zhXhomwpKlDYBkeFi7xCbdcWVOgc8,102
43
+ idun_agent_engine/server/routers/agent.py,sha256=HQkPRYFE5CadpzEQ3La8kK7lt5QUVuZTk-rzhZg9EsU,8995
44
+ idun_agent_engine/server/routers/agui.py,sha256=Z1G4fuo57MazQWfp7ao8QZ1or2H9BXLS_JB1nFPXAkE,1891
45
+ idun_agent_engine/server/routers/base.py,sha256=wICOXCokCIRjmHuDPDTWqeXqOVPes1CtDtiR_HvtsF0,3756
46
+ idun_agent_engine/templates/__init__.py,sha256=xxbJZXaX6VEm_UrqzAOQcuujpEji5yqYzwQfwiqig8o,31
47
+ idun_agent_engine/templates/correction.py,sha256=qApH4W99K31maxNrGf0hPVe_Wd4xjYjJrEKlu7PbRpw,1823
48
+ idun_agent_engine/templates/deep_research.py,sha256=j4WypBkBz7V3EG-U8vawfNXDNhcCf2QiEK0veI4M68s,1077
49
+ idun_agent_engine/templates/translation.py,sha256=vjp1yEyhDMFO4nEbq5WG7LAA7nLrhVAjznOkV7ob_Ss,2149
50
+ idun_platform_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
51
+ idun_platform_cli/main.py,sha256=jWL7Ob0p4KdRUqgPTP_EB68n7z2LyMKC2DeUsfWlBO4,200
52
+ idun_platform_cli/groups/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
53
+ idun_platform_cli/groups/agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
+ idun_platform_cli/groups/agent/main.py,sha256=QMGQi3JZ76SeFI3miIjVWpMt0L-hGz5FwxtTPQX4-Uw,301
55
+ idun_platform_cli/groups/agent/package.py,sha256=LdIFAcfrlUcCssmSliYQIi0NFMuVkpx6t8WhMHATan8,2525
56
+ idun_platform_cli/groups/agent/serve.py,sha256=2AbL0G1WqR33jlyiGaNvAoPZ3G1o52KYUptz_HaAjIg,3863
57
+ idun_agent_engine-0.3.4.dist-info/METADATA,sha256=7avxM1HbAMGe_e_Baxb148Vwa24Y7VUXe6CLcEtMx8U,10648
58
+ idun_agent_engine-0.3.4.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
59
+ idun_agent_engine-0.3.4.dist-info/entry_points.txt,sha256=XG3oxlSOaCrYKT1oyhKa0Ag1iJPMZ-WF6gaV_mzIJW4,52
60
+ idun_agent_engine-0.3.4.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ idun = idun_platform_cli.main:cli
File without changes
File without changes
File without changes
@@ -0,0 +1,16 @@
1
+ """Manage, Deploy and package agents."""
2
+
3
+ import click
4
+
5
+ from .package import package_command
6
+ from .serve import serve_command
7
+
8
+
9
+ @click.group()
10
+ def agent():
11
+ """Agent command entrypoint."""
12
+ pass
13
+
14
+
15
+ agent.add_command(serve_command, name="serve")
16
+ agent.add_command(package_command, name="package")
@@ -0,0 +1,70 @@
1
+ import sys
2
+ from enum import StrEnum
3
+ from pathlib import Path
4
+
5
+ import click
6
+
7
+
8
+ class Dependency(StrEnum):
9
+ """Dependency Enum."""
10
+
11
+ REQUIREMENT = "requirements.txt"
12
+ PYPROJECT = "pyproject.toml"
13
+ NONE = "none"
14
+
15
+
16
+ def get_dependencies(path: str) -> Dependency:
17
+ """Verifies if the path folder contains a `requirements.txt` or `pyproject.toml`, and returns which."""
18
+ """:param path: Path pointing to the agent's folder."""
19
+ agent_path = Path(path).resolve()
20
+ if (agent_path / "requirements.txt").exists():
21
+ return Dependency.REQUIREMENT
22
+ elif (agent_path / "pyproject.toml").exists():
23
+ return Dependency.PYPROJECT
24
+ else:
25
+ return Dependency.NONE
26
+
27
+
28
+ def generate_dockerfile(dependency: Dependency) -> str:
29
+ # TODO: add envs vars based on source
30
+ """Generates Dockerfile based on given params."""
31
+ if dependency == Dependency.NONE:
32
+ print(
33
+ "[ERROR]: No pyproject.toml or requirements.txt found. Please make sure to include them."
34
+ )
35
+ sys.exit(1)
36
+ return "" # Unreachable, but satisfies type checker
37
+ if dependency == Dependency.REQUIREMENT:
38
+ # TODO: use from file
39
+ requirements_dockerfile = f"""FROM python:3.12-slim
40
+ RUN apt-get update && pip install uv
41
+
42
+ RUN uv pip install idun-agent-schema==0.3.1 --system
43
+ RUN uv pip install idun-agent-engine==0.3.1 --system
44
+
45
+ COPY . .
46
+ RUN uv pip install -r requirements.txt --system
47
+
48
+ CMD ["idun", "agent", "serve", "--source=manager"]
49
+ """
50
+ return requirements_dockerfile
51
+ if dependency == Dependency.PYPROJECT:
52
+ # TODO: implement pyproject.toml support
53
+ raise NotImplementedError("pyproject.toml support is not yet implemented")
54
+ raise ValueError(f"Unknown dependency type: {dependency}")
55
+
56
+
57
+ @click.command("package")
58
+ @click.argument("path", default=".")
59
+ @click.option("--target", required=False, default=".")
60
+ def package_command(path: str, target: str):
61
+ """Packages the agent and it's dependencies into a Dockerfile. You can specifiy the input path and the destination. Defaults to current directory."""
62
+ dependency = get_dependencies(path)
63
+ dockerfile = generate_dockerfile(dependency)
64
+ target_path = Path(target)
65
+ dockerfile_path = target_path / "Dockerfile"
66
+ try:
67
+ dockerfile_path.write_text(dockerfile)
68
+ print(f"Dockerfile generated in {target}")
69
+ except OSError as e:
70
+ print(f"[ERROR]: Cannot write dockerfile to path {target}: {e}")
@@ -0,0 +1,107 @@
1
+ import os
2
+ import sys
3
+ from enum import StrEnum
4
+
5
+ import click
6
+
7
+ from idun_agent_engine.core.app_factory import create_app
8
+ from idun_agent_engine.core.config_builder import ConfigBuilder
9
+ from idun_agent_engine.core.engine_config import EngineConfig
10
+ from idun_agent_engine.core.server_runner import run_server
11
+
12
+
13
+ class ServerSource(StrEnum):
14
+ """Enum for source types."""
15
+
16
+ MANAGER = "manager"
17
+ FILE = "file"
18
+
19
+
20
+ class Serve:
21
+ """Helper class to run the server."""
22
+
23
+ def __init__(self, source: ServerSource, path: str | None = None) -> None:
24
+ self._source: ServerSource = source
25
+ self._path: str | None = path or None
26
+
27
+ if self._source == ServerSource.MANAGER and (
28
+ not os.getenv("IDUN_AGENT_API_KEY") or not os.getenv("IDUN_MANAGER_HOST")
29
+ ):
30
+ print(
31
+ "[ERROR]: either IDUN_AGENT_API_KEY or IDUN_MANAGER_HOST are not found. Make sure you add them both to your env variables, as `manager` source requires both."
32
+ )
33
+ sys.exit(1)
34
+
35
+ if self._source == ServerSource.MANAGER:
36
+ self._url: str = os.environ["IDUN_MANAGER_HOST"]
37
+ self._agent_api_key: str = os.environ["IDUN_AGENT_API_KEY"]
38
+
39
+ self._config: EngineConfig | None = self._resolve_source()
40
+
41
+ def _resolve_source(self):
42
+ """Returns the EngineConfig based on the type of the source."""
43
+ if self._source == ServerSource.MANAGER:
44
+ print("Getting the config for the manager...")
45
+ return self._fetch_from_manager()
46
+ elif self._source == ServerSource.FILE:
47
+ print(f"Building config from: {self._path}")
48
+ return self._fetch_from_path()
49
+
50
+ def _fetch_from_path(self) -> EngineConfig | None:
51
+ try:
52
+ config = ConfigBuilder().load_from_file(self._path or "")
53
+ print(f"✅ Successfully fetched and built config from {self._path}")
54
+ return config
55
+
56
+ except Exception as e:
57
+ raise ValueError(
58
+ f"[ERROR]: Cannot fetch config from {self._path}: {e} "
59
+ ) from e
60
+
61
+ def _fetch_from_manager(self) -> EngineConfig | None:
62
+ """Fetches the config from the api."""
63
+ try:
64
+ config = (
65
+ ConfigBuilder()
66
+ .with_config_from_api(agent_api_key=self._agent_api_key, url=self._url)
67
+ .build()
68
+ )
69
+ print(f"✅ Successfully fetched and built config from {self._url}")
70
+ return config
71
+ except Exception as e:
72
+ print(f"[ERROR]: Cannot fetch config from {self._url}: {e} ")
73
+ sys.exit(1)
74
+
75
+ def serve(self) -> None:
76
+ """Run the server using the idun engine."""
77
+ try:
78
+ app = create_app(engine_config=self._config)
79
+ run_server(app, port=self._config.server.api.port, reload=False) # pyright: ignore
80
+ except Exception as e:
81
+ raise ValueError(f"[ERROR]: Cannot start the agent server: {e}") from e
82
+
83
+
84
+ @click.command("serve")
85
+ @click.option("--source", required=True)
86
+ @click.option("--path")
87
+ def serve_command(source: str, path: str | None):
88
+ """Reads a config and exposes it's agent as an API. Config is either fetched from the manager, or from a path.
89
+
90
+ Note: Fetching from the manager requires env vars: IDUN_AGENT_API_KEY and IDUN_MANAGER_HOST.
91
+ """
92
+ match source:
93
+ case ServerSource.MANAGER:
94
+ s = Serve(source=source)
95
+ s.serve()
96
+
97
+ case ServerSource.FILE:
98
+ if not path:
99
+ print(
100
+ "[ERROR]: No config path provided. You need to specify the path of your config.yaml"
101
+ )
102
+ sys.exit(1)
103
+ s = Serve(source=source, path=path)
104
+ s.serve()
105
+ case _:
106
+ print(f"[ERROR]: Argument {source} not recognized.")
107
+ sys.exit(1)
@@ -0,0 +1,14 @@
1
+ import click
2
+ from idun_platform_cli.groups.agent.main import agent
3
+
4
+
5
+ @click.group()
6
+ def cli():
7
+ """Entrypoint of the CLI."""
8
+ pass
9
+
10
+
11
+ cli.add_command(agent)
12
+
13
+ if __name__ == "__main__":
14
+ cli()