Object.Application (object v0.1.2)

Main OTP Application for the AAOS Object system.

This module implements the main supervision tree and system initialization for the Autonomous Agent Object Specification (AAOS) framework. It manages:

  • Core object supervision and lifecycle management
  • Message routing infrastructure
  • System-wide coordination services
  • Performance monitoring and telemetry
  • Demonstration system creation
  • Health monitoring and alerts

The application follows OTP principles with a hierarchical supervision strategy that ensures fault tolerance and system resilience.

Summary

Functions

Creates a complete demonstration system with various object types.

Creates a new object in the system.

Gets comprehensive system status information.

Lists all currently active objects in the system.

Starts the AAOS Object System application.

Stops the AAOS Object System application.

Stops an object by its ID.

Functions

create_demonstration_system()

Creates a complete demonstration system with various object types.

Sets up a realistic demonstration environment including:

  • AI agents with different capabilities
  • Human client objects
  • Sensor and actuator objects
  • Coordinator objects
  • Interaction dyads between related objects
  • Coordination tasks and scenarios

This is useful for testing, demos, and understanding system behavior.

Returns

Map containing:

  • :objects_created - Number of successfully created objects
  • :total_objects - Total objects attempted
  • :results - Detailed results for each object creation attempt

Examples

iex> Object.Application.create_demonstration_system()
%{
  objects_created: 7,
  total_objects: 7,
  results: [{:ok, "ai_agent_alpha", #PID<0.789.0>}, ...]
}

create_object(object_spec)

Creates a new object in the system.

Dynamically starts a new object server under the dynamic supervisor with the provided specification.

Parameters

  • object_spec - Object specification struct with id, state, methods, etc.

Returns

  • {:ok, pid} - Success with the object's process PID
  • {:error, reason} - Failure reason

Examples

iex> spec = %Object{id: "test_obj", state: %{value: 1}}
iex> Object.Application.create_object(spec)
{:ok, #PID<0.456.0>}

get_system_status()

Gets comprehensive system status information.

Returns detailed metrics about system health, performance, and operational status across all subsystems.

Returns

Map containing:

  • :objects - Object count and type information
  • :performance - System performance metrics
  • :coordination - Coordination service metrics
  • :evolution - Schema evolution metrics
  • :message_routing - Message routing statistics
  • :uptime - System uptime in milliseconds

Examples

iex> Object.Application.get_system_status()
%{
  objects: %{total: 5, by_type: %{ai_agent: 2, sensor: 3}},
  performance: %{avg_response_time: 12.5},
  uptime: 3600000
}

handle_system_telemetry(event, measurements, metadata, config)

list_objects()

Lists all currently active objects in the system.

Returns

  • List of object IDs currently registered in the system

Examples

iex> Object.Application.list_objects()
["ai_agent_alpha", "sensor_1", "coordinator_main"]

start(type, args)

Starts the AAOS Object System application.

Initializes the complete supervision tree including:

  • Core object supervisor
  • Message routing subsystem
  • Telemetry configuration
  • Post-startup system initialization

Parameters

  • _type - Application start type (typically :normal)
  • _args - Application arguments (unused)

Returns

  • {:ok, pid} - Success with supervisor PID
  • {:error, reason} - Failure with error reason

Examples

iex> Object.Application.start(:normal, [])
{:ok, #PID<0.123.0>}

stop(state)

Stops the AAOS Object System application.

Performs graceful shutdown including cleanup of system resources and orderly termination of all objects.

Parameters

  • _state - Application state (unused)

Returns

  • :ok - Always returns ok after cleanup

stop_object(object_id)

Stops an object by its ID.

Looks up the object in the registry and terminates its process under the dynamic supervisor.

Parameters

  • object_id - String identifier of the object to stop

Returns

  • :ok - Object stopped successfully
  • {:error, :object_not_found} - Object not found in registry
  • {:error, reason} - Other termination error