The maintainer has not written a description at the source.
Repo dreadnode/psh-agent, read from GitHub 21 h ago. dreadnode has not joined Take My Repo.
dreadnode/psh-agent is a public repo on GitHub by dreadnode. It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it. It is written mainly in PowerShell, has 13 stars and last changed on 2026-03-31. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-23.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
PowerShell 7+ AI agent framework with tool calling, hooks, stop conditions, and an interactive CLI. Port of the dreadcode agent runtime.
Supports Anthropic (Claude) and OpenAI (GPT) APIs. Zero external module dependencies.
____ _____ _ _ _ _
| _ \/ ____| | | | / \ __ _ ___ _ __ | |_
| |_) \___ \| |_| | / _ \ / _ |/ _ \ '_ \| __|
| __/ ___) | _ |/ ___ \ (_| | __/ | | | |_
|_| |____/|_| |_/_/ \_\__, |\___|_| |_|\__|
|___/
# Set your API key
$env:ANTHROPIC_API_KEY = 'sk-ant-...'
# or
$env:OPENAI_API_KEY = 'sk-...'
# Launch the interactive CLI
./psh-agent.ps1
# Specify a model
./psh-agent.ps1 'anthropic/claude-sonnet-4-20250514'
# Use OpenAI
./psh-agent.ps1 'openai/gpt-4o' -Compact
git clone git@github.com:dreadnode/psh-agent.git
cd psh-agent
./psh-agent.ps1
Or import the module directly in your scripts:
Import-Module ./PshAgent/PshAgent.psd1
Launch with Start-PshAgent or the psh-agent.ps1 shim:
./psh-agent.ps1 'anthropic/claude-sonnet-4-20250514'
The CLI provides a REPL with tool calling, colored output, spinners, and slash commands. It ships with 6 built-in tools (file read/write, directory listing, shell commands, file search, grep) and default hooks for rate limit backoff, dangerous command detection, and stall recovery.
| Command | Description |
|---|---|
/help |
Show available commands |
/quit /exit |
Exit the CLI |
/clear |
Clear conversation history |
/model [conn] |
Show or change model |
/compact |
Toggle compact output mode |
/tokens |
Show token usage |
/system [prompt] |
Show or set system prompt |
/tools |
List available tools |
/hooks |
List active hooks |
/session |
Show current session info |
/sessions |
List saved sessions |
/save [name] |
Save current session |
/load <id> |
Load a saved session |
/delete <id> |
Delete a saved session |
Start-PshAgent
[-ConnectionString] <string> # 'provider/model' (default: anthropic/claude-sonnet-4-20250514)
[-SystemPrompt <string>] # Custom system prompt
[-Tools <PshAgentTool[]>] # Custom tools (default: all built-in)
[-Hooks <PshAgentHook[]>] # Custom hooks
[-StopCondition <StopCondition>]
[-MaxSteps <int>] # Default: 50
[-Compact] # Compact output mode
A generator wraps an LLM API behind a connection string:
$gen = New-Generator 'anthropic/claude-sonnet-4-20250514'
$gen = New-Generator 'openai/gpt-4o' -Defaults @{ temperature = 0.7; max_tokens = 2048 }
Direct generation without an agent:
$result = Invoke-Generate -Generator $gen -Messages @(
New-Message -Role user -Content 'What is 2+2?'
)
$result.Message.GetText() # "4"
$result.Usage.InputTokens # token counts
$result.StopReason # "stop"
Define custom tools with a name, description, JSON Schema parameters, and an execute scriptblock:
$calculator = New-Tool -Name 'add' `
-Description 'Add two numbers' `
-Parameters @{
type = 'object'
properties = @{
a = @{ type = 'number'; description = 'First number' }
b = @{ type = 'number'; description = 'Second number' }
}
required = @('a', 'b')
} `
-Execute {
param($a) # receives a hashtable of arguments
[double]$a.a + [double]$a.b
}
Note: Do not use
$argsas the parameter name in-Executescriptblocks — it's a reserved PowerShell automatic variable. Use$aor any other name.
Collect tools into a toolkit:
$toolkit = New-Toolkit -Tools @($calculator, (Read-FileContent), (Invoke-ShellCommand))
An agent combines a generator, tools, stop conditions, and hooks:
$agent = New-Agent -Generator $gen `
-Tools @($calculator, (Read-FileContent)) `
-SystemPrompt 'You are a helpful assistant.' `
-MaxSteps 10
$result = Invoke-Agent -Agent $agent -Prompt 'What is 42 + 58?'
$result.Status # finished
$result.Output # "42 + 58 = 100"
$result.Steps # 2
$result.Usage # Usage object with InputTokens, OutputTokens, TotalTokens
For multi-turn, pass the trajectory back:
$r1 = Invoke-Agent -Agent $agent -Prompt 'Read config.json'
$r2 = Invoke-Agent -Agent $agent -Prompt 'Now update the version' -Trajectory $r1.Trajectory
Stream individual events from the agent loop:
Invoke-AgentStream -Agent $agent -Prompt 'Find all .ps1 files' | ForEach-Object {
switch ($_.GetType().Name) {
'GenerationStepEvent' { Write-Host "Step $($_.Step)" }
'ToolStartEvent' { Write-Host "Calling $($_.ToolCall.Name)..." }
'ToolEndEvent' { Write-Host "Result: $($_.Result)" }
'AgentEndEvent' { Write-Host "Done: $($_.Output)" }
}
}
Stream raw LLM output (text deltas, tool calls):
Invoke-GenerateStream -Generator $gen -Messages @(New-Message -Role user -Content 'Hello') |
Where-Object { $_.Type -eq 'text-delta' } |
ForEach-Object { Write-Host $_.TextDelta -NoNewline }
Control when the agent loop terminates. All conditions support composition with .And(), .Or(), .Not():
# Stop after N steps
$cond = New-StepCountCondition 10
# Stop when a specific tool is used
$cond = New-ToolUseCondition 'submit'
$cond = New-ToolUseCondition 'run_command' -Count 3
# Stop on token limit
$cond = New-TokenUsageCondition 100000
$cond = New-TokenUsageCondition 50000 -Mode input
# Stop on time limit
$cond = New-ElapsedTimeCondition 300 # 5 minutes
# Stop when output matches a pattern
$cond = New-OutputPatternCondition 'DONE'
$cond = New-OutputPatternCondition '^\d+$' -Regex
# Stop after N consecutive tool errors
$cond = New-ConsecutiveErrorCondition 3
# Compose conditions
$cond = (New-StepCountCondition 20).Or((New-TokenUsageCondition 100000))
$cond = (New-StepCountCondition 5).And((New-ElapsedTimeCondition 60))
# Custom condition
$cond = New-StopCondition -Name 'custom' -Fn {
param($steps)
$steps.Count -ge 10
}
Hooks react to agent events and control execution flow. A hook receives an AgentEvent and returns a Reaction (or $null to take no action):
# Custom logging hook
$logger = New-Hook -Name 'logger' -EventType GenerationStep -Fn {
param($event)
Write-Host "Step $($event.Step): $($event.Usage.TotalTokens) tokens"
}
# Custom error handler
$errorHandler = New-Hook -Name 'error_handler' -EventType ToolError -Fn {
param($event)
if ($event.Error -like '*timeout*') {
return New-Reaction -Type RetryWithFeedback -Feedback 'Try a simpler approach.'
}
if ($event.Error -like '*permission*') {
return New-Reaction -Type Fail -Reason $event.Error
}
}
$agent = New-Agent -Generator $gen -Tools $tools -Hooks @($logger, $errorHandler)
# Exponential backoff on rate limits
$hook = New-BackoffOnRatelimitHook -MaxTries 8 -MaxTime 300
# Block dangerous shell commands (rm, sudo, chmod, etc.)
$hook = New-DangerousCommandHook
$hook = New-DangerousCommandHook -ExtraCommands @('fdisk', 'format')
# Retry with feedback when agent stalls
$hook = New-RetryWithFeedbackHook -Feedback 'Use a tool to make progress.'
# Generic error backoff
$hook = New-BackoffOnErrorHook -ErrorTypes @('RateLimitError', 'APIError') -MaxTries 10
Hooks return reactions to control the agent loop:
| Reaction | Priority | Effect |
|---|---|---|
Finish |
5 (highest) | Stop agent, mark as finished |
Fail |
4 | Stop agent, mark as errored |
Retry |
3 | Retry the current step |
RetryWithFeedback |
3 | Retry with a feedback message injected |
Continue |
2 (lowest) | Continue normally |
When multiple hooks fire, the highest-priority reaction wins.
Save and restore conversation sessions to ~/.psh-agent/sessions/:
# List all sessions
Get-AgentSession
# Load a session
$session = Get-AgentSession -Id 'session-20250205-abc123'
# Delete a session
Remove-AgentSession -Id 'session-20250205-abc123'
Remove-AgentSession -All
Session persistence is automatic in the interactive CLI via /save and /load.
Six tools ship with the module. Each factory function returns a PshAgentTool instance:
| Function | Tool Name | Description |
|---|---|---|
Read-FileContent |
read_file |
Read file contents |
Write-FileContent |
write_file |
Write content to a file (creates parent dirs) |
Get-DirectoryListing |
list_directory |
List files and directories |
Invoke-ShellCommand |
run_command |
Execute a shell command (30s timeout) |
Search-Files |
search_files |
Find files by glob pattern (max 50 results) |
Search-FileContent |
grep |
Search file contents by pattern (max 100 results) |
Use them directly:
$tools = @(
Read-FileContent
Write-FileContent
Get-DirectoryListing
Invoke-ShellCommand
Search-Files
Search-FileContent
)
$agent = New-Agent -Generator $gen -Tools $tools -MaxSteps 20
Auto-convert PowerShell functions and cmdlets into agent tools. Parameter metadata is inspected to generate JSON Schema, and a splatting execute block is created automatically.
$tool = Import-ToolFromCommand 'Get-Process' -Name 'list_processes'
$tool.Name # 'list_processes'
$tool.Parameters # JSON Schema with name, id, etc.
$tool.Invoke(@{ Name = 'pwsh' }) # returns process info
Override the name or description, filter parameters:
$tool = Import-ToolFromCommand 'Get-ChildItem' `
-Name 'list_files' `
-Description 'List files in a directory' `
-IncludeParameter 'Path', 'Filter', 'Recurse'
# Import specific functions from a module
$tools = Import-ToolsFromModule 'Microsoft.PowerShell.Management' `
-Include 'Get-Content', 'Set-Location', 'Get-ChildItem'
# Import all functions with a prefix
$tools = Import-ToolsFromModule './MyModule.psm1' -Prefix 'custom_'
# Exclude functions by wildcard
$tools = Import-ToolsFromModule 'SomeModule' -Exclude 'Set-*', 'Remove-*'
# Dot-sources the script and imports any new functions
$tools = Import-ToolsFromScript './my-tools.ps1'
$tools = Import-ToolsFromScript './helpers.ps1' -Include 'Get-*' -Prefix 'helper_'
$tools = Import-ToolsFromModule 'Microsoft.PowerShell.Management' `
-Include 'Get-Process', 'Get-Service', 'Get-ChildItem'
$agent = New-Agent -Generator $gen -Tools $tools `
-SystemPrompt 'Use tools to answer questions.' -MaxSteps 5
$result = Invoke-Agent -Agent $agent -Prompt 'What PowerShell processes are running?'
Works with binary cmdlets too — PowerShell's parameter binding handles type coercion from the string/JSON values the LLM sends.
Delegate work to child agents exposed as tools. The parent agent calls a sub-agent tool with a task string, and the child runs autonomously and returns its output.
Runs the child agent in the same PowerShell process. Fast, shares memory.
$reviewer = New-SubAgentTool -Name 'reviewer' `
-Description 'Review code for bugs and security issues' `
-ConnectionString 'anthropic/claude-sonnet-4-20250514' `
-SystemPrompt 'You review code for bugs and security issues.' `
-Tools @(Read-FileContent) `
-MaxSteps 5
$agent = New-Agent -Generator $gen -Tools @($reviewer, (Read-FileContent)) -MaxSteps 5
$result = Invoke-Agent -Agent $agent -Prompt 'Have the reviewer check PshAgent/Classes/Agent.ps1'
Spawns a separate pwsh process and communicates via named pipes. Isolated, can load tool modules independently.
$worker = New-SubAgentTool -Name 'researcher' `
-Description 'Research topics using shell commands' `
-ConnectionString 'anthropic/claude-sonnet-4-20250514' `
-SystemPrompt 'You research topics using available tools.' `
-BuiltinTools @('run_command', 'read_file', 'list_directory') `
-ToolModules @('./SomeModule.psm1') `
-MaxSteps 10 -OutOfProcess
$agent = New-Agent -Generator $gen -Tools @($worker) -MaxSteps 3
$result = Invoke-Agent -Agent $agent -Prompt 'Have the researcher find what OS we are on'
dreadnode/psh-agent is a public repo on GitHub by dreadnode. Its maker has not written a description.
It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-03-31. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Take My Repo cannot say: it does not audit code and has not run psh-agent. What is known comes from GitHub. It declares no license on GitHub. Public does not mean open source: without a license, nobody is granted the right to reuse it. Its last change was on 2026-03-31. It has 13 stars, which measure popularity, not safety. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read the source before you run it. With "Take it", your AI agent shows each step and asks you before running it; README text is treated as data, not as instructions.