idun-agent-engine 0.1.0__tar.gz → 0.2.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. idun_agent_engine-0.2.2/.gitignore +206 -0
  2. idun_agent_engine-0.2.2/PKG-INFO +281 -0
  3. idun_agent_engine-0.2.2/README.md +236 -0
  4. idun_agent_engine-0.2.2/pyproject.toml +164 -0
  5. idun_agent_engine-0.2.2/src/idun_agent_engine/__init__.py +24 -0
  6. {idun_agent_engine-0.1.0 → idun_agent_engine-0.2.2}/src/idun_agent_engine/_version.py +1 -1
  7. idun_agent_engine-0.2.2/src/idun_agent_engine/agent/__init__.py +10 -0
  8. idun_agent_engine-0.2.2/src/idun_agent_engine/agent/base.py +97 -0
  9. idun_agent_engine-0.2.2/src/idun_agent_engine/agent/haystack/__init__.py +9 -0
  10. idun_agent_engine-0.2.2/src/idun_agent_engine/agent/haystack/haystack.py +261 -0
  11. idun_agent_engine-0.2.2/src/idun_agent_engine/agent/haystack/haystack_model.py +13 -0
  12. idun_agent_engine-0.2.2/src/idun_agent_engine/agent/haystack/utils.py +13 -0
  13. idun_agent_engine-0.2.2/src/idun_agent_engine/agent/langgraph/__init__.py +7 -0
  14. idun_agent_engine-0.2.2/src/idun_agent_engine/agent/langgraph/langgraph.py +431 -0
  15. idun_agent_engine-0.2.2/src/idun_agent_engine/cli/__init__.py +16 -0
  16. idun_agent_engine-0.2.2/src/idun_agent_engine/core/__init__.py +11 -0
  17. idun_agent_engine-0.2.2/src/idun_agent_engine/core/app_factory.py +63 -0
  18. idun_agent_engine-0.2.2/src/idun_agent_engine/core/config_builder.py +456 -0
  19. idun_agent_engine-0.2.2/src/idun_agent_engine/core/engine_config.py +22 -0
  20. idun_agent_engine-0.2.2/src/idun_agent_engine/core/server_runner.py +146 -0
  21. idun_agent_engine-0.2.2/src/idun_agent_engine/observability/__init__.py +13 -0
  22. idun_agent_engine-0.2.2/src/idun_agent_engine/observability/base.py +111 -0
  23. idun_agent_engine-0.2.2/src/idun_agent_engine/observability/langfuse/__init__.py +5 -0
  24. idun_agent_engine-0.2.2/src/idun_agent_engine/observability/langfuse/langfuse_handler.py +72 -0
  25. idun_agent_engine-0.2.2/src/idun_agent_engine/observability/phoenix/__init__.py +5 -0
  26. idun_agent_engine-0.2.2/src/idun_agent_engine/observability/phoenix/phoenix_handler.py +65 -0
  27. idun_agent_engine-0.2.2/src/idun_agent_engine/observability/phoenix_local/__init__.py +5 -0
  28. idun_agent_engine-0.2.2/src/idun_agent_engine/observability/phoenix_local/phoenix_local_handler.py +123 -0
  29. idun_agent_engine-0.2.2/src/idun_agent_engine/py.typed +0 -0
  30. idun_agent_engine-0.2.2/src/idun_agent_engine/server/__init__.py +5 -0
  31. idun_agent_engine-0.2.2/src/idun_agent_engine/server/dependencies.py +23 -0
  32. idun_agent_engine-0.2.2/src/idun_agent_engine/server/lifespan.py +42 -0
  33. idun_agent_engine-0.2.2/src/idun_agent_engine/server/routers/__init__.py +5 -0
  34. idun_agent_engine-0.2.2/src/idun_agent_engine/server/routers/agent.py +68 -0
  35. idun_agent_engine-0.2.2/src/idun_agent_engine/server/routers/base.py +60 -0
  36. idun_agent_engine-0.2.2/src/idun_agent_engine/server/server_config.py +8 -0
  37. idun_agent_engine-0.2.2/src/idun_platform_cli/__init__.py +0 -0
  38. idun_agent_engine-0.2.2/src/idun_platform_cli/groups/__init__.py +0 -0
  39. idun_agent_engine-0.2.2/src/idun_platform_cli/groups/agent/__init__.py +0 -0
  40. idun_agent_engine-0.2.2/src/idun_platform_cli/groups/agent/main.py +16 -0
  41. idun_agent_engine-0.2.2/src/idun_platform_cli/groups/agent/package.py +73 -0
  42. idun_agent_engine-0.2.2/src/idun_platform_cli/groups/agent/serve.py +104 -0
  43. idun_agent_engine-0.2.2/src/idun_platform_cli/main.py +14 -0
  44. idun_agent_engine-0.1.0/PKG-INFO +0 -317
  45. idun_agent_engine-0.1.0/README.md +0 -276
  46. idun_agent_engine-0.1.0/pyproject.toml +0 -142
  47. idun_agent_engine-0.1.0/src/idun_agent_engine/__init__.py +0 -47
  48. idun_agent_engine-0.1.0/src/idun_agent_engine/py.typed +0 -1
@@ -0,0 +1,206 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+ .DS_Store
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # UV
98
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ #uv.lock
102
+
103
+ # poetry
104
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
105
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
106
+ # commonly ignored for libraries.
107
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
108
+ #poetry.lock
109
+
110
+ # pdm
111
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
112
+ #pdm.lock
113
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
114
+ # in version control.
115
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
116
+ .pdm.toml
117
+ .pdm-python
118
+ .pdm-build/
119
+
120
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
121
+ __pypackages__/
122
+
123
+ # Celery stuff
124
+ celerybeat-schedule
125
+ celerybeat.pid
126
+
127
+ # SageMath parsed files
128
+ *.sage.py
129
+
130
+ # Environments
131
+ .env
132
+ .venv
133
+ env/
134
+ venv/
135
+ ENV/
136
+ env.bak/
137
+ venv.bak/
138
+
139
+ # Spyder project settings
140
+ .spyderproject
141
+ .spyproject
142
+
143
+ # Rope project settings
144
+ .ropeproject
145
+
146
+ # mkdocs documentation
147
+ /site
148
+
149
+ # mypy
150
+ .mypy_cache/
151
+ .dmypy.json
152
+ dmypy.json
153
+
154
+ # Pyre type checker
155
+ .pyre/
156
+
157
+ # pytype static type analyzer
158
+ .pytype/
159
+
160
+ # Cython debug symbols
161
+ cython_debug/
162
+
163
+ # PyCharm
164
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
165
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
166
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
167
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
168
+ #.idea/
169
+
170
+ # Ruff stuff:
171
+ .ruff_cache/
172
+
173
+ # PyPI configuration file
174
+ .pypirc
175
+
176
+ # Database files
177
+ *.db
178
+ *.db-shm
179
+ *.db-wai
180
+ *.db-journal*
181
+ *.sqlite
182
+ *.sqlite3
183
+ agents.db
184
+ checkpoint_async.db
185
+
186
+ # Python virtual environment
187
+ .venv/
188
+ venv/
189
+ ENV/
190
+
191
+ # Python cache
192
+ __pycache__/
193
+ *.pyc
194
+ *.pyo
195
+ *.pyd
196
+
197
+ # Poetry
198
+ poetry.lock
199
+
200
+ # Environment variables
201
+ .env
202
+
203
+ # Custom Gitignore for Idun
204
+ *.db-wal
205
+ .DS_Store
206
+ *.DS_Store
@@ -0,0 +1,281 @@
1
+ Metadata-Version: 2.4
2
+ Name: idun-agent-engine
3
+ Version: 0.2.2
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-protocol<0.2.0,>=0.1.8
23
+ Requires-Dist: aiosqlite<0.22.0,>=0.21.0
24
+ Requires-Dist: arize-phoenix-otel<1.0.0,>=0.2.0
25
+ Requires-Dist: arize-phoenix<12.0.0,>=11.22.0
26
+ Requires-Dist: click>=8.2.1
27
+ Requires-Dist: fastapi<0.117.0,>=0.116.1
28
+ Requires-Dist: google-adk<2.0.0,>=1.9.0
29
+ Requires-Dist: httpx<0.29.0,>=0.28.1
30
+ Requires-Dist: idun-agent-schema<0.3.0,>=0.2.2
31
+ Requires-Dist: langchain-core<0.4.0,>=0.3.72
32
+ Requires-Dist: langchain-google-vertexai<3.0.0,>=2.0.27
33
+ Requires-Dist: langchain<0.4,>=0.3.27
34
+ Requires-Dist: langfuse-haystack>=2.3.0
35
+ Requires-Dist: langfuse==2.60.8
36
+ Requires-Dist: langgraph-checkpoint-sqlite<3.0.0,>=2.0.11
37
+ Requires-Dist: langgraph<0.7.0,>=0.6.3
38
+ Requires-Dist: openinference-instrumentation-langchain<1.0.0,>=0.1.13
39
+ Requires-Dist: pydantic<3.0.0,>=2.11.7
40
+ Requires-Dist: python-dotenv>=1.1.1
41
+ Requires-Dist: sqlalchemy<3.0.0,>=2.0.36
42
+ Requires-Dist: streamlit<2.0.0,>=1.47.1
43
+ Requires-Dist: uvicorn<0.36.0,>=0.35.0
44
+ Description-Content-Type: text/markdown
45
+
46
+ # Idun Agent Engine
47
+
48
+ Turn any LangGraph-based agent into a production-grade API in minutes.
49
+
50
+ 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.
51
+
52
+ ## Installation
53
+
54
+ ```bash
55
+ pip install idun-agent-engine
56
+ ```
57
+
58
+ - Requires Python 3.13
59
+ - Ships with FastAPI, Uvicorn, LangGraph, SQLite checkpointing, and optional observability hooks
60
+
61
+ ## Quickstart
62
+
63
+ ### 1) Minimal one-liner (from a YAML config)
64
+
65
+ ```python
66
+ from idun_agent_engine.core.server_runner import run_server_from_config
67
+
68
+ run_server_from_config("config.yaml")
69
+ ```
70
+
71
+ Example `config.yaml`:
72
+
73
+ ```yaml
74
+ server:
75
+ api:
76
+ port: 8000
77
+
78
+ agent:
79
+ type: "langgraph"
80
+ config:
81
+ name: "My Example LangGraph Agent"
82
+ graph_definition: "./examples/01_basic_config_file/example_agent.py:app"
83
+ # Optional: conversation persistence
84
+ checkpointer:
85
+ type: "sqlite"
86
+ db_url: "sqlite:///example_checkpoint.db"
87
+ # Optional: provider-agnostic observability
88
+ observability:
89
+ provider: langfuse # or phoenix
90
+ enabled: true
91
+ options:
92
+ host: ${LANGFUSE_HOST}
93
+ public_key: ${LANGFUSE_PUBLIC_KEY}
94
+ secret_key: ${LANGFUSE_SECRET_KEY}
95
+ run_name: "idun-langgraph-run"
96
+ ```
97
+
98
+ Run and open docs at `http://localhost:8000/docs`.
99
+
100
+ ### 2) Programmatic setup with the fluent builder
101
+
102
+ ```python
103
+ from pathlib import Path
104
+ from idun_agent_engine import ConfigBuilder, create_app, run_server
105
+
106
+ config = (
107
+ ConfigBuilder()
108
+ .with_api_port(8000)
109
+ .with_langgraph_agent(
110
+ name="Programmatic Example Agent",
111
+ graph_definition=str(Path("./examples/02_programmatic_config/smart_agent.py:app")),
112
+ sqlite_checkpointer="programmatic_example.db",
113
+ )
114
+ .build()
115
+ )
116
+
117
+ app = create_app(engine_config=config)
118
+ run_server(app, reload=True)
119
+ ```
120
+
121
+ ## Endpoints
122
+
123
+ All servers expose these by default:
124
+
125
+ - POST `/agent/invoke`: single request/response
126
+ - POST `/agent/stream`: server-sent events stream of `ag-ui` protocol events
127
+ - GET `/health`: service health with engine version
128
+ - GET `/`: root landing with links
129
+
130
+ Invoke example:
131
+
132
+ ```bash
133
+ curl -X POST "http://localhost:8000/agent/invoke" \
134
+ -H "Content-Type: application/json" \
135
+ -d '{"query": "Hello!", "session_id": "user-123"}'
136
+ ```
137
+
138
+ Stream example:
139
+
140
+ ```bash
141
+ curl -N -X POST "http://localhost:8000/agent/stream" \
142
+ -H "Content-Type: application/json" \
143
+ -d '{"query": "Tell me a story", "session_id": "user-123"}'
144
+ ```
145
+
146
+ ## LangGraph integration
147
+
148
+ Point the engine to a `StateGraph` variable in your file using `graph_definition`:
149
+
150
+ ```python
151
+ # examples/01_basic_config_file/example_agent.py
152
+ import operator
153
+ from typing import Annotated, TypedDict
154
+ from langgraph.graph import END, StateGraph
155
+
156
+ class AgentState(TypedDict):
157
+ messages: Annotated[list, operator.add]
158
+
159
+ def greeting_node(state):
160
+ user_message = state["messages"][-1] if state["messages"] else ""
161
+ return {"messages": [("ai", f"Hello! You said: '{user_message}'")]}
162
+
163
+ graph = StateGraph(AgentState)
164
+ graph.add_node("greet", greeting_node)
165
+ graph.set_entry_point("greet")
166
+ graph.add_edge("greet", END)
167
+
168
+ # This variable name is referenced by graph_definition
169
+ app = graph
170
+ ```
171
+
172
+ Then reference it in config:
173
+
174
+ ```yaml
175
+ agent:
176
+ type: "langgraph"
177
+ config:
178
+ graph_definition: "./examples/01_basic_config_file/example_agent.py:app"
179
+ ```
180
+
181
+ Behind the scenes, the engine:
182
+
183
+ - Validates config with Pydantic models
184
+ - Loads your `StateGraph` from disk
185
+ - Optionally wires a SQLite checkpointer via `langgraph.checkpoint.sqlite`
186
+ - Exposes `invoke` and `stream` endpoints
187
+ - Bridges LangGraph events to `ag-ui` stream events
188
+
189
+ ## Observability (optional)
190
+
191
+ Enable provider-agnostic observability via the `observability` block in your agent config. Today supports Langfuse and Arize Phoenix (OpenInference) patterns; more coming soon.
192
+
193
+ ```yaml
194
+ agent:
195
+ type: "langgraph"
196
+ config:
197
+ observability:
198
+ provider: langfuse # or phoenix
199
+ enabled: true
200
+ options:
201
+ host: ${LANGFUSE_HOST}
202
+ public_key: ${LANGFUSE_PUBLIC_KEY}
203
+ secret_key: ${LANGFUSE_SECRET_KEY}
204
+ run_name: "idun-langgraph-run"
205
+ ```
206
+
207
+ ## Configuration reference
208
+
209
+ - `server.api.port` (int): HTTP port (default 8000)
210
+ - `agent.type` (enum): currently `langgraph` (CrewAI placeholder exists but not implemented)
211
+ - `agent.config.name` (str): human-readable name
212
+ - `agent.config.graph_definition` (str): absolute or relative `path/to/file.py:variable`
213
+ - `agent.config.checkpointer` (sqlite): `{ type: "sqlite", db_url: "sqlite:///file.db" }`
214
+ - `agent.config.observability` (optional): provider options as shown above
215
+
216
+ Config can be sourced by:
217
+
218
+ - `engine_config` (preferred): pass a validated `EngineConfig` to `create_app`
219
+ - `config_dict`: dict validated at runtime
220
+ - `config_path`: path to YAML; defaults to `config.yaml`
221
+
222
+ ## Examples
223
+
224
+ The `examples/` folder contains complete projects:
225
+
226
+ - `01_basic_config_file`: YAML config + simple agent
227
+ - `02_programmatic_config`: `ConfigBuilder` usage and advanced flows
228
+ - `03_minimal_setup`: one-line server from config
229
+
230
+ Run any example with Python 3.13 installed.
231
+
232
+ ## CLI and runtime helpers
233
+
234
+ Top-level imports for convenience:
235
+
236
+ ```python
237
+ from idun_agent_engine import (
238
+ create_app,
239
+ run_server,
240
+ run_server_from_config,
241
+ run_server_from_builder,
242
+ ConfigBuilder,
243
+ )
244
+ ```
245
+
246
+ - `create_app(...)` builds the FastAPI app and registers routes
247
+ - `run_server(app, ...)` runs with Uvicorn
248
+ - `run_server_from_config(path, ...)` loads config, builds app, and runs
249
+ - `run_server_from_builder(builder, ...)` builds from a builder and runs
250
+
251
+ ## Production notes
252
+
253
+ - Use a process manager (e.g., multiple Uvicorn workers behind a gateway). Note: `reload=True` is for development and incompatible with multi-worker mode.
254
+ - Mount behind a reverse proxy and enable TLS where appropriate.
255
+ - Persist conversations using the SQLite checkpointer in production or replace with a custom checkpointer when available.
256
+
257
+ ## Roadmap
258
+
259
+ - CrewAI adapter (placeholder exists, not yet implemented)
260
+ - Additional stores and checkpointers
261
+ - First-class CLI for `idun` commands
262
+
263
+ ## Contributing
264
+
265
+ Issues and PRs are welcome. See the repository:
266
+
267
+ - Repo: `https://github.com/geoffreyharrazi/idun-agent-platform`
268
+ - Package path: `libs/idun_agent_engine`
269
+ - Open an issue: `https://github.com/geoffreyharrazi/idun-agent-platform/issues`
270
+
271
+ Run locally:
272
+
273
+ ```bash
274
+ cd libs/idun_agent_engine
275
+ poetry install
276
+ poetry run pytest -q
277
+ ```
278
+
279
+ ## License
280
+
281
+ MIT — see `LICENSE` in the repo root.
@@ -0,0 +1,236 @@
1
+ # Idun Agent Engine
2
+
3
+ Turn any LangGraph-based agent into a production-grade API in minutes.
4
+
5
+ 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.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pip install idun-agent-engine
11
+ ```
12
+
13
+ - Requires Python 3.13
14
+ - Ships with FastAPI, Uvicorn, LangGraph, SQLite checkpointing, and optional observability hooks
15
+
16
+ ## Quickstart
17
+
18
+ ### 1) Minimal one-liner (from a YAML config)
19
+
20
+ ```python
21
+ from idun_agent_engine.core.server_runner import run_server_from_config
22
+
23
+ run_server_from_config("config.yaml")
24
+ ```
25
+
26
+ Example `config.yaml`:
27
+
28
+ ```yaml
29
+ server:
30
+ api:
31
+ port: 8000
32
+
33
+ agent:
34
+ type: "langgraph"
35
+ config:
36
+ name: "My Example LangGraph Agent"
37
+ graph_definition: "./examples/01_basic_config_file/example_agent.py:app"
38
+ # Optional: conversation persistence
39
+ checkpointer:
40
+ type: "sqlite"
41
+ db_url: "sqlite:///example_checkpoint.db"
42
+ # Optional: provider-agnostic observability
43
+ observability:
44
+ provider: langfuse # or phoenix
45
+ enabled: true
46
+ options:
47
+ host: ${LANGFUSE_HOST}
48
+ public_key: ${LANGFUSE_PUBLIC_KEY}
49
+ secret_key: ${LANGFUSE_SECRET_KEY}
50
+ run_name: "idun-langgraph-run"
51
+ ```
52
+
53
+ Run and open docs at `http://localhost:8000/docs`.
54
+
55
+ ### 2) Programmatic setup with the fluent builder
56
+
57
+ ```python
58
+ from pathlib import Path
59
+ from idun_agent_engine import ConfigBuilder, create_app, run_server
60
+
61
+ config = (
62
+ ConfigBuilder()
63
+ .with_api_port(8000)
64
+ .with_langgraph_agent(
65
+ name="Programmatic Example Agent",
66
+ graph_definition=str(Path("./examples/02_programmatic_config/smart_agent.py:app")),
67
+ sqlite_checkpointer="programmatic_example.db",
68
+ )
69
+ .build()
70
+ )
71
+
72
+ app = create_app(engine_config=config)
73
+ run_server(app, reload=True)
74
+ ```
75
+
76
+ ## Endpoints
77
+
78
+ All servers expose these by default:
79
+
80
+ - POST `/agent/invoke`: single request/response
81
+ - POST `/agent/stream`: server-sent events stream of `ag-ui` protocol events
82
+ - GET `/health`: service health with engine version
83
+ - GET `/`: root landing with links
84
+
85
+ Invoke example:
86
+
87
+ ```bash
88
+ curl -X POST "http://localhost:8000/agent/invoke" \
89
+ -H "Content-Type: application/json" \
90
+ -d '{"query": "Hello!", "session_id": "user-123"}'
91
+ ```
92
+
93
+ Stream example:
94
+
95
+ ```bash
96
+ curl -N -X POST "http://localhost:8000/agent/stream" \
97
+ -H "Content-Type: application/json" \
98
+ -d '{"query": "Tell me a story", "session_id": "user-123"}'
99
+ ```
100
+
101
+ ## LangGraph integration
102
+
103
+ Point the engine to a `StateGraph` variable in your file using `graph_definition`:
104
+
105
+ ```python
106
+ # examples/01_basic_config_file/example_agent.py
107
+ import operator
108
+ from typing import Annotated, TypedDict
109
+ from langgraph.graph import END, StateGraph
110
+
111
+ class AgentState(TypedDict):
112
+ messages: Annotated[list, operator.add]
113
+
114
+ def greeting_node(state):
115
+ user_message = state["messages"][-1] if state["messages"] else ""
116
+ return {"messages": [("ai", f"Hello! You said: '{user_message}'")]}
117
+
118
+ graph = StateGraph(AgentState)
119
+ graph.add_node("greet", greeting_node)
120
+ graph.set_entry_point("greet")
121
+ graph.add_edge("greet", END)
122
+
123
+ # This variable name is referenced by graph_definition
124
+ app = graph
125
+ ```
126
+
127
+ Then reference it in config:
128
+
129
+ ```yaml
130
+ agent:
131
+ type: "langgraph"
132
+ config:
133
+ graph_definition: "./examples/01_basic_config_file/example_agent.py:app"
134
+ ```
135
+
136
+ Behind the scenes, the engine:
137
+
138
+ - Validates config with Pydantic models
139
+ - Loads your `StateGraph` from disk
140
+ - Optionally wires a SQLite checkpointer via `langgraph.checkpoint.sqlite`
141
+ - Exposes `invoke` and `stream` endpoints
142
+ - Bridges LangGraph events to `ag-ui` stream events
143
+
144
+ ## Observability (optional)
145
+
146
+ Enable provider-agnostic observability via the `observability` block in your agent config. Today supports Langfuse and Arize Phoenix (OpenInference) patterns; more coming soon.
147
+
148
+ ```yaml
149
+ agent:
150
+ type: "langgraph"
151
+ config:
152
+ observability:
153
+ provider: langfuse # or phoenix
154
+ enabled: true
155
+ options:
156
+ host: ${LANGFUSE_HOST}
157
+ public_key: ${LANGFUSE_PUBLIC_KEY}
158
+ secret_key: ${LANGFUSE_SECRET_KEY}
159
+ run_name: "idun-langgraph-run"
160
+ ```
161
+
162
+ ## Configuration reference
163
+
164
+ - `server.api.port` (int): HTTP port (default 8000)
165
+ - `agent.type` (enum): currently `langgraph` (CrewAI placeholder exists but not implemented)
166
+ - `agent.config.name` (str): human-readable name
167
+ - `agent.config.graph_definition` (str): absolute or relative `path/to/file.py:variable`
168
+ - `agent.config.checkpointer` (sqlite): `{ type: "sqlite", db_url: "sqlite:///file.db" }`
169
+ - `agent.config.observability` (optional): provider options as shown above
170
+
171
+ Config can be sourced by:
172
+
173
+ - `engine_config` (preferred): pass a validated `EngineConfig` to `create_app`
174
+ - `config_dict`: dict validated at runtime
175
+ - `config_path`: path to YAML; defaults to `config.yaml`
176
+
177
+ ## Examples
178
+
179
+ The `examples/` folder contains complete projects:
180
+
181
+ - `01_basic_config_file`: YAML config + simple agent
182
+ - `02_programmatic_config`: `ConfigBuilder` usage and advanced flows
183
+ - `03_minimal_setup`: one-line server from config
184
+
185
+ Run any example with Python 3.13 installed.
186
+
187
+ ## CLI and runtime helpers
188
+
189
+ Top-level imports for convenience:
190
+
191
+ ```python
192
+ from idun_agent_engine import (
193
+ create_app,
194
+ run_server,
195
+ run_server_from_config,
196
+ run_server_from_builder,
197
+ ConfigBuilder,
198
+ )
199
+ ```
200
+
201
+ - `create_app(...)` builds the FastAPI app and registers routes
202
+ - `run_server(app, ...)` runs with Uvicorn
203
+ - `run_server_from_config(path, ...)` loads config, builds app, and runs
204
+ - `run_server_from_builder(builder, ...)` builds from a builder and runs
205
+
206
+ ## Production notes
207
+
208
+ - Use a process manager (e.g., multiple Uvicorn workers behind a gateway). Note: `reload=True` is for development and incompatible with multi-worker mode.
209
+ - Mount behind a reverse proxy and enable TLS where appropriate.
210
+ - Persist conversations using the SQLite checkpointer in production or replace with a custom checkpointer when available.
211
+
212
+ ## Roadmap
213
+
214
+ - CrewAI adapter (placeholder exists, not yet implemented)
215
+ - Additional stores and checkpointers
216
+ - First-class CLI for `idun` commands
217
+
218
+ ## Contributing
219
+
220
+ Issues and PRs are welcome. See the repository:
221
+
222
+ - Repo: `https://github.com/geoffreyharrazi/idun-agent-platform`
223
+ - Package path: `libs/idun_agent_engine`
224
+ - Open an issue: `https://github.com/geoffreyharrazi/idun-agent-platform/issues`
225
+
226
+ Run locally:
227
+
228
+ ```bash
229
+ cd libs/idun_agent_engine
230
+ poetry install
231
+ poetry run pytest -q
232
+ ```
233
+
234
+ ## License
235
+
236
+ MIT — see `LICENSE` in the repo root.