NAME

Langertha::Knarr::Handler::Raider - Knarr handler that backs each session with a Langertha::Raider

VERSION

version 1.001

SYNOPSIS

use Langertha::Engine::Anthropic;
use Langertha::Raider;
use Langertha::Knarr::Handler::Raider;

my $handler = Langertha::Knarr::Handler::Raider->new(
    model_id => 'langertha-raider',
    raider_factory => sub {
        my ($session, $request) = @_;
        return Langertha::Raider->new(
            engine  => Langertha::Engine::Anthropic->new(
                api_key => $ENV{ANTHROPIC_API_KEY},
            ),
            mission => 'You are a helpful assistant.',
        );
    },
);

DESCRIPTION

Spawns a fresh Langertha::Raider per Knarr session via "raider_factory" and dispatches the latest user message to its raid_f method. The Raider keeps its own conversation history across turns within a session, so subsequent requests in the same session continue the same agent loop.

Use this when you're exposing a real autonomous agent (with MCP tools, mission, persistent context) over a standard LLM wire protocol.

raider_factory

Required. Coderef called as $factory->($session, $request) the first time a session needs a Raider. The returned Raider is cached on the session and reused for subsequent turns.

model_id

Optional. The id reported by "list_models". Defaults to steerboard-raider.

SUPPORT

Issues

Please report bugs and feature requests on GitHub at https://github.com/Getty/langertha-knarr/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.