NAME

Langertha::Role::PluginHost - Role for objects that host plugins (Raider, Engine)

VERSION

version 0.302

DESCRIPTION

Shared role consumed by Langertha::Raider, Langertha::Chat, Langertha::Embedder, Langertha::ImageGen, and engine classes to provide a plugin system with lifecycle management and a custom event bus.

Plugins are instantiated lazily on first use. Each plugin receives the host as its host attribute. Short names are resolved to Langertha::Plugin::$name or LangerthaX::Plugin::$name. Prefixing a name with + bypasses resolution and loads the class directly.

plugins

plugins => ['Langfuse']
plugins => [Langfuse => { trace_name => 'my-trace', auto_flush => 1 }]
plugins => [$plugin_instance]

ArrayRef of plugin specifications. Each entry may be:

  • A short name string (resolved to Langertha::Plugin::$name)

  • A short name followed by a HashRef of constructor args

  • A fully qualified class name (with or without + prefix)

  • An already-instantiated Langertha::Plugin object

fire_event_f

my @results = await $host->fire_event_f('history_saved', $data);

Fires a custom event to all loaded plugins that implement on_$event_name. Returns a list of all plugin return values. Plugins declare the events they provide via "provides_events" in Langertha::Plugin and the events they require via "requires_events" in Langertha::Plugin.

SEE ALSO

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha/issues.

CONTRIBUTING

Contributions are welcome! Please fork the repository and submit a pull request.

AUTHOR

Torsten Raudssus <torsten@raudssus.de> https://raudss.us/

COPYRIGHT AND LICENSE

This software is copyright (c) 2026 by Torsten Raudssus.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.