NAME

Langertha::Raider::Plugin::Events - Report a raid's tool calls and results as machine-output events

VERSION

version 0.504

SYNOPSIS

my $raider = Langertha::Raider->new(
    engine  => $engine,
    plugins => [ '+Langertha::Raider::Plugin::Events' => {
      on_event => sub { my ( $type, %payload ) = @_; ... },
    } ],
);

DESCRIPTION

The source of the tool.call and tool.result events of a raid: the output of raider --stream-json and its siblings (ADR 0013) and the session journal (ADR 0015) are both fed from here. Every tool call the raid makes is handed to "on_event" twice: before it runs, with its name and arguments, and after, with the outcome and the whole text of its result -- a consumer that shows less (the stream) cuts it itself.

Load it after any plugin that may skip or rewrite a tool call, so the events describe the call that actually runs.

on_event

Code reference called as $on_event->($type, %payload). Required.

tool.call -- call (the id of the call within the raid: c1, c2, ...), name, arguments and status (dispatched). The id is also recorded as call in the call's context ("plugins" in Langertha::Raider), where an async tool's handler finds it.
tool.result -- call (the id of its tool.call, also when calls ran at the same time), name, status (cancelled for a call cut off by "cancel" in Langertha::Raider, failed when the tool reported an error, else succeeded), ok (the same as a boolean), size (characters of the text) and content (the whole text).
message -- role (user) and content, right after the tool.result of a call whose result hands the raid a user message (the body of a skill, "TOOL RESULTS THAT ADD MESSAGES" in Langertha::Raider).
model.usage -- after every model call of the raid that reports tokens: purpose (chat), model, input_tokens, output_tokens and, when the provider reports them, cache_read_tokens and cache_write_tokens (both part of input_tokens; ADR 0026).

SEE ALSO

SUPPORT

Issues

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

IRC

Join #langertha on irc.perl.org or message Getty directly.

CONTRIBUTING

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

AUTHOR

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

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.

https://raudssus.de/