AHP Integration
Agent Harness Protocol 2.4 integration
AHP Integration
A3S Code exposes AHP 2.4 transport configuration so an external harness can be
connected to the agent loop. Node sessions accept stdio, HTTP, WebSocket, and
Unix socket transport objects. Python exposes the same transport families through
SessionOptions.ahp_transport. Validate live harness behavior against the AHP
server you deploy.
Event Surface
AHP events include handshake, session start/end, pre-action, post-action, pre-prompt, post-response, error, query, heartbeat, and idle.
Treat AHP decisions as an integration contract with your harness. Do not rely on organization policy behavior until it has been tested against the live AHP server you deploy.
Transports
Node sessions accept AHP transport objects through ahpTransport:
Set AHP_ENDPOINT to the deployed HTTP endpoint and AHP_AUTH_TOKEN only when
your harness requires bearer-style authentication.
import {
HttpTransport,
StdioTransport,
WebSocketTransport,
UnixSocketTransport,
} from '@a3s-lab/code';
const ahpEndpoint = process.env.AHP_ENDPOINT;
if (!ahpEndpoint) throw new Error('AHP_ENDPOINT is required');
const session = agent.session('/repo', {
ahpTransport: new HttpTransport(
ahpEndpoint,
process.env.AHP_AUTH_TOKEN,
),
});Available transports:
StdioTransport(program, args)HttpTransport(url, authToken)WebSocketTransport(url, authToken)UnixSocketTransport(path)on Unix targets only
Unix sockets are not available on Windows targets.
Python uses opts.ahp_transport:
The Python examples use the same environment variables.
import os
from a3s_code import Agent, HttpTransport, SessionOptions
agent = Agent.create("agent.acl")
opts = SessionOptions()
opts.ahp_transport = HttpTransport(
os.environ["AHP_ENDPOINT"],
os.environ.get("AHP_AUTH_TOKEN"),
)
session = agent.session("/repo", opts)Rust attaches AHP at the core layer by creating an AHP hook executor and passing
it through SessionOptions::with_hook_executor(...). The current SDK contract
does not include an ACL-level AHP block.
Recommended Use
Keep AHP decisions small and explicit. Let the coding agent continue doing local reasoning, while the harness handles the safety, context, approval, or idle control paths that your live integration test covers.