idun-agent-engine 0.1.0__tar.gz → 0.2.1__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 (41) hide show
  1. idun_agent_engine-0.2.1/.gitignore +206 -0
  2. idun_agent_engine-0.2.1/PKG-INFO +278 -0
  3. idun_agent_engine-0.2.1/README.md +236 -0
  4. idun_agent_engine-0.2.1/pyproject.toml +161 -0
  5. idun_agent_engine-0.2.1/src/idun_agent_engine/__init__.py +24 -0
  6. {idun_agent_engine-0.1.0 → idun_agent_engine-0.2.1}/src/idun_agent_engine/_version.py +1 -1
  7. idun_agent_engine-0.2.1/src/idun_agent_engine/agent/__init__.py +10 -0
  8. idun_agent_engine-0.2.1/src/idun_agent_engine/agent/base.py +97 -0
  9. idun_agent_engine-0.2.1/src/idun_agent_engine/agent/haystack/__init__.py +9 -0
  10. idun_agent_engine-0.2.1/src/idun_agent_engine/agent/haystack/haystack.py +261 -0
  11. idun_agent_engine-0.2.1/src/idun_agent_engine/agent/haystack/haystack_model.py +13 -0
  12. idun_agent_engine-0.2.1/src/idun_agent_engine/agent/haystack/utils.py +13 -0
  13. idun_agent_engine-0.2.1/src/idun_agent_engine/agent/langgraph/__init__.py +7 -0
  14. idun_agent_engine-0.2.1/src/idun_agent_engine/agent/langgraph/langgraph.py +429 -0
  15. idun_agent_engine-0.2.1/src/idun_agent_engine/cli/__init__.py +16 -0
  16. idun_agent_engine-0.2.1/src/idun_agent_engine/core/__init__.py +11 -0
  17. idun_agent_engine-0.2.1/src/idun_agent_engine/core/app_factory.py +63 -0
  18. idun_agent_engine-0.2.1/src/idun_agent_engine/core/config_builder.py +456 -0
  19. idun_agent_engine-0.2.1/src/idun_agent_engine/core/engine_config.py +22 -0
  20. idun_agent_engine-0.2.1/src/idun_agent_engine/core/server_runner.py +146 -0
  21. idun_agent_engine-0.2.1/src/idun_agent_engine/observability/__init__.py +13 -0
  22. idun_agent_engine-0.2.1/src/idun_agent_engine/observability/base.py +111 -0
  23. idun_agent_engine-0.2.1/src/idun_agent_engine/observability/langfuse/__init__.py +5 -0
  24. idun_agent_engine-0.2.1/src/idun_agent_engine/observability/langfuse/langfuse_handler.py +72 -0
  25. idun_agent_engine-0.2.1/src/idun_agent_engine/observability/phoenix/__init__.py +5 -0
  26. idun_agent_engine-0.2.1/src/idun_agent_engine/observability/phoenix/phoenix_handler.py +65 -0
  27. idun_agent_engine-0.2.1/src/idun_agent_engine/observability/phoenix_local/__init__.py +5 -0
  28. idun_agent_engine-0.2.1/src/idun_agent_engine/observability/phoenix_local/phoenix_local_handler.py +123 -0
  29. idun_agent_engine-0.2.1/src/idun_agent_engine/py.typed +0 -0
  30. idun_agent_engine-0.2.1/src/idun_agent_engine/server/__init__.py +5 -0
  31. idun_agent_engine-0.2.1/src/idun_agent_engine/server/dependencies.py +23 -0
  32. idun_agent_engine-0.2.1/src/idun_agent_engine/server/lifespan.py +42 -0
  33. idun_agent_engine-0.2.1/src/idun_agent_engine/server/routers/__init__.py +5 -0
  34. idun_agent_engine-0.2.1/src/idun_agent_engine/server/routers/agent.py +68 -0
  35. idun_agent_engine-0.2.1/src/idun_agent_engine/server/routers/base.py +60 -0
  36. idun_agent_engine-0.2.1/src/idun_agent_engine/server/server_config.py +8 -0
  37. idun_agent_engine-0.1.0/PKG-INFO +0 -317
  38. idun_agent_engine-0.1.0/README.md +0 -276
  39. idun_agent_engine-0.1.0/pyproject.toml +0 -142
  40. idun_agent_engine-0.1.0/src/idun_agent_engine/__init__.py +0 -47
  41. 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,278 @@
1
+ Metadata-Version: 2.4
2
+ Name: idun-agent-engine
3
+ Version: 0.2.1
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.13
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: <3.14,>=3.13
21
+ Requires-Dist: ag-ui-protocol<0.2.0,>=0.1.8
22
+ Requires-Dist: aiosqlite<0.22.0,>=0.21.0
23
+ Requires-Dist: arize-phoenix-otel<1.0.0,>=0.2.0
24
+ Requires-Dist: arize-phoenix<12,>=11.22.0
25
+ Requires-Dist: fastapi<0.117.0,>=0.116.1
26
+ Requires-Dist: google-adk<2.0.0,>=1.9.0
27
+ Requires-Dist: httpx<0.29.0,>=0.28.1
28
+ Requires-Dist: idun-agent-schema<0.3.0,>=0.2.0
29
+ Requires-Dist: langchain-core<0.4.0,>=0.3.72
30
+ Requires-Dist: langchain-google-vertexai<3.0.0,>=2.0.27
31
+ Requires-Dist: langchain<0.4,>=0.3.27
32
+ Requires-Dist: langfuse-haystack>=2.3.0
33
+ Requires-Dist: langfuse==2.60.8
34
+ Requires-Dist: langgraph-checkpoint-sqlite<3.0.0,>=2.0.11
35
+ Requires-Dist: langgraph<0.7.0,>=0.6.3
36
+ Requires-Dist: openinference-instrumentation-langchain<1.0.0,>=0.1.13
37
+ Requires-Dist: pydantic<3.0.0,>=2.11.7
38
+ Requires-Dist: python-dotenv>=1.1.1
39
+ Requires-Dist: streamlit<2.0.0,>=1.47.1
40
+ Requires-Dist: uvicorn<0.36.0,>=0.35.0
41
+ Description-Content-Type: text/markdown
42
+
43
+ # Idun Agent Engine
44
+
45
+ Turn any LangGraph-based agent into a production-grade API in minutes.
46
+
47
+ 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.
48
+
49
+ ## Installation
50
+
51
+ ```bash
52
+ pip install idun-agent-engine
53
+ ```
54
+
55
+ - Requires Python 3.13
56
+ - Ships with FastAPI, Uvicorn, LangGraph, SQLite checkpointing, and optional observability hooks
57
+
58
+ ## Quickstart
59
+
60
+ ### 1) Minimal one-liner (from a YAML config)
61
+
62
+ ```python
63
+ from idun_agent_engine.core.server_runner import run_server_from_config
64
+
65
+ run_server_from_config("config.yaml")
66
+ ```
67
+
68
+ Example `config.yaml`:
69
+
70
+ ```yaml
71
+ server:
72
+ api:
73
+ port: 8000
74
+
75
+ agent:
76
+ type: "langgraph"
77
+ config:
78
+ name: "My Example LangGraph Agent"
79
+ graph_definition: "./examples/01_basic_config_file/example_agent.py:app"
80
+ # Optional: conversation persistence
81
+ checkpointer:
82
+ type: "sqlite"
83
+ db_url: "sqlite:///example_checkpoint.db"
84
+ # Optional: provider-agnostic observability
85
+ observability:
86
+ provider: langfuse # or phoenix
87
+ enabled: true
88
+ options:
89
+ host: ${LANGFUSE_HOST}
90
+ public_key: ${LANGFUSE_PUBLIC_KEY}
91
+ secret_key: ${LANGFUSE_SECRET_KEY}
92
+ run_name: "idun-langgraph-run"
93
+ ```
94
+
95
+ Run and open docs at `http://localhost:8000/docs`.
96
+
97
+ ### 2) Programmatic setup with the fluent builder
98
+
99
+ ```python
100
+ from pathlib import Path
101
+ from idun_agent_engine import ConfigBuilder, create_app, run_server
102
+
103
+ config = (
104
+ ConfigBuilder()
105
+ .with_api_port(8000)
106
+ .with_langgraph_agent(
107
+ name="Programmatic Example Agent",
108
+ graph_definition=str(Path("./examples/02_programmatic_config/smart_agent.py:app")),
109
+ sqlite_checkpointer="programmatic_example.db",
110
+ )
111
+ .build()
112
+ )
113
+
114
+ app = create_app(engine_config=config)
115
+ run_server(app, reload=True)
116
+ ```
117
+
118
+ ## Endpoints
119
+
120
+ All servers expose these by default:
121
+
122
+ - POST `/agent/invoke`: single request/response
123
+ - POST `/agent/stream`: server-sent events stream of `ag-ui` protocol events
124
+ - GET `/health`: service health with engine version
125
+ - GET `/`: root landing with links
126
+
127
+ Invoke example:
128
+
129
+ ```bash
130
+ curl -X POST "http://localhost:8000/agent/invoke" \
131
+ -H "Content-Type: application/json" \
132
+ -d '{"query": "Hello!", "session_id": "user-123"}'
133
+ ```
134
+
135
+ Stream example:
136
+
137
+ ```bash
138
+ curl -N -X POST "http://localhost:8000/agent/stream" \
139
+ -H "Content-Type: application/json" \
140
+ -d '{"query": "Tell me a story", "session_id": "user-123"}'
141
+ ```
142
+
143
+ ## LangGraph integration
144
+
145
+ Point the engine to a `StateGraph` variable in your file using `graph_definition`:
146
+
147
+ ```python
148
+ # examples/01_basic_config_file/example_agent.py
149
+ import operator
150
+ from typing import Annotated, TypedDict
151
+ from langgraph.graph import END, StateGraph
152
+
153
+ class AgentState(TypedDict):
154
+ messages: Annotated[list, operator.add]
155
+
156
+ def greeting_node(state):
157
+ user_message = state["messages"][-1] if state["messages"] else ""
158
+ return {"messages": [("ai", f"Hello! You said: '{user_message}'")]}
159
+
160
+ graph = StateGraph(AgentState)
161
+ graph.add_node("greet", greeting_node)
162
+ graph.set_entry_point("greet")
163
+ graph.add_edge("greet", END)
164
+
165
+ # This variable name is referenced by graph_definition
166
+ app = graph
167
+ ```
168
+
169
+ Then reference it in config:
170
+
171
+ ```yaml
172
+ agent:
173
+ type: "langgraph"
174
+ config:
175
+ graph_definition: "./examples/01_basic_config_file/example_agent.py:app"
176
+ ```
177
+
178
+ Behind the scenes, the engine:
179
+
180
+ - Validates config with Pydantic models
181
+ - Loads your `StateGraph` from disk
182
+ - Optionally wires a SQLite checkpointer via `langgraph.checkpoint.sqlite`
183
+ - Exposes `invoke` and `stream` endpoints
184
+ - Bridges LangGraph events to `ag-ui` stream events
185
+
186
+ ## Observability (optional)
187
+
188
+ Enable provider-agnostic observability via the `observability` block in your agent config. Today supports Langfuse and Arize Phoenix (OpenInference) patterns; more coming soon.
189
+
190
+ ```yaml
191
+ agent:
192
+ type: "langgraph"
193
+ config:
194
+ observability:
195
+ provider: langfuse # or phoenix
196
+ enabled: true
197
+ options:
198
+ host: ${LANGFUSE_HOST}
199
+ public_key: ${LANGFUSE_PUBLIC_KEY}
200
+ secret_key: ${LANGFUSE_SECRET_KEY}
201
+ run_name: "idun-langgraph-run"
202
+ ```
203
+
204
+ ## Configuration reference
205
+
206
+ - `server.api.port` (int): HTTP port (default 8000)
207
+ - `agent.type` (enum): currently `langgraph` (CrewAI placeholder exists but not implemented)
208
+ - `agent.config.name` (str): human-readable name
209
+ - `agent.config.graph_definition` (str): absolute or relative `path/to/file.py:variable`
210
+ - `agent.config.checkpointer` (sqlite): `{ type: "sqlite", db_url: "sqlite:///file.db" }`
211
+ - `agent.config.observability` (optional): provider options as shown above
212
+
213
+ Config can be sourced by:
214
+
215
+ - `engine_config` (preferred): pass a validated `EngineConfig` to `create_app`
216
+ - `config_dict`: dict validated at runtime
217
+ - `config_path`: path to YAML; defaults to `config.yaml`
218
+
219
+ ## Examples
220
+
221
+ The `examples/` folder contains complete projects:
222
+
223
+ - `01_basic_config_file`: YAML config + simple agent
224
+ - `02_programmatic_config`: `ConfigBuilder` usage and advanced flows
225
+ - `03_minimal_setup`: one-line server from config
226
+
227
+ Run any example with Python 3.13 installed.
228
+
229
+ ## CLI and runtime helpers
230
+
231
+ Top-level imports for convenience:
232
+
233
+ ```python
234
+ from idun_agent_engine import (
235
+ create_app,
236
+ run_server,
237
+ run_server_from_config,
238
+ run_server_from_builder,
239
+ ConfigBuilder,
240
+ )
241
+ ```
242
+
243
+ - `create_app(...)` builds the FastAPI app and registers routes
244
+ - `run_server(app, ...)` runs with Uvicorn
245
+ - `run_server_from_config(path, ...)` loads config, builds app, and runs
246
+ - `run_server_from_builder(builder, ...)` builds from a builder and runs
247
+
248
+ ## Production notes
249
+
250
+ - Use a process manager (e.g., multiple Uvicorn workers behind a gateway). Note: `reload=True` is for development and incompatible with multi-worker mode.
251
+ - Mount behind a reverse proxy and enable TLS where appropriate.
252
+ - Persist conversations using the SQLite checkpointer in production or replace with a custom checkpointer when available.
253
+
254
+ ## Roadmap
255
+
256
+ - CrewAI adapter (placeholder exists, not yet implemented)
257
+ - Additional stores and checkpointers
258
+ - First-class CLI for `idun` commands
259
+
260
+ ## Contributing
261
+
262
+ Issues and PRs are welcome. See the repository:
263
+
264
+ - Repo: `https://github.com/geoffreyharrazi/idun-agent-platform`
265
+ - Package path: `libs/idun_agent_engine`
266
+ - Open an issue: `https://github.com/geoffreyharrazi/idun-agent-platform/issues`
267
+
268
+ Run locally:
269
+
270
+ ```bash
271
+ cd libs/idun_agent_engine
272
+ poetry install
273
+ poetry run pytest -q
274
+ ```
275
+
276
+ ## License
277
+
278
+ 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.