idun-agent-engine 0.2.6__tar.gz → 0.2.7__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 (43) hide show
  1. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/PKG-INFO +5 -3
  2. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/pyproject.toml +5 -3
  3. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/_version.py +1 -1
  4. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/agent/base.py +9 -0
  5. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/agent/haystack/haystack.py +9 -0
  6. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/agent/langgraph/langgraph.py +19 -0
  7. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/core/app_factory.py +2 -1
  8. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/server/dependencies.py +17 -0
  9. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/server/routers/agent.py +30 -2
  10. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_platform_cli/groups/agent/package.py +2 -2
  11. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/.gitignore +0 -0
  12. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/README.md +0 -0
  13. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/__init__.py +0 -0
  14. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/agent/__init__.py +0 -0
  15. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/agent/haystack/__init__.py +0 -0
  16. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/agent/haystack/haystack_model.py +0 -0
  17. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/agent/haystack/utils.py +0 -0
  18. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/agent/langgraph/__init__.py +0 -0
  19. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/cli/__init__.py +0 -0
  20. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/core/__init__.py +0 -0
  21. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/core/config_builder.py +0 -0
  22. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/core/engine_config.py +0 -0
  23. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/core/server_runner.py +0 -0
  24. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/observability/__init__.py +0 -0
  25. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/observability/base.py +0 -0
  26. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/observability/langfuse/__init__.py +0 -0
  27. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/observability/langfuse/langfuse_handler.py +0 -0
  28. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/observability/phoenix/__init__.py +0 -0
  29. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/observability/phoenix/phoenix_handler.py +0 -0
  30. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/observability/phoenix_local/__init__.py +0 -0
  31. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/observability/phoenix_local/phoenix_local_handler.py +0 -0
  32. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/py.typed +0 -0
  33. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/server/__init__.py +0 -0
  34. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/server/lifespan.py +0 -0
  35. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/server/routers/__init__.py +0 -0
  36. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/server/routers/base.py +0 -0
  37. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_agent_engine/server/server_config.py +0 -0
  38. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_platform_cli/__init__.py +0 -0
  39. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_platform_cli/groups/__init__.py +0 -0
  40. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_platform_cli/groups/agent/__init__.py +0 -0
  41. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_platform_cli/groups/agent/main.py +0 -0
  42. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_platform_cli/groups/agent/serve.py +0 -0
  43. {idun_agent_engine-0.2.6 → idun_agent_engine-0.2.7}/src/idun_platform_cli/main.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: idun-agent-engine
3
- Version: 0.2.6
3
+ Version: 0.2.7
4
4
  Summary: Python SDK and runtime to serve AI agents with FastAPI, LangGraph, and observability.
5
5
  Project-URL: Homepage, https://github.com/geoffreyharrazi/idun-agent-platform
6
6
  Project-URL: Repository, https://github.com/geoffreyharrazi/idun-agent-platform
@@ -19,15 +19,17 @@ Classifier: Programming Language :: Python :: 3.13
19
19
  Classifier: Topic :: Software Development :: Libraries
20
20
  Classifier: Typing :: Typed
21
21
  Requires-Python: <3.14,>=3.12
22
+ Requires-Dist: ag-ui-langgraph<0.1.0,>=0.0.20
22
23
  Requires-Dist: ag-ui-protocol<0.2.0,>=0.1.8
23
24
  Requires-Dist: aiosqlite<0.22.0,>=0.21.0
24
25
  Requires-Dist: arize-phoenix-otel<1.0.0,>=0.2.0
25
26
  Requires-Dist: arize-phoenix<12.0.0,>=11.22.0
26
27
  Requires-Dist: click>=8.2.1
27
- Requires-Dist: fastapi<0.117.0,>=0.116.1
28
+ Requires-Dist: copilotkit<0.2.0,>=0.1.72
29
+ Requires-Dist: fastapi<0.116.0,>=0.115.0
28
30
  Requires-Dist: google-adk<2.0.0,>=1.9.0
29
31
  Requires-Dist: httpx<0.29.0,>=0.28.1
30
- Requires-Dist: idun-agent-schema<0.3.0,>=0.2.6
32
+ Requires-Dist: idun-agent-schema<0.3.0,>=0.2.7
31
33
  Requires-Dist: langchain-core<0.4.0,>=0.3.72
32
34
  Requires-Dist: langchain-google-vertexai<3.0.0,>=2.0.27
33
35
  Requires-Dist: langchain<0.4,>=0.3.27
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "idun-agent-engine"
3
- version = "0.2.6"
3
+ version = "0.2.7"
4
4
  description = "Python SDK and runtime to serve AI agents with FastAPI, LangGraph, and observability."
5
5
  authors = [{ name = "Geoffrey HARRAZI", email = "geoffreyharrazi@gmail.com" }]
6
6
  requires-python = ">=3.12,<3.14"
@@ -26,7 +26,7 @@ classifiers = [
26
26
  "Typing :: Typed",
27
27
  ]
28
28
  dependencies = [
29
- "fastapi>=0.116.1,<0.117.0",
29
+ "fastapi>=0.115.0,<0.116.0",
30
30
  "uvicorn>=0.35.0,<0.36.0",
31
31
  "langgraph>=0.6.3,<0.7.0",
32
32
  "langgraph-checkpoint-sqlite>=2.0.11,<3.0.0",
@@ -44,12 +44,14 @@ dependencies = [
44
44
  "langchain>=0.3.27,<0.4",
45
45
  # Pin <12: 12.x currently depends on placeholder jmespath==99.99.99 and fails in Docker
46
46
  "arize-phoenix>=11.22.0,<12.0.0",
47
- "idun-agent-schema>=0.2.6,<0.3.0",
47
+ "idun-agent-schema>=0.2.7,<0.3.0",
48
48
  "langfuse-haystack>=2.3.0",
49
49
  "python-dotenv>=1.1.1",
50
50
  "click>=8.2.1",
51
51
  # Pin SQLAlchemy for Python 3.13 compatibility (required by Phoenix)
52
52
  "sqlalchemy>=2.0.36,<3.0.0",
53
+ "ag-ui-langgraph>=0.0.20,<0.1.0",
54
+ "copilotkit>=0.1.72,<0.2.0",
53
55
  ]
54
56
 
55
57
 
@@ -1,3 +1,3 @@
1
1
  """Version information for Idun Agent Engine."""
2
2
 
3
- __version__ = "0.2.6"
3
+ __version__ = "0.2.7"
@@ -39,6 +39,15 @@ class BaseAgent[ConfigType: BaseAgentConfig](ABC):
39
39
  """
40
40
  pass
41
41
 
42
+ @property
43
+ @abstractmethod
44
+ def copilotkit_agent_instance(self) -> Any:
45
+ """Get the CopilotKit agent instance.
46
+
47
+ This might be set after initialization.
48
+ """
49
+ pass
50
+
42
51
  @property
43
52
  def configuration(self) -> ConfigType:
44
53
  """Return current configuration settings for the agent.
@@ -70,6 +70,15 @@ class HaystackAgent(BaseAgent):
70
70
  raise RuntimeError("Agent not initialized. Call initialize() first.")
71
71
  return self._agent_instance
72
72
 
73
+ @property
74
+ def copilotkit_agent_instance(self) -> Any:
75
+ """Return the CopilotKit agent instance.
76
+
77
+ Raises:
78
+ RuntimeError: If the CopilotKit agent is not yet initialized.
79
+ """
80
+ raise NotImplementedError("CopilotKit agent instance not supported yet for Haystack agent.")
81
+
73
82
  @property
74
83
  def configuration(self) -> HaystackAgentConfig:
75
84
  """Return validated configuration.
@@ -17,6 +17,7 @@ from langgraph.graph import StateGraph
17
17
 
18
18
  from idun_agent_engine import observability
19
19
  from idun_agent_engine.agent import base as agent_base
20
+ from copilotkit import LangGraphAGUIAgent
20
21
 
21
22
 
22
23
  class LanggraphAgent(agent_base.BaseAgent):
@@ -29,6 +30,7 @@ class LanggraphAgent(agent_base.BaseAgent):
29
30
  self._input_schema: Any = None
30
31
  self._output_schema: Any = None
31
32
  self._agent_instance: Any = None
33
+ self._copilotkit_agent_instance: LangGraphAGUIAgent | None = None
32
34
  self._checkpointer: Any = None
33
35
  self._store: Any = None
34
36
  self._connection: Any = None
@@ -79,6 +81,17 @@ class LanggraphAgent(agent_base.BaseAgent):
79
81
  raise RuntimeError("Agent not initialized. Call initialize() first.")
80
82
  return self._agent_instance
81
83
 
84
+ @property
85
+ def copilotkit_agent_instance(self) -> LangGraphAGUIAgent:
86
+ """Return the CopilotKit agent instance.
87
+
88
+ Raises:
89
+ RuntimeError: If the CopilotKit agent is not yet initialized.
90
+ """
91
+ if self._copilotkit_agent_instance is None:
92
+ raise RuntimeError("CopilotKit agent not initialized. Call initialize() first.")
93
+ return self._copilotkit_agent_instance
94
+
82
95
  @property
83
96
  def configuration(self) -> LangGraphAgentConfig:
84
97
  """Return validated configuration.
@@ -158,6 +171,12 @@ class LanggraphAgent(agent_base.BaseAgent):
158
171
  checkpointer=self._checkpointer, store=self._store
159
172
  )
160
173
 
174
+ self._copilotkit_agent_instance = LangGraphAGUIAgent(
175
+ name=self._name,
176
+ description="Agent description", # TODO: add agent description
177
+ graph=self._agent_instance,
178
+ )
179
+
161
180
  if self._agent_instance:
162
181
  self._input_schema = self._agent_instance.input_schema
163
182
  self._output_schema = self._agent_instance.output_schema
@@ -14,6 +14,7 @@ from ..server.routers.agent import agent_router
14
14
  from ..server.routers.base import base_router
15
15
  from .config_builder import ConfigBuilder
16
16
  from .engine_config import EngineConfig
17
+ from .._version import __version__
17
18
 
18
19
 
19
20
  def create_app(
@@ -48,7 +49,7 @@ def create_app(
48
49
  lifespan=lifespan,
49
50
  title="Idun Agent Engine Server",
50
51
  description="A production-ready server for conversational AI agents",
51
- version="0.1.0",
52
+ version=__version__,
52
53
  docs_url="/docs",
53
54
  redoc_url="/redoc",
54
55
  )
@@ -21,3 +21,20 @@ async def get_agent(request: Request):
21
21
  app_config = ConfigBuilder.load_from_file()
22
22
  agent = await ConfigBuilder.initialize_agent_from_config(app_config)
23
23
  return agent
24
+
25
+ async def get_copilotkit_agent(request: Request):
26
+ """Return the pre-initialized agent instance from the app state.
27
+
28
+ Falls back to loading from the default config if not present (e.g., tests).
29
+ """
30
+ if hasattr(request.app.state, "copilotkit_agent"):
31
+ return request.app.state.copilotkit_agent
32
+ else:
33
+ # This is a fallback for cases where the lifespan event did not run,
34
+ # like in some testing scenarios.
35
+ # Consider logging a warning here.
36
+ print("⚠️ CopilotKit agent not found in app state, initializing fallback agent...")
37
+
38
+ app_config = ConfigBuilder.load_from_file()
39
+ copilotkit_agent = await ConfigBuilder.initialize_agent_from_config(app_config)
40
+ return copilotkit_agent
@@ -8,7 +8,11 @@ from fastapi.responses import StreamingResponse
8
8
  from idun_agent_schema.engine.api import ChatRequest, ChatResponse
9
9
 
10
10
  from idun_agent_engine.agent.base import BaseAgent
11
- from idun_agent_engine.server.dependencies import get_agent
11
+ from idun_agent_engine.server.dependencies import get_agent, get_copilotkit_agent
12
+
13
+ from ag_ui.core.types import RunAgentInput
14
+ from ag_ui.encoder import EventEncoder
15
+ from copilotkit import LangGraphAGUIAgent
12
16
 
13
17
  logging.basicConfig(
14
18
  format="%(asctime)s %(levelname)-8s %(message)s",
@@ -57,7 +61,6 @@ async def stream(
57
61
  ):
58
62
  """Process a message with the agent, streaming ag-ui events."""
59
63
  try:
60
-
61
64
  async def event_stream():
62
65
  message = {"query": request.query, "session_id": request.session_id}
63
66
  async for event in agent.stream(message):
@@ -66,3 +69,28 @@ async def stream(
66
69
  return StreamingResponse(event_stream(), media_type="text/event-stream")
67
70
  except Exception as e: # noqa: BLE001
68
71
  raise HTTPException(status_code=500, detail=str(e)) from e
72
+
73
+ @agent_router.post("/copilotkit/stream")
74
+ async def copilotkit_stream(
75
+ input_data: RunAgentInput,
76
+ request: Request,
77
+ copilotkit_agent: Annotated[LangGraphAGUIAgent, Depends(get_copilotkit_agent)],
78
+ ):
79
+ """Process a message with the agent, streaming ag-ui events."""
80
+ try:
81
+ # Get the accept header from the request
82
+ accept_header = request.headers.get("accept")
83
+
84
+ # Create an event encoder to properly format SSE events
85
+ encoder = EventEncoder(accept=accept_header or "") # type: ignore[arg-type]
86
+
87
+ async def event_generator():
88
+ async for event in copilotkit_agent.run(input_data):
89
+ yield encoder.encode(event)
90
+
91
+ return StreamingResponse(
92
+ event_generator(), # type: ignore[arg-type]
93
+ media_type=encoder.get_content_type()
94
+ )
95
+ except Exception as e: # noqa: BLE001
96
+ raise HTTPException(status_code=500, detail=str(e)) from e
@@ -39,8 +39,8 @@ def generate_dockerfile(dependency: Dependency) -> str:
39
39
  requirements_dockerfile = f"""FROM python:3.13-slim
40
40
  RUN apt-get update && pip install uv
41
41
 
42
- RUN uv pip install idun-agent-schema==0.2.6 --system
43
- RUN uv pip install idun-agent-engine==0.2.6 --system
42
+ RUN uv pip install idun-agent-schema==0.2.7 --system
43
+ RUN uv pip install idun-agent-engine==0.2.7 --system
44
44
 
45
45
  COPY . .
46
46
  RUN uv pip install -r requirements.txt --system