> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ports

A port is one capability of the runtime behind an interface the package defines. `ports` is the full set, `AgentHarnessPorts` version 2 of the contract, and it is the runtime plugged into the harness. The harness reaches the instance's storage and scheduler only through it. The raw environment, the actor context and the actor storage never cross the boundary.

| Port | What it is |
| - | - |
| `identity` | The instance's id, asserted by the host and never taken from an input. |
| `activation` | An opaque token, stable for one live activation of the instance. |
| `clock` | The host's clock, used by queue and schedule operations. |
| `messages` | The message log, with `append`, `appendMany`, `all`, `last` and `count`. |
| `state` | The state, with `get`, `merge` and `replace`. |
| `events` | The event log, with `emit`, `read` and `count`. |
| `tasks` | The task scheduler, with `queue`, `schedule`, `every`, `cancel` and `list`, delivered at least once. |
| `sql` | The per-instance SQL surface, `exec` and `transactionSync`. |
| `environment` | An explicitly selected, immutable bag of bindings. Nothing crosses by default. |
| `authorization` | The gateway-attested identity and policy that approval decisions require. Optional, and approvals fail closed without it. |

On the Agent Runtime, [the runtime adapter](/docs/agent-sdk/harness-sdk/adapters/runtime#on-the-agent-runtime) builds the ports from members of the [`Agent`](/docs/agent-sdk/runtime-sdk) class.

## Building Ports

`createRuntimeAgentHarnessPorts(agent, { environmentKeys })` builds the ports from an instance of the Agent Runtime SDK's [`Agent`](/docs/agent-sdk/runtime-sdk) class, through a seam the runtime owns and without reflecting over the class. `environmentKeys` names the bindings that cross into `environment`, and none do unless named.

For tests, `createNodeAgentHarnessPorts(options)` from `@telnyx/agent-harness/node` is a deterministic plain-Node implementation, in memory for the log, state, events and tasks, and file-backed through `node:sqlite` for SQL. `defineAgentHarnessPortsContract(label, factory)` from `@telnyx/agent-harness/contract` registers the shared contract suite against any adapter, so a host of the user's own is checked against the same semantics as the runtime's.

The contract module imports `vitest`, an optional peer dependency, so `vitest` must be installed wherever the suite runs. The suite asserts fixed fixture values. The factory's ports must report the identity id `"contract-agent"`, a clock reading of `1_700_000_000_000` and the environment `{ MODEL: "deterministic-model" }`.
