Relations - API Specification
Introduction
This document specifies the Application Programming Interface (API) for the Relations module. The primary purpose of this API is to provide customer relationship management (CRM) capabilities, including contact management, interaction logging, tagging, and social graph visualization.
Endpoints / Functions / Interfaces
Enum: InteractionType
- Description: Types of communication events that can be logged against a contact.
- Module:
codomyrmex.relations.crm - Values:
EMAIL- Email communicationCALL- Phone or voice callMEETING- In-person or virtual meetingSOCIAL_MEDIA- Social media interaction
Class: Interaction (dataclass)
- Description: Record of a communication event with a contact.
- Module:
codomyrmex.relations.crm - Parameters/Arguments (constructor):
type(InteractionType): The type of interactionsummary(str): Brief description of the interactiontimestamp(datetime, optional): When the interaction occurred. Defaults todatetime.now()id(UUID, optional): Unique identifier. Auto-generated viauuid4()if not provided
Class: Contact (dataclass)
- Description: Represents an external entity (person or organization) in the CRM. Supports tagging for categorization and maintains a history of interactions.
- Module:
codomyrmex.relations.crm - Parameters/Arguments (constructor):
name(str): Contact nameemail(Optional[str], optional): Email address. Defaults toNonephone(Optional[str], optional): Phone number. Defaults toNonetags(Set[str], optional): Set of tags for categorization. Defaults to empty sethistory(List[Interaction], optional): List of past interactions. Defaults to empty listid(UUID, optional): Unique identifier. Auto-generated viauuid4()if not provided
- Methods:
log_interaction(interaction: Interaction) -> None: Append an interaction to the contact's history.add_tag(tag: str) -> None: Add a tag to the contact's tag set.
Class: CRM
- Description: Customer Relationship Management engine. Provides contact storage, search, and retrieval.
- Module:
codomyrmex.relations.crm - Parameters/Arguments (constructor): None
- Methods:
add_contact(contact: Contact) -> None: Add a contact to the CRM.search(query: str) -> List[Contact]: Search contacts by name or email (case-insensitive substring match). Returns a list of matching contacts.get_contact(contact_id: UUID) -> Optional[Contact]: Retrieve a contact by UUID. ReturnsNoneif not found.
Function: render_social_graph(crm: CRM) -> MermaidDiagram
- Description: Generates a Mermaid diagram showing all contacts in the CRM as nodes in a social graph.
- Module:
codomyrmex.relations.visualization - Parameters/Arguments:
crm(CRM): The CRM instance to visualize
- Returns/Response:
MermaidDiagram- A top-down Mermaid graph with one node per contact, titled "Social Graph".
Data Models
Contact (dataclass)
| Field | Type | Default | Description |
|---|---|---|---|
name | str | required | Contact name |
email | Optional[str] | None | Email address |
phone | Optional[str] | None | Phone number |
tags | Set[str] | set() | Categorization tags |
history | List[Interaction] | [] | Interaction history |
id | UUID | auto-generated | Unique identifier |
Interaction (dataclass)
| Field | Type | Default | Description |
|---|---|---|---|
type | InteractionType | required | Type of communication |
summary | str | required | Brief description |
timestamp | datetime | datetime.now() | When the interaction occurred |
id | UUID | auto-generated | Unique identifier |
Authentication & Authorization
Not applicable for this internal relations module.
Rate Limiting
Not applicable for this internal relations module.
Versioning
This module follows the general versioning strategy of the Codomyrmex project. API stability is aimed for, with changes documented in the CHANGELOG.md.
Navigation Links
- Parent: Project Overview
- Module Index: All Agents
- Documentation: Reference Guides
- Home: Root README