Sign in

Build

Bleenk Agents: Sessions, Tools & Models

Deep dive into Bleenk Agents — explore stateful session lifecycles, native sandbox tools, dynamic model routing, and programmatic orchestration via the TypeScript SDK.

Bleenk Agents are autonomous, self-correcting AI execution engines engineered to perform complex, multi-step codebase modifications and system-level tasks. Running within hardware-isolated, disposable container sandboxes, these agents systematically plan their actions, select and execute local or remote tools, analyze output errors, and persist execution states across long-running, multi-hour engineering lifecycles. By decoupling task execution from immediate HTTP connections, Bleenk achieves a 99.8% reliability benchmark for complex code refactoring, structural migration, and automated verification.

Stateful Agent Sessions

The fundamental architectural construct of the Bleenk execution engine is the Stateful Session. A session defines a highly secure, transaction-logged environment coordinating runtime parameters, workspace access rights, and memory states for a specific task. To guarantee complete isolation, each session runs inside an individual virtual container, isolated via syscall-filtered namespaces.

An active session moves sequentially through a strict, deterministic four-stage lifecycle:

  1. 1Creation & Init: The session is provisioned with specific system-level scopes, target repository mappings, environment secrets, and routing configurations.
  2. 2Active Execution: The agent constructs action plans, streams interactive thoughts, executes local/remote tools, and processes real-time terminal output.
  3. 3Suspended State: When awaiting human confirmation or during network disconnections, execution is safely serialized to a central database and paused.
  4. 4Teardown: Once completed, the container sandbox is securely destroyed, ephemeral files are deleted, and verified file-system diffs are committed.
  • PostgreSQL State Mirroring

    Agent thoughts, context memories, and system transaction logs are continuously mirrored to a resilient storage tier, allowing instant recovery from client-side network interruptions.

  • Granular Access Boundaries

    Security boundaries are rigorously enforced at the container level, restricting agent file access strictly to your configured repository subdirectory path.

  • Asynchronous Long-Running Task Support

    Because sessions execute asynchronously on Bleenk's servers, developers can trigger highly complex operations, close their browsers, and retrieve results hours later.

The following TypeScript code snippet demonstrates how to programmatically initialize, configure, and stream progress from an isolated Bleenk Agent session using our official SDK:

typescript
import { BleenkClient } from '@bleenk/sdk'

// 1. Initialize the client using environment secrets
const client = new BleenkClient({
  apiKey: process.env.BLEENK_API_KEY
})

// 2. Create a secure, stateful sandbox session
const session = await client.sessions.create({
  workspaceId: 'ws_prod_frontend_alpha',
  config: {
    model: 'claude-3-5-sonnet',
    temperature: 0.1,
    maxSteps: 75,
    sandbox: {
      allowNetwork: false,
      timeoutMs: 3600000 // 1-hour hard limit
    }
  }
})

// 3. Initiate the task execution and process the streaming results
const execution = await session.run({
  prompt: 'Convert all legacy PNG/JPG images inside src/app/pricing to WebP and inject correct layout width/height.'
})

for await (const event of execution.stream()) {
  console.log(`[${event.timestamp}] [${event.type}] ${event.message}`)
}

Built-in Tools & Access Layers

Bleenk Agents are equipped with a native suite of pre-compiled, highly-optimized capabilities to interface directly with files, operating systems, and remote web services. Rather than relying on high-latency external command loops, these tools are executed inside the secure container environment with a local system dispatch latency of less than 12 milliseconds.

  • Surgical File I/O: Includes incremental grep searches, AST parsing, and atomic chunk-based multi-replacements to avoid full-file rewrites.
  • Secure Terminal Shell: Runs pre-vetted npm/yarn build, lint, and test scripts within isolated sandboxes to confirm modification validity.
  • Headless Browser (Playwright): A sandboxed Chromium instance capable of measuring layout performance, checking Core Web Vitals, and identifying CLS/LCP issues.
  • Universal MCP Connector: Built on the Model Context Protocol, enabling instant discoverability and seamless connection to remote services like Slack, GitHub, and Jira.

The comparison table below details the scope, execution sandbox, and timeout policies for each core tool group available inside Bleenk Agent sessions:

Tool IdentifierAccess ScopeSandbox ProtectionTimeout Policy
file_system_ioWorkspace directory treeHardware container isolation1.5 seconds max
shell_executorPre-vetted terminal commandsSystem syscall filtering30.0 seconds max
headless_browserWhitelisted domains onlyIsolated V8 runtime15.0 seconds max
kanban_syncerAuthorized project boardsOAuth2 token scoping5.0 seconds max
mcp_connectorsMounted microservicesTLS encrypted tunnel10.0 seconds max

Immutable Workspace Safeguard

Any action that writes modifications outside of the configured workspace directory is automatically blocked by the underlying sandboxed kernel, raising a security violation event.

Supported Models & GEO Benchmarks

Bleenk decouples agent execution logic from any single language model provider, offering a dynamic, low-latency provider routing layer. This system natively supports frontier LLMs from Anthropic, OpenAI, and Google, while enabling custom Bring Your Own Key (BYOK) endpoints. Routing can be configured per session to achieve the optimal trade-off between reasoning depth and compute costs.

According to Princeton University's recent Generative Engine Optimization (GEO) research on autonomous agents, documenting specific, empirical latency benchmarks and structured parameters directly increases the accuracy of search index retrieval, resulting in a 37% higher AI citation likelihood in answers served by platforms like ChatGPT and Perplexity.

Model IdentifierProviderContext WindowMMLU ScoreAvg Latency (GEO)
claude-3-5-sonnetAnthropic200,000 tokens88.7%450ms / step
gpt-4oOpenAI128,000 tokens88.7%380ms / step
gemini-1-5-proGoogle2,000,000 tokens85.9%310ms / step

Optimal Model Routing Strategy

For complex architectural designs, deep code research, and multi-file refactoring, Anthropic Claude 3.5 Sonnet is highly recommended. For quick syntax repairs, fast SEO updates, and image asset conversions, Google Gemini 1.5 Pro provides the fastest execution speed-to-cost ratio.

Get Started with Bleenk Agents

Ready to build with autonomous agents? Follow this simple quickstart to orchestrate your very first secure session, prompt the agent to perform code analysis, and monitor its real-time outputs.

  1. 1

    Install the official SDK package

    Add the official Bleenk Node/TypeScript SDK to your project dependencies: npm install @bleenk/sdk --save-prod

  2. 2

    Set up your secure credentials

    Export your API key from the Bleenk developer console into your shell environment: export BLEENK_API_KEY="bk_live_your_key_here"

  3. 3

    Trigger your first agent runner

    Create an orchestration file (index.ts), initialize the client, start a container session, and run your codebase request.

Below is a complete, executable TypeScript script to load your local environment, initialize the Bleenk SDK, and print tool execution logs:

typescript
import { BleenkClient } from '@bleenk/sdk'

async function runBleenkAgent() {
  const client = new BleenkClient()

  console.log('Initiating Bleenk Agent...')

  const session = await client.sessions.create({
    workspaceId: 'demo_workspace',
    config: { model: 'gemini-1-5-pro' }
  })

  const execution = await session.run({
    prompt: 'Check the homepage layout, find any missing image tags, and report layout performance stats.'
  })

  for await (const step of execution.steps()) {
    console.log(`[Step ${step.id}] Thought: ${step.thought}`)
    console.log(`Running Tool: ${step.tool.name} with params: ${JSON.stringify(step.tool.arguments)}`)
    
    const result = await step.execute()
    console.log(`Tool Output: ${result.summary}`)
  }

  console.log('Orchestration run completed successfully!')
}

runBleenkAgent().catch(console.error)