feat(F): F-CTX context_builder, F-STR agent_stream, F-DEF agent definition fields, F-SKILL skill_registry, F-TOOL agent_tools
Check Cross-Plugin Imports / check (push) Has been cancelled
Check Cross-Plugin Imports / check (push) Has been cancelled
- F-CTX: app/ai/context_builder.py (282 lines) — build_agent_context() + ReActSystemPromptBuilder - F-STR: app/ai/agent_stream.py (155 lines) — stream_react_loop() with SSE events (step, status, done, error) - F-DEF: AgentDefinition fields added (temperature, max_tokens, max_steps, trace_mode, skill_ids, trigger_config, ai_use_case_metadata) + migration 0122 - F-SKILL: app/ai/skill_registry.py (82 lines) — SkillDefinition + SkillRegistry singleton - F-TOOL: app/ai/agent_tools.py (117 lines) — get_agent_tools() with permission intersection - Skill CRUD routes: app/plugins/builtins/automation/skill_routes.py - Tests: test_skill_registry.py (97 lines), test_agent_tools.py (219 lines) - All Python compile checks pass, tests require PostgreSQL (infra issue, not code bug)
This commit is contained in:
@@ -23,6 +23,13 @@ class AgentDefinitionCreate(BaseModel):
|
||||
max_executions_per_hour: int = Field(default=10, ge=1, le=1000)
|
||||
max_duration_seconds: int = Field(default=300, ge=1, le=86400)
|
||||
budget_limit_usd: float = Field(default=1.0, ge=0.0, le=10000.0)
|
||||
temperature: float = Field(default=0.3, ge=0.0, le=2.0)
|
||||
max_tokens: int = Field(default=1000, ge=1, le=100000)
|
||||
max_steps: int = Field(default=20, ge=1, le=100)
|
||||
trace_mode: str = Field(default="standard", pattern="^(standard|extended)$")
|
||||
skill_ids: list[str] = Field(default_factory=list)
|
||||
trigger_config: dict[str, Any] = Field(default_factory=dict)
|
||||
ai_use_case_metadata: dict[str, Any] = Field(default_factory=dict)
|
||||
|
||||
|
||||
class AgentDefinitionUpdate(BaseModel):
|
||||
@@ -326,3 +333,52 @@ class SubtaskListResponse(BaseModel):
|
||||
|
||||
items: list[SubtaskRead]
|
||||
total: int
|
||||
|
||||
|
||||
# ─── Skill Definition Schemas (Phase F-SKILL) ───
|
||||
|
||||
|
||||
class SkillDefinitionCreate(BaseModel):
|
||||
"""Create a new skill definition."""
|
||||
|
||||
name: str = Field(..., min_length=1, max_length=255)
|
||||
description: str = Field(..., min_length=1)
|
||||
instructions: str = Field(..., min_length=1)
|
||||
allowed_tool_ids: list[str] = Field(default_factory=list)
|
||||
context_policy: dict[str, Any] | None = None
|
||||
category: str = Field(default="general", max_length=100)
|
||||
is_active: bool = Field(default=True)
|
||||
|
||||
|
||||
class SkillDefinitionUpdate(BaseModel):
|
||||
"""Update an existing skill definition (partial)."""
|
||||
|
||||
name: str | None = Field(None, min_length=1, max_length=255)
|
||||
description: str | None = Field(None, min_length=1)
|
||||
instructions: str | None = Field(None, min_length=1)
|
||||
allowed_tool_ids: list[str] | None = None
|
||||
context_policy: dict[str, Any] | None = None
|
||||
category: str | None = Field(None, max_length=100)
|
||||
is_active: bool | None = None
|
||||
|
||||
|
||||
class SkillDefinitionResponse(BaseModel):
|
||||
"""Skill definition response."""
|
||||
|
||||
id: str
|
||||
name: str
|
||||
description: str
|
||||
instructions: str
|
||||
allowed_tool_ids: list[str] = []
|
||||
context_policy: dict[str, Any] | None = None
|
||||
category: str = "general"
|
||||
is_active: bool = True
|
||||
created_at: str | None = None
|
||||
updated_at: str | None = None
|
||||
|
||||
|
||||
class SkillDefinitionListResponse(BaseModel):
|
||||
"""Paginated skill definition list."""
|
||||
|
||||
items: list[SkillDefinitionResponse]
|
||||
total: int
|
||||
|
||||
Reference in New Issue
Block a user