This repository was archived by the owner on Dec 7, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodels.py
More file actions
44 lines (35 loc) · 1.65 KB
/
models.py
File metadata and controls
44 lines (35 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from __future__ import annotations
from typing import List, Optional
from pydantic import BaseModel, Field, ConfigDict
class TaskSchema(BaseModel):
"""Single task definition executed by an agent."""
description: str = Field(..., examples=["Collect articles about AI"])
expected_output: Optional[str] = Field(
None,
alias="expected_output",
examples=["List of article URLs"]
)
context: Optional[List[str]] = Field(
default_factory=list,
examples=[["Use only academic sources"]]
)
agent: Optional[str] = Field(None, examples=["researcher"])
model_config = ConfigDict(populate_by_name=True)
class AgentSchema(BaseModel):
"""CrewAI-style agent configuration."""
role: str = Field(..., examples=["researcher"])
goal: Optional[str] = Field(None, examples=["Provide an overview of AI trends"])
backstory: Optional[str] = Field(None, examples=["PhD in computer science"])
tools: List[str] = Field(default_factory=list, examples=[["browser"]])
allow_delegation: bool = Field(False, alias="allow_delegation", examples=[True])
tasks: List[TaskSchema] = Field(default_factory=list)
model_config = ConfigDict(populate_by_name=True)
class BehaviorDefinition(BaseModel):
"""Root object describing agent behaviors loaded from Notion."""
agents: List[AgentSchema] = Field(
default_factory=list,
examples=[[{"role": "researcher", "goal": "Find info"}]]
)
tasks: List[TaskSchema] = Field(default_factory=list)
process: Optional[str] = Field("sequential", examples=["sequential"])
model_config = ConfigDict(populate_by_name=True)