Forge documentation
Library referencePython

forge.collab

Python collab package; imports are explicit from this package.

Python collab package; imports are explicit from this package.

Package contract

FieldValue
Languagepython
Source version0.1.0
Manifestforge-py/pyproject.toml
Source files9
EvidenceSource reference; registry publication and runtime conformance are separate checks

Import boundary

import forge.collab

Use a source checkout or your verified private registry. Manifest coordinates identify the package; they do not establish that a public registry release exists.

Source reference

Download package reference JSON. Each original source file and generated declaration artifact has its own SHA-256 digest. Function bodies and constant values are omitted from downloads. These are source declaration inventories, not compiler-resolved rustdoc, TypeDoc, DocC, or Dokka output. Private modules can contain public declarations that are not reachable through the package boundary; consult the entry point before importing.

capability.py

Read declaration text · 5 declaration entries

class CapabilityAdvertiser(Protocol)

def advertise_capabilities(self) -> AgentCapabilityProfile

def can_handle(self, task_type: str) -> bool

def current_availability(self) -> float

def match_task_to_agents(task: DelegatedTask, agents: list[AgentCapabilityProfile]) -> list[str]

context.py

Read declaration text · 14 declaration entries

class SharedContextContract(Protocol)

async def context_read(self, session_id: str, key: str) -> ContextEntry

async def context_write(self, session_id: str, entry: ContextEntry) -> None

async def context_keys(self, session_id: str) -> list[str]

class InMemorySharedContext()

def __init__(self) -> None

def create_session(self, session_id: str) -> None

def session_count(self) -> int

def write_entry(self, session_id: str, entry: ContextEntry) -> None

def read_entry(self, session_id: str, key: str) -> ContextEntry

def list_keys(self, session_id: str) -> list[str]

async def context_read(self, session_id: str, key: str) -> ContextEntry

async def context_write(self, session_id: str, entry: ContextEntry) -> None

async def context_keys(self, session_id: str) -> list[str]

delegation.py

Read declaration text · 2 declaration entries

def create_delegated_task(delegator_did: str, task_type: str, description: str, input_data: Any, priority: TaskPriority=TaskPriority.NORMAL, constraints: TaskConstraints | None=None) -> DelegatedTask

def validate_task_constraints(constraints: TaskConstraints) -> None

errors.py

Read declaration text · 25 declaration entries

class CollabError(ForgeError)

class SessionNotFoundError(CollabError)

def __init__(self, session_id: str) -> None

class SessionAlreadyActiveError(CollabError)

def __init__(self, session_id: str) -> None

class InvalidSessionTransitionError(CollabError)

def __init__(self, from_state: str, to_state: str) -> None

class NotAParticipantError(CollabError)

def __init__(self, agent_did: str, session_id: str) -> None

class TaskNotFoundError(CollabError)

def __init__(self, task_id: str) -> None

class TaskAlreadyAssignedError(CollabError)

def __init__(self, task_id: str, assignee: str) -> None

class CapabilityMismatchError(CollabError)

def __init__(self, task_type: str, agent_did: str, reason: str) -> None

class ContextKeyNotFoundError(CollabError)

def __init__(self, key: str) -> None

class ContextPermissionDeniedError(CollabError)

def __init__(self, key: str, agent_did: str) -> None

class InterruptRejectedError(CollabError)

def __init__(self, interrupt_id: str, reason: str) -> None

class DelegationFailedError(CollabError)

def __init__(self, reason: str) -> None

class RoleViolationError(CollabError)

def __init__(self, agent_did: str, role: str, action: str) -> None

interrupt.py

Read declaration text · 4 declaration entries

class InterruptHandler(Protocol)

async def on_interrupt(self, interrupt: Interrupt) -> InterruptResponse

async def on_preempt(self, interrupt: Interrupt) -> InterruptedState

def create_interrupt(interrupt_type: InterruptType, source_did: str, priority: TaskPriority, payload: Any) -> Interrupt

roles.py

Read declaration text · 14 declaration entries

class CoordinatorContract(Protocol)

async def decompose_task(self, task: DelegatedTask) -> list[DelegatedTask]

async def assign_task(self, task: DelegatedTask, worker_did: str) -> TaskAcknowledgment

async def aggregate_results(self, results: list[TaskResult]) -> TaskResult

async def handle_worker_failure(self, task_id: str, worker_did: str, error: str) -> None

class WorkerContract(Protocol)

async def on_task_delegated(self, task: DelegatedTask) -> TaskAcknowledgment

async def report_progress(self, progress: TaskProgress) -> None

async def submit_result(self, result: TaskResult) -> None

async def on_task_cancelled(self, task_id: str, reason: str) -> None

class PeerContract(Protocol)

async def propose(self, proposal: Any) -> str

async def vote(self, proposal_id: str, approve: bool) -> None

async def on_consensus(self, proposal_id: str, result: Any) -> None

session.py

Read declaration text · 11 declaration entries

class SessionContract(Protocol)

async def on_session_join(self, session: CollaborationSession, role: CollaborationRole) -> None

async def on_session_transition(self, session_id: str, from_state: SessionState, to_state: SessionState) -> None

async def on_session_leave(self, session_id: str, reason: str) -> None

class SessionManager()

def __init__(self) -> None

def state(self) -> SessionState

def transition(self, target: SessionState) -> SessionTransition

def can_transition_to(self, target: SessionState) -> bool

def valid_transitions(self) -> list[SessionState]

def history(self) -> list[SessionTransition]

types.py

Read declaration text · 21 declaration entries

class CollaborationRole(Enum)

class SessionState(Enum)

def valid_transitions(self) -> list[SessionState]

def is_terminal(self) -> bool

class TaskStatus(Enum)

class TaskPriority(Enum)

class InterruptType(Enum)

class ContextVisibility(Enum)

class SessionParticipant()

class TaskConstraints()

class DelegatedTask()

class TaskResult()

class TaskAcknowledgment()

class TaskProgress()

class Interrupt()

class InterruptResponse()

class InterruptedState()

class ContextEntry()

class AgentCapabilityProfile()

class SessionTransition()

class CollaborationSession()

Continue

On this page