App-Raider
view release on metacpan or search on metacpan
.claude/skills/perl-ai-langertha/SKILL.md view on Meta::CPAN
## Simple Chat
```perl
# Synchronous
my $response = $engine->simple_chat('What is Perl?');
print $response; # Stringifies to content
# Async
use Future::AsyncAwait;
my $response = await $engine->simple_chat_f('Tell me a story.');
say $response->model; # Model name
say $response->prompt_tokens; # Token usage
say $response->completion_tokens;
say $response->thinking; # Chain-of-thought (if available)
```
`Langertha::Response` overloads `""` so it works in string contexts.
</simple-chat>
<tool-calling>
## Tool Calling with MCP
### Step 1: Create MCP Server with tools
.claude/skills/perl-ai-langertha/SKILL.md view on Meta::CPAN
```perl
my $engine = Langertha::Engine::Anthropic->new(
api_key => $ENV{ANTHROPIC_API_KEY},
model => 'claude-sonnet-4-6',
mcp_servers => [$mcp], # Pass MCP server(s)
);
# One-shot tool calling
my $response = await $engine->chat_with_tools_f('Find all .pm files in lib/');
say $response;
```
</tool-calling>
<raider>
## Raider â Autonomous Agent
```perl
use Langertha::Raider;
my $raider = Langertha::Raider->new(
.claude/skills/perl-ai-langertha/SKILL.md view on Meta::CPAN
context_compress_threshold => 0.75,
compression_engine => $cheap_model,
raider_mcp => 1, # Enable self-tools (ask_user, pause, abort)
plugins => ['Langfuse'],
);
# Raid (autonomous tool-calling loop)
my $result = await $raider->raid_f('Review lib/App.pm');
# Result handling
say $result; # Stringified response
say $result->is_question; # Agent asked a question
say $result->is_abort; # Agent aborted
# Continue conversation (has context from previous raids)
my $r2 = await $raider->raid_f('Now suggest improvements.');
# Respond to question
if ($result->is_question) {
my $next = await $raider->respond_f('Yes, go ahead.');
}
# History management
$raider->add_history('user', $content); # Replay from DB
$raider->clear_history; # Reset
# Metrics
my $m = $raider->metrics;
say "Iterations: $m->{iterations}";
say "Tool calls: $m->{tool_calls}";
```
### Raid Loop (simplified)
1. Auto-compress history if context threshold exceeded
2. Gather tools from MCP servers + inline tools + self-tools
3. Build conversation: mission + history + new messages
4. Call LLM with tools
5. If tool calls: execute via MCP, add results to conversation, loop
6. If no tool calls: extract final text, persist to history, return result
( run in 0.721 second using v1.01-cache-2.11-cpan-d7a12ab2c7f )