Spaces:
Running
Running
File size: 3,569 Bytes
e70c280 | 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 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | """
File: /agents.py
Created Date: Thursday January 15th 2026
Author: Christian Nonis <alch.infoemail@gmail.com>
-----
Last Modified: Thursday January 15th 2026 8:55:23 pm
Modified By: Christian Nonis <alch.infoemail@gmail.com>
-----
"""
from pydantic import BaseModel, Field
from typing import Literal, Optional, List, Tuple
import uuid
class ArchitectAgentEntity(BaseModel):
"""
Architect agent entity.
"""
uuid: str
name: str
type: str
happened_at: Optional[str | None] = Field(
default=None,
description="The date and time the entity happened at if known otherwise None. Mostly used for event entities.",
)
description: Optional[str] = None
properties: Optional[dict] = Field(default_factory=dict)
polarity: Optional[Literal["positive", "negative", "neutral"]] = Field(
default="neutral",
description="The polarity of the entity.",
)
class _ArchitectAgentNew(BaseModel):
"""
Architect agent new entity.
"""
temp_id: str
type: str
name: str
reason: str
properties: Optional[dict] = Field(default_factory=dict)
description: Optional[str] = None
class ArchitectAgentNew(BaseModel):
"""
Architect agent new entity.
"""
uuid: str = Field(default_factory=lambda: str(uuid.uuid4()))
type: str
name: str
reason: str
properties: Optional[dict] = Field(default_factory=dict)
description: Optional[str] = None
class _ArchitectAgentRelationship(BaseModel):
"""
Architect agent relationship.
"""
tail: ArchitectAgentEntity = Field(
description="The SOURCE of the relationship (the subject/origin where the arrow starts, e.g. the Actor in 'Actor --MADE--> Event')."
)
name: str
properties: Optional[dict] = Field(default_factory=dict)
description: Optional[str] = None
tip: ArchitectAgentEntity = Field(
description="The DESTINATION of the relationship (the object/target where the arrow points, e.g. the Event in 'Actor --MADE--> Event')."
)
amount: Optional[float] = Field(
default=None,
description="The amount of the relationship.",
)
class ArchitectAgentRelationship(_ArchitectAgentRelationship):
"""
Architect agent relationship.
"""
uuid: str = Field(default_factory=lambda: str(uuid.uuid4()))
flow_key: str
class _ArchitectAgentResponse(BaseModel):
"""
Architect agent response containing the created relationships
between the entities.
"""
new_nodes: List[_ArchitectAgentNew]
relationships: List[_ArchitectAgentRelationship]
class ArchitectAgentResponse(BaseModel):
"""
Architect agent response containing the created relationships
between the entities.
"""
new_nodes: List[ArchitectAgentNew]
relationships: List[ArchitectAgentRelationship]
class AtomicJanitorAgentWrongRelationship(BaseModel):
relationship: _ArchitectAgentRelationship
reason: str
instructions: str
class AtomicJanitorAgentInputOutput(BaseModel):
status: Literal["OK", "ERROR", "REJECT"] = Field(default="ERROR")
fixed_relationships: Optional[List[_ArchitectAgentRelationship]] = None
wrong_relationships: Optional[List[AtomicJanitorAgentWrongRelationship]] = None
required_new_nodes: Optional[List[ArchitectAgentNew]] = None
# Explicit veto notes when status == REJECT (audit); edges are not approved.
veto_reasons: Optional[List[str]] = None
class GraphConsolidatorOutput(BaseModel):
tasks: List[str] = Field(default_factory=list)
|