Represents an agent's identity within a team, including ID, name, role, and team membership. It loads from environment variables and can export them for spawning sub-agents.
# Source: https://github.com/win4r/ClawTeam-OpenClaw | License: MIT | Copyright 2025 HKUDS
# Provided via justclaw.it.com; keep this notice with the code.
class AgentIdentity:
"""Identity of an agent within a team (or standalone)."""
agent_id: str = field(default_factory=lambda: uuid.uuid4().hex[:12])
agent_name: str = "agent"
user: str = ""
agent_type: str = "general-purpose"
team_name: str | None = None
is_leader: bool = False
plan_mode_required: bool = False
model: str | None = None
@property
def in_team(self) -> bool:
return self.team_name is not None
@classmethod
def from_env(cls) -> AgentIdentity:
"""Build identity from CLAWTEAM_* with OPENCLAW_* / OH_* / CLAUDE_CODE_* fallbacks."""
user = os.environ.get("
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key