# Agent-Core Bridge

This package is protocol-level and agent-agnostic. It exposes
`ResponsesHandler` and the HTTP host, but it does not depend on
`@cuylabs/agent-core`.

Use `@cuylabs/agent-foundry-hosting/responses` when an `agent-core` agent needs
to run behind the Responses protocol.

```ts
import { runResponsesServer } from "@cuylabs/agent-foundry-agentserver-responses";
import { createResponsesHandlerForAgent } from "@cuylabs/agent-foundry-hosting/responses";
import {
  InProcessAgentServer,
} from "@cuylabs/agent-server";
import { createAgentCoreServerAdapter } from "@cuylabs/agent-server/agent-core";

const server = new InProcessAgentServer(createAgentCoreServerAdapter(myAgent));

await runResponsesServer({
  handler: createResponsesHandlerForAgent(server),
  port: 8088,
});
```

## Responsibilities

The bridge owns agent runtime translation:

- starts an `agent-server` turn for each create-response request
- sends the normalized user input into the turn
- maps `agent-core` events to Responses stream events
- forwards cancellation to `interruptTurn`
- closes the wrapped server when the handler closes

The responses package still owns protocol concerns:

- Express routing
- SSE framing
- response IDs and session IDs
- `ResponseContext`
- response snapshots
- storage and stream replay
- platform headers and tracing

Keep this split intact. New protocol behavior belongs in
`agent-foundry-agentserver-responses`. New agent-runtime mapping behavior
belongs in `agent-foundry-hosting/responses`.
