Edge¶
edge
¶
Edge models — typed connections between agents in a society graph.
Edges are first-class primitives, not configuration. A binary edge connects two agents; a group edge (hyperedge) connects N agents for edge types with natural N-ary semantics (Competition, Cooperation, Coopetition).
Edges are typically created through the Society builder API rather than instantiated directly.
Edge
¶
Bases: BaseModel
A binary connection between two agents.
Represents a directed relationship from source to target with typed semantics determined by the edge type.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
The originating agent. |
required | |
target
|
The receiving agent. |
required | |
type
|
The edge type defining relationship semantics. |
required | |
edge_id
|
Unique identifier (auto-generated if not provided). |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If source and target are the same agent. |
agents
property
¶
Return both agents on this edge.
GroupEdge
¶
Bases: BaseModel
An N-ary connection (hyperedge) among multiple agents.
Used for edge types with natural group semantics: Competition (tournament with N entrants), Cooperation (N agents sharing an artifact), and Coopetition (multi-party negotiation).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
members
|
The participating agents (minimum 2). |
required | |
type
|
The edge type defining relationship semantics. |
required | |
edge_id
|
Unique identifier (auto-generated if not provided). |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If fewer than 2 members, duplicate members, or the edge type doesn't support group semantics. |
agents
property
¶
Return all member agents.