Skip to main content

Overview

Pensar Apex is built on an autonomous agent architecture powered by large language models. Rather than following rigid scripts, the tool uses AI agents that reason about targets, plan testing strategies, and execute security assessments adaptively. At the core is the OffensiveSecurityAgent harness, a general-purpose agent framework that manages the interaction between AI models and security testing tools. Specialized agents extend this harness with domain-specific behavior for different phases of testing.

Agent Harness

The OffensiveSecurityAgent class provides the foundation for all testing agents:

Key Features

Tool Management

The harness owns tool creation and activation. Specialized agents declare which tools they need via the activeTools array.

Streaming Architecture

Agents start streaming immediately on construction. Consume via callbacks, for await, or raw stream access.

Typed Results

Use resolveResult or responseSchema to get strongly-typed outputs from agent runs.

Approval Gates

Optional operator approval for tool calls enables human-in-the-loop workflows.

Agent Input Configuration

All agents accept a common input structure:

Specialized Agents

Pensar Apex includes four specialized agent types, each optimized for a specific phase of security testing:

Attack Surface Agent

Purpose: Discover and map the entire attack surface of a target Location: src/core/agents/specialized/attackSurface/
Output: AttackSurfaceResult
  • Discovered assets (domains, services, endpoints)
  • Identified authentication flows
  • Prioritized targets for deep testing
  • Attack surface analysis report
The attack surface agent operates in two modes:
  • Blackbox: Probes a live target from the outside (no source code access)
  • Whitebox: Analyzes source code directly to extract endpoints and routes

Authentication Agent

Purpose: Handle authentication and session management Location: src/core/agents/specialized/authenticationAgent/
Output: AuthenticationResult
  • Success status
  • Authentication strategy used
  • Exported cookies and headers
  • Session persistence data
The authentication agent never sees raw credentials. It uses a CredentialManager that resolves credential IDs to secrets at execution time, keeping sensitive data out of agent prompts and logs.

Pentest Agent

Purpose: Perform targeted vulnerability testing against specific endpoints Location: src/core/agents/specialized/pentest/
Output: PentestResult
  • Discovered vulnerabilities
  • Proof-of-concept scripts
  • Evidence and impact analysis
  • Remediation guidance
The pentest agent operates in blackbox mode — it never reads source code. It tests targets purely through external interaction: HTTP requests, browser automation, and observable behavior.

Offensive Security Agent (General)

Purpose: Orchestrate complex workflows and delegate to specialized agents Location: src/core/agents/offSecAgent/ The base OffensiveSecurityAgent can be used directly for custom workflows that don’t fit the specialized agent patterns. It has access to all tools and can:
  • Orchestrate multi-phase testing campaigns
  • Delegate to specialized agents via delegate_to_auth_subagent
  • Run custom testing methodologies
  • Integrate with external tools and services

Agent Communication

Agents communicate through several mechanisms:

Parent-Child Delegation

Parent agents can spawn specialized child agents:

Shared State

Agents share state through the session:
  • Findings Registry: Prevents duplicate vulnerability reports across agents
  • Credential Manager: Secure credential sharing without exposing secrets
  • Session Storage: Persistent files (POCs, screenshots, reports)

Stream Events

Agents emit typed stream events that can be consumed by parents:

Agent Lifecycle

  1. Construction: Agent is instantiated with input configuration
  2. Tool Creation: Harness builds the toolset based on activeTools
  3. Stream Start: AI SDK stream begins immediately
  4. Agent Loop: Model reasons, calls tools, receives results, continues
  5. Stop Condition: Agent stops when condition is met (tool call, step count, etc.)
  6. Result Resolution: resolveResult or responseSchema produces typed output

Usage Example

Here’s how to use the specialized agents:

Best Practices

  • Use AttackSurfaceAgent for reconnaissance and discovery
  • Use AuthenticationAgent for login flows and session management
  • Use PentestAgent for targeted vulnerability testing
  • Use base OffensiveSecurityAgent only for custom workflows
  • Share FindingsRegistry across agents to prevent duplicate reports
  • Use CredentialManager for secure credential handling
  • Store session data in the session directory for persistence
  • Always consume agent streams (callbacks, for await, or .consume())
  • Forward subagent events to parent consumers when orchestrating
  • Handle errors gracefully with onError callbacks
  • Use stopWhen conditions to prevent infinite loops
  • Leverage abortSignal for user-initiated cancellation
  • Set up approvalGate for human-in-the-loop workflows

Attack Surface Discovery

Learn how agents map your application’s attack surface

Findings & Reports

Understand vulnerability findings and deduplication

API Reference

Complete API documentation for all agent classes

Tool System

Explore the tools available to agents