feat: support str for paths

This commit is contained in:
Greyson Lalonde
2026-03-05 20:17:09 -05:00
parent fe8060f719
commit 00d3d435e2
2 changed files with 20 additions and 3 deletions

View File

@@ -215,11 +215,19 @@ class BaseAgent(BaseModel, ABC, metaclass=AgentMeta):
"If not set, falls back to crew memory."
),
)
skills: list[Path | Skill] | None = Field(
skills: list[str | Path | Skill] | None = Field(
default=None,
description="Agent Skills. Accepts Paths for discovery or pre-loaded Skill objects.",
description="Agent Skills. Accepts paths (str or Path) for discovery or pre-loaded Skill objects.",
)
@field_validator("skills", mode="before")
@classmethod
def coerce_skill_paths(cls, v: list[Any] | None) -> list[Path | Skill] | None:
"""Coerce string entries to Path objects."""
if not v:
return v
return [Path(item) if isinstance(item, str) else item for item in v]
@model_validator(mode="before")
@classmethod
def process_model_config(cls, values: Any) -> dict[str, Any]:

View File

@@ -292,10 +292,19 @@ class Crew(FlowTrackable, BaseModel):
default=None,
description="Knowledge for the crew.",
)
skills: list[Path] | None = Field(
skills: list[str | Path] | None = Field(
default=None,
description="Skill search paths applied to all agents in the crew.",
)
@field_validator("skills", mode="before")
@classmethod
def coerce_skill_paths(cls, v: list[Any] | None) -> list[Path] | None:
"""Coerce string entries to Path objects."""
if not v:
return v
return [Path(item) if isinstance(item, str) else item for item in v]
security_config: SecurityConfig = Field(
default_factory=SecurityConfig,
description="Security configuration for the crew, including fingerprinting.",