idun-agent-schema 0.2.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,9 @@
1
+ """Idun Agent Schema - Centralized Pydantic schemas.
2
+
3
+ Public namespaces:
4
+ - idun_agent_schema.engine: Engine-related schemas
5
+ - idun_agent_schema.manager: Manager-related schemas
6
+ - idun_agent_schema.shared: Shared cross-cutting schemas
7
+ """
8
+
9
+ __version__ = "0.2.3"
@@ -0,0 +1,13 @@
1
+ """Engine-related schemas."""
2
+
3
+ from .agent import BaseAgentConfig,AgentConfig # noqa: F401
4
+ from .api import ChatRequest, ChatResponse # noqa: F401
5
+ from .agent_framework import AgentFramework # noqa: F401
6
+ from .engine import EngineConfig # noqa: F401
7
+ from .langgraph import ( # noqa: F401
8
+ CheckpointConfig,
9
+ LangGraphAgentConfig,
10
+ SqliteCheckpointConfig,
11
+ )
12
+ from .server import ServerAPIConfig, ServerConfig # noqa: F401
13
+ from .observability import ObservabilityConfig # noqa: F401
@@ -0,0 +1,42 @@
1
+ """Common agent model definitions (engine)."""
2
+
3
+ from typing import Any
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+ from idun_agent_schema.engine.agent_framework import AgentFramework
8
+ from idun_agent_schema.engine.langgraph import LangGraphAgentConfig
9
+ from idun_agent_schema.engine.haystack import HaystackAgentConfig
10
+ from idun_agent_schema.engine.base_agent import BaseAgentConfig
11
+ from pydantic import model_validator
12
+
13
+
14
+ class AgentConfig(BaseModel):
15
+ """Configuration for agent specification and settings."""
16
+
17
+ type: AgentFramework
18
+ config: BaseAgentConfig | LangGraphAgentConfig | HaystackAgentConfig
19
+
20
+ @model_validator(mode="after")
21
+ def _validate_framework_config(self) -> "AgentConfig":
22
+ """Ensure the `config` type matches the selected framework.
23
+
24
+ - LANGGRAPH -> LangGraphAgentConfig
25
+ - HAYSTACK -> HaystackAgentConfig
26
+ - ADK/CREWAI/CUSTOM -> BaseAgentConfig (or subclass)
27
+ """
28
+ expected_type: type[BaseAgentConfig] | None = None
29
+
30
+ if self.type == AgentFramework.LANGGRAPH:
31
+ expected_type = LangGraphAgentConfig
32
+ elif self.type == AgentFramework.HAYSTACK:
33
+ expected_type = HaystackAgentConfig
34
+ elif self.type in {AgentFramework.ADK, AgentFramework.CREWAI, AgentFramework.CUSTOM}:
35
+ expected_type = BaseAgentConfig
36
+
37
+ if expected_type is not None and not isinstance(self.config, expected_type):
38
+ raise ValueError(
39
+ f"config must be {expected_type.__name__} when type is {self.type}"
40
+ )
41
+
42
+ return self
@@ -0,0 +1,13 @@
1
+ """Agent framework enumeration (engine)."""
2
+
3
+ from enum import Enum
4
+
5
+
6
+ class AgentFramework(str, Enum):
7
+ """Supported agent frameworks for engine."""
8
+
9
+ LANGGRAPH = "LANGGRAPH"
10
+ ADK = "ADK"
11
+ CREWAI = "CREWAI"
12
+ HAYSTACK = "HAYSTACK"
13
+ CUSTOM = "CUSTOM"
@@ -0,0 +1,29 @@
1
+ """Schemas for engine HTTP API request/response payloads."""
2
+
3
+ from pydantic import BaseModel
4
+
5
+
6
+ class ChatRequest(BaseModel):
7
+ """Request payload for synchronous and streaming chat endpoints.
8
+
9
+ Attributes:
10
+ session_id: Client-provided session identifier for routing state.
11
+ query: Natural language prompt or input for the agent.
12
+
13
+ """
14
+
15
+ session_id: str
16
+ query: str
17
+
18
+
19
+ class ChatResponse(BaseModel):
20
+ """Response payload for chat endpoints.
21
+
22
+ Attributes:
23
+ session_id: Echoed session identifier.
24
+ response: Agent's textual response.
25
+
26
+ """
27
+
28
+ session_id: str
29
+ response: str
@@ -0,0 +1,15 @@
1
+ """Common agent model definitions (engine)."""
2
+
3
+ from typing import Any
4
+
5
+ from pydantic import BaseModel, Field
6
+
7
+ from idun_agent_schema.engine.observability import ObservabilityConfig
8
+
9
+ class BaseAgentConfig(BaseModel):
10
+ """Base model for agent configurations. Extend for specific frameworks."""
11
+
12
+ name: str
13
+ input_schema_definition: dict[str, Any] | None = Field(default_factory=dict)
14
+ output_schema_definition: dict[str, Any] | None = Field(default_factory=dict)
15
+ observability: ObservabilityConfig | None = Field(default=None)
@@ -0,0 +1,13 @@
1
+ """Main engine configuration model."""
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+ from .server import ServerConfig
6
+ from .agent import AgentConfig
7
+
8
+
9
+ class EngineConfig(BaseModel):
10
+ """Main engine configuration model for the entire Idun Agent Engine."""
11
+
12
+ server: ServerConfig = Field(default_factory=ServerConfig)
13
+ agent: AgentConfig
@@ -0,0 +1,13 @@
1
+ """Configuration models for Haystack agents."""
2
+
3
+ from typing import Literal
4
+
5
+ from .base_agent import BaseAgentConfig
6
+
7
+
8
+ class HaystackAgentConfig(BaseAgentConfig):
9
+ """Configuration model for Haystack Agents."""
10
+
11
+ type: Literal["haystack"] = "haystack"
12
+ component_type: Literal["pipeline", "agent"]
13
+ component_definition: str
@@ -0,0 +1,47 @@
1
+ """Configuration models for LangGraph agents (engine)."""
2
+
3
+ from typing import Any, Literal
4
+ from urllib.parse import urlparse
5
+
6
+ from pydantic import BaseModel, field_validator
7
+
8
+ from .base_agent import BaseAgentConfig
9
+
10
+
11
+ class SqliteCheckpointConfig(BaseModel):
12
+ """Configuration for SQLite checkpointer."""
13
+
14
+ type: Literal["sqlite"]
15
+ db_url: str
16
+
17
+ @field_validator("db_url")
18
+ @classmethod
19
+ def db_url_must_be_sqlite(cls, v: str) -> str:
20
+ """Ensure the provided database URL uses the sqlite scheme.
21
+
22
+ Raises:
23
+ ValueError: If the URL does not start with 'sqlite:///'.
24
+
25
+ """
26
+ if not v.startswith("sqlite:///"):
27
+ raise ValueError("SQLite DB URL must start with 'sqlite:///'")
28
+ return v
29
+
30
+ @property
31
+ def db_path(self) -> str:
32
+ """Return filesystem path component derived from the sqlite URL."""
33
+ path = urlparse(self.db_url).path
34
+ if self.db_url.startswith("sqlite:///"):
35
+ return path.lstrip("/")
36
+ return path
37
+
38
+
39
+ CheckpointConfig = SqliteCheckpointConfig
40
+
41
+
42
+ class LangGraphAgentConfig(BaseAgentConfig):
43
+ """Configuration model for LangGraph agents."""
44
+
45
+ graph_definition: str
46
+ checkpointer: CheckpointConfig | None = None
47
+ store: dict[str, Any] | None = None
@@ -0,0 +1,56 @@
1
+ """Provider-agnostic observability configuration model (engine-scoped)."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import os
6
+ from typing import Any
7
+
8
+ from pydantic import BaseModel, Field
9
+
10
+
11
+ def _resolve_env(value: Any) -> Any:
12
+ """Resolve environment placeholders in strings.
13
+
14
+ Supports patterns ${VAR} and $VAR. Non-strings are returned unchanged.
15
+ """
16
+ if isinstance(value, str):
17
+ if value.startswith("${") and value.endswith("}"):
18
+ return os.getenv(value[2:-1])
19
+ if value.startswith("$"):
20
+ return os.getenv(value[1:])
21
+ return value
22
+
23
+
24
+ class ObservabilityConfig(BaseModel):
25
+ """Provider-agnostic observability configuration based on Pydantic.
26
+
27
+ Example YAML:
28
+ observability:
29
+ provider: "langfuse" # or "phoenix"
30
+ enabled: true
31
+ options:
32
+ host: ${LANGFUSE_HOST}
33
+ public_key: ${LANGFUSE_PUBLIC_KEY}
34
+ secret_key: ${LANGFUSE_SECRET_KEY}
35
+ run_name: "my-run"
36
+ """
37
+
38
+ provider: str | None = Field(default=None)
39
+ enabled: bool = Field(default=False)
40
+ options: dict[str, Any] = Field(default_factory=dict)
41
+
42
+ def _resolve_value(self, value: Any) -> Any:
43
+ if isinstance(value, dict):
44
+ return {k: self._resolve_value(v) for k, v in value.items()}
45
+ if isinstance(value, list):
46
+ return [self._resolve_value(v) for v in value]
47
+ return _resolve_env(value)
48
+
49
+ def resolved(self) -> ObservabilityConfig:
50
+ """Return a copy with env placeholders resolved in options."""
51
+ resolved_options = self._resolve_value(self.options)
52
+ return ObservabilityConfig(
53
+ provider=self.provider,
54
+ enabled=self.enabled,
55
+ options=resolved_options,
56
+ )
@@ -0,0 +1,15 @@
1
+ """Server configuration models (engine)."""
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class ServerAPIConfig(BaseModel):
7
+ """API server configuration."""
8
+
9
+ port: int = 8000
10
+
11
+
12
+ class ServerConfig(BaseModel):
13
+ """Configuration for the Engine's universal settings."""
14
+
15
+ api: ServerAPIConfig = Field(default_factory=ServerAPIConfig)
@@ -0,0 +1,9 @@
1
+ """Manager-related schemas."""
2
+
3
+ from .managed_agent import ( # noqa: F401
4
+ ManagedAgentCreate,
5
+ ManagedAgentRead,
6
+ ManagedAgentPatch,
7
+ AgentStatus,
8
+ )
9
+ from .api import ApiKeyResponse # noqa: F401
@@ -0,0 +1,17 @@
1
+ """Pydantic schemas for Agent Manager API I/O."""
2
+
3
+ from datetime import datetime
4
+ from typing import Any
5
+ from uuid import UUID
6
+
7
+ from pydantic import BaseModel, Field, field_validator
8
+
9
+ class ApiKeyResponse(BaseModel):
10
+ """Response shape for a single agent resource."""
11
+
12
+ api_key: str
13
+
14
+ class Config:
15
+ """Pydantic configuration for ORM compatibility."""
16
+
17
+ from_attributes = True
@@ -0,0 +1,58 @@
1
+ """Main managed agent configuration model."""
2
+
3
+ from datetime import datetime
4
+ from typing import Any
5
+ from uuid import UUID
6
+
7
+ from pydantic import BaseModel, Field, field_validator, ConfigDict
8
+
9
+ from idun_agent_schema.engine import EngineConfig
10
+ from enum import Enum
11
+
12
+
13
+ class AgentStatus(str, Enum):
14
+ """Agent status enumeration."""
15
+
16
+ DRAFT = "draft"
17
+ ACTIVE = "active"
18
+ INACTIVE = "inactive"
19
+ DEPRECATED = "deprecated"
20
+ ERROR = "error"
21
+
22
+ # class ManagedAgentBase(BaseModel):
23
+ # """Base model for managed agent configuration."""
24
+
25
+ # id: UUID = Field(, description="Agent UUID")
26
+ # name: str
27
+ # status: AgentStatus = Field(AgentStatus.DRAFT, description="Agent status")
28
+ # version: str | None = Field(None, description="Agent version")
29
+ # engine_config: EngineConfig = Field(..., description="Idun Agent Engine configuration")
30
+ # created_at: datetime = Field(..., description="Creation timestamp")
31
+ # updated_at: datetime = Field(..., description="Last update timestamp")
32
+ # agent_hash: str | None = Field(default=None, description="Agent hash")
33
+
34
+ class ManagedAgentCreate(BaseModel):
35
+ """Create managed agent model for requests."""
36
+
37
+ name: str
38
+ version: str | None = Field(None, description="Agent version")
39
+ engine_config: EngineConfig = Field(..., description="Idun Agent Engine configuration")
40
+
41
+
42
+ class ManagedAgentRead(BaseModel):
43
+ """Complete managed agent model for responses."""
44
+ model_config = ConfigDict(from_attributes=True)
45
+
46
+ id: UUID
47
+ name: str
48
+ status: AgentStatus = Field(AgentStatus.DRAFT, description="Agent status")
49
+ version: str | None = Field(None, description="Agent version")
50
+ engine_config: EngineConfig = Field(..., description="Idun Agent Engine configuration")
51
+ created_at: datetime = Field(..., description="Creation timestamp")
52
+ updated_at: datetime = Field(..., description="Last update timestamp")
53
+
54
+
55
+ class ManagedAgentPatch(BaseModel):
56
+ """Full replacement schema for PUT of a managed agent."""
57
+ name: str
58
+ engine_config: EngineConfig = Field(..., description="Idun Agent Engine configuration")
File without changes
@@ -0,0 +1 @@
1
+ """Shared cross-cutting schemas used by both Engine and Manager."""
@@ -0,0 +1,39 @@
1
+ Metadata-Version: 2.4
2
+ Name: idun-agent-schema
3
+ Version: 0.2.3
4
+ Summary: Centralized Pydantic schema library for Idun Agent Engine and Manager
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: Issues, https://github.com/geoffreyharrazi/idun-agent-platform/issues
8
+ Author-email: Idun Group <contact@idun-group.com>
9
+ License-Expression: MIT
10
+ Keywords: fastapi,idun,langgraph,pydantic,schemas
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Typing :: Typed
17
+ Requires-Python: <3.14,>=3.12
18
+ Requires-Dist: pydantic-settings<3.0.0,>=2.7.0
19
+ Requires-Dist: pydantic<3.0.0,>=2.11.7
20
+ Description-Content-Type: text/markdown
21
+
22
+ # Idun Agent Schema
23
+
24
+ Centralized Pydantic schema library shared by Idun Agent Engine and Idun Agent Manager.
25
+
26
+ ## Install
27
+
28
+ ```bash
29
+ pip install idun-agent-schema
30
+ ```
31
+
32
+ ## Usage
33
+
34
+ ```python
35
+ from idun_agent_schema.engine import EngineConfig
36
+ from idun_agent_schema.manager.api import AgentCreateRequest
37
+ ```
38
+
39
+ This package re-exports stable schema namespaces to avoid breaking existing imports. Prefer importing from this package directly going forward.
@@ -0,0 +1,19 @@
1
+ idun_agent_schema/__init__.py,sha256=fbyxVjqxXFJSYpXiczCrqhxwhmTm6_1H3xyEMuyIVzo,261
2
+ idun_agent_schema/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
+ idun_agent_schema/engine/__init__.py,sha256=jK6jfjb1SlOagLEJmvDMjGebgIcyAu-FHyOsDqRj40U,496
4
+ idun_agent_schema/engine/agent.py,sha256=M6QHYa2yFDXgCDmKaUwZJDdCCNNSGoIow_JqF67b084,1564
5
+ idun_agent_schema/engine/agent_framework.py,sha256=kCrOZl4jf0Om5YW4Ot32pzynatO9orVmn68O0xU8nKQ,266
6
+ idun_agent_schema/engine/api.py,sha256=sN1QGQAuUb4znhR8QJ434sKblEJbDoXQfC4K7L9yyPQ,626
7
+ idun_agent_schema/engine/base_agent.py,sha256=LLFarbDfBVPOztICvRtyqJE2v-H8-j2OeCiBnlqQBRY,542
8
+ idun_agent_schema/engine/engine.py,sha256=ddfVryb5CV6hJ7K9QtGERYpwhgU6obYrs4zEzMFzwyU,339
9
+ idun_agent_schema/engine/haystack.py,sha256=zeJIL1Hc6tUtgO146ZaScWZFPfV-b1bdGDC8BawIFaM,337
10
+ idun_agent_schema/engine/langgraph.py,sha256=j2210QgxWv1SXaDx4gtmMgSiwQtHThUsXDEXDTifehY,1281
11
+ idun_agent_schema/engine/observability.py,sha256=bpZupgXzczwg-fp4QANuho_8yUmvcjaeZR_m6r6lh_M,1748
12
+ idun_agent_schema/engine/server.py,sha256=uEuTi2ow2WOzCW4okqZmgwqEBtekgeA928Yq_gc48jU,338
13
+ idun_agent_schema/manager/__init__.py,sha256=dRhtVlGpse6kcIdSFggWQ3iBsh6Z-Q9jUVvP-XEbRQQ,209
14
+ idun_agent_schema/manager/api.py,sha256=jS1RkUmLmNfNzCNkWyrVMW31VH8FseVe_smq6jAfz-Y,399
15
+ idun_agent_schema/manager/managed_agent.py,sha256=0e523-MFFlqNZkHmC_zLQh8cFyK59D-mHDDykTfZIjM,2109
16
+ idun_agent_schema/shared/__init__.py,sha256=3nb5NzRGfS3B3Q9w_scRa4rdRYY020bBI0fs8nlLOtw,68
17
+ idun_agent_schema-0.2.3.dist-info/METADATA,sha256=CLu4iFE42MOjyVyFZcIY9g7fTcivCmKSX64LJPYqOFQ,1392
18
+ idun_agent_schema-0.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
19
+ idun_agent_schema-0.2.3.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any