---
title: LangChain API
description: Generated public TypeScript reference for @relkit/langchain.
search:
  exclude: true
sidebar:
  icon: braces
---

{/* Generated by apps/docs/scripts/generate.ts. Do not edit. */}

For configuration and examples, read [ai](/docs/modules/ai), [tools](/docs/modules/ai/tools), [function tools](/docs/modules/ai/function-tools).

## Frontend usage

[Observe an agent and send controls](/docs/modules/ai/streaming#use-from-the-frontend) shows the client side of this capability.

## Public imports

- `@relkit/langchain` — 298 exports
- `@relkit/langchain/runtime` — 20 exports
- `@relkit/langchain/continuation-validation` — 3 exports
- `@relkit/langchain/testing` — 19 exports

## All exported APIs

Names link to their complete contracts. Re-exports share their original contract; legacy exports keep their separate identity. Examples link to the API's inline sample, a maintained repository usage, or the shared module walkthrough.

| API                                                                                                               | Kind  | Import from                                                      | Example                                                                                                                                         |
| ----------------------------------------------------------------------------------------------------------------- | ----- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
| [AcceptControlRequest](/docs/api/app#acceptcontrolrequest-interface)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AcceptRunReceipt](/docs/api/app#acceptrunreceipt-interface)                                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AcceptRunRequest](/docs/api/app#acceptrunrequest-interface)                                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AdmitContinuationRequest](/docs/api/app#admitcontinuationrequest-type-alias)                                     | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AGENT_OBSERVABILITY_PROTOCOL](/docs/api/agents#agent_observability_protocol)                                     | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AGENT_OBSERVABILITY_VERSION](/docs/api/agents#agent_observability_version)                                       | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentApprovalHandler](/docs/api/integrations/langchain#agentapprovalhandler-type-alias)                          | Type  | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentCapturePolicy](/docs/api/agents#agentcapturepolicy-interface)                                               | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentcapturepolicy-interface)                                                                                    |
| [AgentCapturePolicyError](/docs/api/agents#agentcapturepolicyerror-class)                                         | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentCaptureRecord](/docs/api/agents#agentcapturerecord-interface)                                               | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentcapturerecord-interface)                                                                                    |
| [AgentChatMapping](/docs/api/agents#agentchatmapping-interface)                                                   | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentchatmapping-interface)                                                                                      |
| [AgentClientEvent](/docs/api/app#agentclientevent-type-alias)                                                     | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/client/tests/compatibility/agent-observation.test.ts#L174)                |
| [agentClientEvents](/docs/api/agents#agentclientevents-1)                                                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentclientevents-1)                                                                                             |
| [AgentClientEvents](/docs/api/agents#agentclientevents-type-alias)                                                | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentclientevents-type-alias)                                                                                    |
| [agentClientEventsEffect](/docs/api/agents#agentclienteventseffect)                                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentclienteventseffect)                                                                                         |
| [AgentClientPolicy](/docs/api/agents#agentclientpolicy-type-alias)                                                | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentclientpolicy-type-alias)                                                                                    |
| [AgentClientPolicyError](/docs/api/agents#agentclientpolicyerror-class)                                           | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentClientStateKey](/docs/api/integrations/langchain#agentclientstatekey-type-alias)                            | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/middleware-state.types.ts#L26)               |
| [AgentContentSink](/docs/api/integrations/langchain#agentcontentsink-interface)                                   | Type  | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/runtime-hono/tests/fixtures/native-todo.ts#L40)                           |
| [AgentControl](/docs/api/agents#agentcontrol-type-alias)                                                          | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentcontrol-type-alias)                                                                                         |
| [AgentConversationMessage](/docs/api/integrations/langchain#agentconversationmessage-interface)                   | Type  | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentDescriptor](/docs/api/integrations/langchain#agentdescriptor-interface)                                     | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentEdgeRelationship](/docs/api/agents#agentedgerelationship-type-alias)                                        | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentedgerelationship-type-alias)                                                                                |
| [AgentExecution](/docs/api/integrations/langchain#agentexecution-class)                                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#agentexecution-class)                                                                            |
| [AgentExecutionEvent](/docs/api/app#agentexecutionevent-interface)                                                | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/client/tests/compatibility/agent-observation.test.ts#L236)                |
| [AgentExecutionLive](/docs/api/integrations/langchain#agentexecutionlive)                                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#agentexecutionlive)                                                                              |
| [AgentExecutionService](/docs/api/integrations/langchain#agentexecutionservice-interface)                         | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentExecutionSnapshot](/docs/api/app#agentexecutionsnapshot-interface)                                          | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentFilesystemBackend](/docs/api/integrations/langchain#agentfilesystembackend-type-alias)                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentInstructions](/docs/api/integrations/langchain#agentinstructions-type-alias)                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentInvocationFailure](/docs/api/integrations/langchain#agentinvocationfailure-class)                           | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentInvocationOptions](/docs/api/integrations/langchain#agentinvocationoptions-interface)                       | Type  | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentLimits](/docs/api/integrations/langchain#agentlimits-interface)                                             | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentMiddleware](/docs/api/integrations/langchain#agentmiddleware-type-alias)                                    | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/native-authoring.test.ts#L117)               |
| [AgentMiddlewareState](/docs/api/integrations/langchain#agentmiddlewarestate-type-alias)                          | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/middleware-state.types.ts#L23)               |
| [AgentModel](/docs/api/integrations/langchain#agentmodel-type-alias)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentModelFactory](/docs/api/integrations/langchain#agentmodelfactory-type-alias)                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentObservabilitySink](/docs/api/agents#agentobservabilitysink-interface)                                       | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentobservabilitysink-interface)                                                                                |
| [AgentObservation](/docs/api/app#agentobservation-type-alias)                                                     | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/client/tests/compatibility/agent-observer.test.ts#L97)                    |
| [AgentObservedEdge](/docs/api/agents#agentobservededge-interface)                                                 | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentobservededge-interface)                                                                                     |
| [AgentOperation](/docs/api/agents#agentoperation-type-alias)                                                      | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentoperation-type-alias)                                                                                       |
| [AgentPersistenceDeclaration](/docs/api/integrations/langchain#agentpersistencedeclaration-interface)             | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentProgressEvent](/docs/api/app#agentprogressevent-type-alias)                                                 | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentProgressScope](/docs/api/app#agentprogressscope-type-alias)                                                 | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentRequestScope](/docs/api/app#agentrequestscope-interface)                                                    | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/providers-local/tests/agent-state-failure/fixture.ts#L57)                 |
| [AgentRuntime](/docs/api/integrations/langchain#agentruntime-interface)                                           | Type  | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentRuntimeBaseOptions](/docs/api/integrations/langchain#agentruntimebaseoptions-interface)                     | Type  | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentRuntimeError](/docs/api/integrations/langchain#agentruntimeerror-class)                                     | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/failure-diagnostics.test.ts#L67)             |
| [AgentRuntimeHooks](/docs/api/agents#agentruntimehooks-interface)                                                 | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentruntimehooks-interface)                                                                                     |
| [AgentRuntimeOptions](/docs/api/integrations/langchain#agentruntimeoptions-type-alias)                            | Type  | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/packed-consumer/public-types.fixture.ts#L10) |
| [AgentSpanCapture](/docs/api/agents#agentspancapture-interface)                                                   | Type  | `@relkit/langchain`                                              | [API example](/docs/api/agents#agentspancapture-interface)                                                                                      |
| [AgentStateLimits](/docs/api/app#agentstatelimits-interface)                                                      | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/providers-local/tests/agent-state-failure/fixture.ts#L21)                 |
| [AgentStateProvider](/docs/api/app#agentstateprovider-interface)                                                  | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/providers-local/tests/agent-state/fixture.ts#L57)                         |
| [AgentSteeringSource](/docs/api/integrations/langchain#agentsteeringsource-interface)                             | Type  | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentSubagent](/docs/api/integrations/langchain#agentsubagent-type-alias)                                        | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/native-authoring.test.ts#L129)               |
| [AgentTelemetry](/docs/api/agents#agenttelemetry-class)                                                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#agenttelemetry-class)                                                                                            |
| [AgentTelemetryLive](/docs/api/agents#agenttelemetrylive)                                                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#agenttelemetrylive)                                                                                              |
| [AgentTelemetryService](/docs/api/agents#agenttelemetryservice-interface)                                         | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentTool](/docs/api/integrations/langchain#agenttool-type-alias)                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentToolEvent](/docs/api/app#agenttoolevent-type-alias)                                                         | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentTransitionError](/docs/api/app#agenttransitionerror-type-alias)                                             | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentWaitingRequest](/docs/api/app#agentwaitingrequest-interface)                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AgentWaitingState](/docs/api/app#agentwaitingstate-interface)                                                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [AppendJournalRequest](/docs/api/app#appendjournalrequest-interface)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [APPROVAL_STATES](/docs/api/agents#approval_states)                                                               | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ApprovalDeniedError](/docs/api/agents#approvaldeniederror-class)                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#approvaldeniederror-class)                                                                                       |
| [ApprovalEffectError](/docs/api/agents#approvaleffecterror-class)                                                 | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ApprovalMetadata](/docs/api/agents#approvalmetadata-interface)                                                   | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ApprovalOptions](/docs/api/agents#approvaloptions-interface)                                                     | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ApprovalPolicy](/docs/api/agents#approvalpolicy-type-alias)                                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ApprovalRecord](/docs/api/agents#approvalrecord-type-alias)                                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ApprovalRequiredError](/docs/api/agents#approvalrequirederror-class)                                             | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#approvalrequirederror-class)                                                                                     |
| [ApprovalSideEffect](/docs/api/agents#approvalsideeffect-type-alias)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ApprovalState](/docs/api/agents#approvalstate-type-alias)                                                        | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ApprovalStateError](/docs/api/agents#approvalstateerror-class)                                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#approvalstateerror-class)                                                                                        |
| [approveApproval](/docs/api/agents#approveapproval)                                                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#approveapproval)                                                                                                 |
| [approveApprovalEffect](/docs/api/agents#approveapprovaleffect)                                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#approveapprovaleffect)                                                                                           |
| [ApprovedApproval](/docs/api/agents#approvedapproval-interface)                                                   | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [assertAgentDescriptor](/docs/api/integrations/langchain#assertagentdescriptor)                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#assertagentdescriptor)                                                                           |
| [assertAgentRuntimeDependencies](/docs/api/integrations/langchain#assertagentruntimedependencies-1)               | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [assertAgentTrace](/docs/api/integrations/langchain#assertagenttrace)                                             | Value | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [assertApprovalGranted](/docs/api/agents#assertapprovalgranted)                                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#assertapprovalgranted)                                                                                           |
| [assertApprovalGrantedEffect](/docs/api/agents#assertapprovalgrantedeffect)                                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#assertapprovalgrantedeffect)                                                                                     |
| [assertGraphDestination](/docs/api/integrations/langchain#assertgraphdestination)                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#assertgraphdestination)                                                                          |
| [assertGraphDestinationEffect](/docs/api/integrations/langchain#assertgraphdestinationeffect)                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#assertgraphdestinationeffect)                                                                    |
| [assertGraphNodeDestinations](/docs/api/integrations/langchain#assertgraphnodedestinations-1)                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#assertgraphnodedestinations-1)                                                                   |
| [assertPersistenceProtocol](/docs/api/integrations/langchain#assertpersistenceprotocol)                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#assertpersistenceprotocol)                                                                       |
| [assertPersistenceProtocolEffect](/docs/api/integrations/langchain#assertpersistenceprotocoleffect)               | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#assertpersistenceprotocoleffect)                                                                 |
| [BrowserMessage](/docs/api/app#browsermessage-interface)                                                          | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/client/tests/compatibility/agent-observation.test.ts#L23)                 |
| [BrowserMessagePart](/docs/api/app#browsermessagepart-type-alias)                                                 | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [captureAgentContent](/docs/api/agents#captureagentcontent)                                                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#captureagentcontent)                                                                                             |
| [captureAgentContentEffect](/docs/api/agents#captureagentcontenteffect)                                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#captureagentcontenteffect)                                                                                       |
| [CheckpointerResource](/docs/api/integrations/langchain#checkpointerresource-type-alias)                          | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ClaimControlRequest](/docs/api/app#claimcontrolrequest-interface)                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ClaimRunRequest](/docs/api/app#claimrunrequest-interface)                                                        | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [clientPolicyCount](/docs/api/agents#clientpolicycount)                                                           | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [clientPolicyFailures](/docs/api/agents#clientpolicyfailures)                                                     | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [CompleteRunRequest](/docs/api/app#completerunrequest-interface)                                                  | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [CompletionReceipt](/docs/api/app#completionreceipt-interface)                                                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ContinuationIdentity](/docs/api/app#continuationidentity-interface)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ContinuationReceipt](/docs/api/app#continuationreceipt-interface)                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ContinuationReceiptLookup](/docs/api/app#continuationreceiptlookup-type-alias)                                   | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ControlClaim](/docs/api/app#controlclaim-interface)                                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ControlEffectOutcome](/docs/api/app#controleffectoutcome-type-alias)                                             | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ControlLimits](/docs/api/app#controllimits-interface)                                                            | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ControlPage](/docs/api/app#controlpage-interface)                                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ControlReceipt](/docs/api/app#controlreceipt-interface)                                                          | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ControlReceiptLookup](/docs/api/app#controlreceiptlookup-type-alias)                                             | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ControlRecord](/docs/api/app#controlrecord-interface)                                                            | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ControlStatus](/docs/api/app#controlstatus-type-alias)                                                           | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [copyAgentChat](/docs/api/agents#copyagentchat)                                                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#copyagentchat)                                                                                                   |
| [copyAgentChatEffect](/docs/api/agents#copyagentchateffect)                                                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#copyagentchateffect)                                                                                             |
| [copyAgentClientPolicy](/docs/api/agents#copyagentclientpolicy)                                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#copyagentclientpolicy)                                                                                           |
| [copyAgentClientPolicyEffect](/docs/api/agents#copyagentclientpolicyeffect)                                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#copyagentclientpolicyeffect)                                                                                     |
| [copyAgentControls](/docs/api/agents#copyagentcontrols)                                                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#copyagentcontrols)                                                                                               |
| [copyAgentControlsEffect](/docs/api/agents#copyagentcontrolseffect)                                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#copyagentcontrolseffect)                                                                                         |
| [copyAgentLimits](/docs/api/agents#copyagentlimits)                                                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#copyagentlimits)                                                                                                 |
| [copyAgentLimitsEffect](/docs/api/agents#copyagentlimitseffect)                                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#copyagentlimitseffect)                                                                                           |
| [createAgentCapturePolicy](/docs/api/agents#createagentcapturepolicy)                                             | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#createagentcapturepolicy)                                                                                        |
| [createAgentCapturePolicyEffect](/docs/api/agents#createagentcapturepolicyeffect)                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#createagentcapturepolicyeffect)                                                                                  |
| [createAgentRuntime](/docs/api/integrations/langchain#createagentruntime)                                         | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [API example](/docs/api/integrations/langchain#createagentruntime)                                                                              |
| [createAgentRuntimeEffect](/docs/api/integrations/langchain#createagentruntimeeffect)                             | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [API example](/docs/api/integrations/langchain#createagentruntimeeffect)                                                                        |
| [createAgentSpanCapture](/docs/api/agents#createagentspancapture)                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#createagentspancapture)                                                                                          |
| [createAgentSpanCaptureEffect](/docs/api/agents#createagentspancaptureeffect)                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#createagentspancaptureeffect)                                                                                    |
| [createApproval](/docs/api/agents#createapproval)                                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#createapproval)                                                                                                  |
| [createApprovalEffect](/docs/api/agents#createapprovaleffect)                                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#createapprovaleffect)                                                                                            |
| [createGeneratedAgentFunction](/docs/api/agents#creategeneratedagentfunction)                                     | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [API example](/docs/api/agents#creategeneratedagentfunction)                                                                                    |
| [createGeneratedAgentFunctionEffect](/docs/api/agents#creategeneratedagentfunctioneffect)                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#creategeneratedagentfunctioneffect)                                                                              |
| [createGraphEdgeBuilder](/docs/api/integrations/langchain#creategraphedgebuilder)                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#creategraphedgebuilder)                                                                          |
| [createGraphEdgeBuilderEffect](/docs/api/integrations/langchain#creategraphedgebuildereffect)                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#creategraphedgebuildereffect)                                                                    |
| [createSubgraphNode](/docs/api/integrations/langchain#createsubgraphnode)                                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#createsubgraphnode)                                                                              |
| [createSubgraphNodeEffect](/docs/api/integrations/langchain#createsubgraphnodeeffect)                             | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#createsubgraphnodeeffect)                                                                        |
| [createTestAgent](/docs/api/integrations/langchain#createtestagent)                                               | Value | `@relkit/langchain/testing`                                      | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/owned-compatibility.ts#L71)                        |
| [createTestModel](/docs/api/integrations/langchain#createtestmodel)                                               | Value | `@relkit/langchain/testing`                                      | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/fixtures/checked-examples.ts#L33)                           |
| [CreateThreadReceipt](/docs/api/app#createthreadreceipt-interface)                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [CreateThreadRequest](/docs/api/app#createthreadrequest-interface)                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [decideThreadTransition](/docs/api/agents#decidethreadtransition)                                                 | Value | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/thread-transition.test.ts#L20)               |
| [decideThreadTransitionEffect](/docs/api/agents#decidethreadtransitioneffect)                                     | Value | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/thread-transition.test.ts#L45)               |
| [DeepAgentCapabilities](/docs/api/integrations/langchain#deepagentcapabilities-interface)                         | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [defineAgent](/docs/api/integrations/langchain#defineagent)                                                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#defineagent)                                                                                     |
| [defineAgentEffect](/docs/api/integrations/langchain#defineagenteffect)                                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#defineagenteffect)                                                                               |
| [DefineAgentOptions](/docs/api/integrations/langchain#defineagentoptions-interface)                               | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [defineCheckpointerDb](/docs/api/integrations/langchain#definecheckpointerdb)                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#definecheckpointerdb)                                                                            |
| [defineCheckpointerDbEffect](/docs/api/integrations/langchain#definecheckpointerdbeffect)                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#definecheckpointerdbeffect)                                                                      |
| [defineGraph](/docs/api/integrations/langchain#definegraph)                                                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#definegraph)                                                                                     |
| [defineGraphEffect](/docs/api/integrations/langchain#definegrapheffect)                                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#definegrapheffect)                                                                               |
| [defineGraphNode](/docs/api/integrations/langchain#definegraphnode)                                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#definegraphnode)                                                                                 |
| [defineGraphNodeEffect](/docs/api/integrations/langchain#definegraphnodeeffect)                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#definegraphnodeeffect)                                                                           |
| [DefineGraphNodeOptions](/docs/api/integrations/langchain#definegraphnodeoptions-interface)                       | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [DefineGraphOptions](/docs/api/integrations/langchain#definegraphoptions-interface)                               | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [defineMemoryDb](/docs/api/integrations/langchain#definememorydb)                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#definememorydb)                                                                                  |
| [defineMemoryDbEffect](/docs/api/integrations/langchain#definememorydbeffect)                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#definememorydbeffect)                                                                            |
| [DeniedApproval](/docs/api/agents#deniedapproval-interface)                                                       | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [denyApproval](/docs/api/agents#denyapproval)                                                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#denyapproval)                                                                                                    |
| [denyApprovalEffect](/docs/api/agents#denyapprovaleffect)                                                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#denyapprovaleffect)                                                                                              |
| [emitAgentEdge](/docs/api/agents#emitagentedge)                                                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#emitagentedge)                                                                                                   |
| [emitAgentEdgeEffect](/docs/api/agents#emitagentedgeeffect)                                                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#emitagentedgeeffect)                                                                                             |
| [ExecutionClaim](/docs/api/app#executionclaim-interface)                                                          | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/providers-local/tests/agent-state/fixture.ts#L61)                         |
| [GENERATED_AGENT_FUNCTION_PREFIX](/docs/api/agents#generated_agent_function_prefix)                               | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GENERATED_AGENT_FUNCTION_SUFFIX](/docs/api/agents#generated_agent_function_suffix)                               | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GeneratedAgentExecutor](/docs/api/agents#generatedagentexecutor-type-alias)                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GeneratedAgentFunction](/docs/api/agents#generatedagentfunction-type-alias)                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [generatedAgentFunctionId](/docs/api/agents#generatedagentfunctionid)                                             | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#generatedagentfunctionid)                                                                                        |
| [generatedAgentFunctionIdEffect](/docs/api/agents#generatedagentfunctionideffect)                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#generatedagentfunctionideffect)                                                                                  |
| [GeneratedAgentFunctionMarker](/docs/api/agents#generatedagentfunctionmarker-interface)                           | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GeneratedAgentFunctionUnboundError](/docs/api/agents#generatedagentfunctionunbounderror-class)                   | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphAsNodeOptions](/docs/api/integrations/langchain#graphasnodeoptions-interface)                               | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphConditionalRoute](/docs/api/integrations/langchain#graphconditionalroute-type-alias)                        | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphDescriptor](/docs/api/integrations/langchain#graphdescriptor-interface)                                     | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/graph-continuation-effect.test.ts#L40)       |
| [GraphEdgeBuilder](/docs/api/integrations/langchain#graphedgebuilder-interface)                                   | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/define-graph-effect.test.ts#L27)             |
| [GraphEdgeOperation](/docs/api/integrations/langchain#graphedgeoperation-type-alias)                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [graphExecution](/docs/api/integrations/langchain#graphexecution)                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphexecution)                                                                                  |
| [GraphExecution](/docs/api/integrations/langchain#graphexecution-interface)                                       | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [graphExecutionEffect](/docs/api/integrations/langchain#graphexecutioneffect)                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphexecutioneffect)                                                                            |
| [GraphInput](/docs/api/integrations/langchain#graphinput-type-alias)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphInterruptedError](/docs/api/integrations/langchain#graphinterruptederror-class)                             | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphinterruptederror-class)                                                                     |
| [GraphInvocationFailure](/docs/api/integrations/langchain#graphinvocationfailure-class)                           | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphInvocationIdentity](/docs/api/integrations/langchain#graphinvocationidentity-class)                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphinvocationidentity-class)                                                                   |
| [GraphInvocationIdentityLive](/docs/api/integrations/langchain#graphinvocationidentitylive)                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphinvocationidentitylive)                                                                     |
| [GraphNodeAny](/docs/api/integrations/langchain#graphnodeany-type-alias)                                          | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphNodeDescriptor](/docs/api/integrations/langchain#graphnodedescriptor-interface)                             | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphNodeHandler](/docs/api/integrations/langchain#graphnodehandler-type-alias)                                  | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphNodeId](/docs/api/integrations/langchain#graphnodeid-type-alias)                                            | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphNodeImplementation](/docs/api/integrations/langchain#graphnodeimplementation-type-alias)                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphNodeLike](/docs/api/integrations/langchain#graphnodelike-type-alias)                                        | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphNodeResult](/docs/api/integrations/langchain#graphnoderesult-type-alias)                                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphOutput](/docs/api/integrations/langchain#graphoutput-type-alias)                                            | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphRoute](/docs/api/integrations/langchain#graphroute-type-alias)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphRuntimeOptions](/docs/api/integrations/langchain#graphruntimeoptions-type-alias)                            | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphState](/docs/api/integrations/langchain#graphstate-type-alias)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphStateKey](/docs/api/integrations/langchain#graphstatekey-type-alias)                                        | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphWaitingInterrupt](/docs/api/integrations/langchain#graphwaitinginterrupt-interface)                         | Type  | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphwaitinginterrupt-interface)                                                                 |
| [graphWaitingResponse](/docs/api/integrations/langchain#graphwaitingresponse)                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphwaitingresponse)                                                                            |
| [graphWaitingResponseEffect](/docs/api/integrations/langchain#graphwaitingresponseeffect)                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphwaitingresponseeffect)                                                                      |
| [GraphWaitingResponseError](/docs/api/integrations/langchain#graphwaitingresponseerror-class)                     | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [graphWorkflow](/docs/api/integrations/langchain#graphworkflow)                                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphworkflow)                                                                                   |
| [GraphWorkflow](/docs/api/integrations/langchain#graphworkflow-interface)                                         | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [GraphWorkflowEdge](/docs/api/integrations/langchain#graphworkflowedge-type-alias)                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [graphWorkflowEffect](/docs/api/integrations/langchain#graphworkfloweffect)                                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphworkfloweffect)                                                                             |
| [GraphWorkflowNode](/docs/api/integrations/langchain#graphworkflownode-interface)                                 | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [graphWorkflowRequiresPersistence](/docs/api/integrations/langchain#graphworkflowrequirespersistence)             | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphworkflowrequirespersistence)                                                                |
| [graphWorkflowRequiresPersistenceEffect](/docs/api/integrations/langchain#graphworkflowrequirespersistenceeffect) | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#graphworkflowrequirespersistenceeffect)                                                          |
| [InterruptionReceipt](/docs/api/app#interruptionreceipt-interface)                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [InterruptOwnedRunRequest](/docs/api/app#interruptownedrunrequest-interface)                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [invokeAgent](/docs/api/integrations/langchain#invokeagent)                                                       | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [API example](/docs/api/integrations/langchain#invokeagent)                                                                                     |
| [invokeAgentEffect](/docs/api/integrations/langchain#invokeagenteffect)                                           | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [API example](/docs/api/integrations/langchain#invokeagenteffect)                                                                               |
| [invokeAgentFunction](/docs/api/integrations/langchain#invokeagentfunction)                                       | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [API example](/docs/api/integrations/langchain#invokeagentfunction)                                                                             |
| [invokeGraph](/docs/api/integrations/langchain#invokegraph)                                                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#invokegraph)                                                                                     |
| [invokeGraphEffect](/docs/api/integrations/langchain#invokegrapheffect)                                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#invokegrapheffect)                                                                               |
| [isAgentDescriptor](/docs/api/integrations/langchain#isagentdescriptor)                                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#isagentdescriptor)                                                                               |
| [isApprovalRecord](/docs/api/agents#isapprovalrecord)                                                             | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#isapprovalrecord)                                                                                                |
| [isApprovalRecordEffect](/docs/api/agents#isapprovalrecordeffect)                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#isapprovalrecordeffect)                                                                                          |
| [isGeneratedAgentFunction](/docs/api/agents#isgeneratedagentfunction)                                             | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#isgeneratedagentfunction)                                                                                        |
| [isGeneratedAgentFunctionEffect](/docs/api/agents#isgeneratedagentfunctioneffect)                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#isgeneratedagentfunctioneffect)                                                                                  |
| [isGraphDescriptor](/docs/api/integrations/langchain#isgraphdescriptor-1)                                         | Value | `@relkit/langchain`, `@relkit/langchain/continuation-validation` | [API example](/docs/api/integrations/langchain#isgraphdescriptor-1)                                                                             |
| [isGraphDescriptorEffect](/docs/api/integrations/langchain#isgraphdescriptoreffect)                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#isgraphdescriptoreffect)                                                                         |
| [isGraphInterruptedError](/docs/api/integrations/langchain#isgraphinterruptederror)                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#isgraphinterruptederror)                                                                         |
| [isGraphInterruptedErrorEffect](/docs/api/integrations/langchain#isgraphinterruptederroreffect)                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#isgraphinterruptederroreffect)                                                                   |
| [isGraphNodeDescriptor](/docs/api/integrations/langchain#isgraphnodedescriptor)                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#isgraphnodedescriptor)                                                                           |
| [isGraphNodeDescriptorEffect](/docs/api/integrations/langchain#isgraphnodedescriptoreffect)                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#isgraphnodedescriptoreffect)                                                                     |
| [isPersistenceResource](/docs/api/integrations/langchain#ispersistenceresource)                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#ispersistenceresource)                                                                           |
| [isPersistenceResourceEffect](/docs/api/integrations/langchain#ispersistenceresourceeffect)                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#ispersistenceresourceeffect)                                                                     |
| [isSubgraphNode](/docs/api/integrations/langchain#issubgraphnode)                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#issubgraphnode)                                                                                  |
| [isSubgraphNodeEffect](/docs/api/integrations/langchain#issubgraphnodeeffect)                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#issubgraphnodeeffect)                                                                            |
| [JournalCheckpoint](/docs/api/app#journalcheckpoint-interface)                                                    | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/client/tests/compatibility/agent-observation.test.ts#L13)                 |
| [JournalPage](/docs/api/app#journalpage-interface)                                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [JournalReceipt](/docs/api/app#journalreceipt-interface)                                                          | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [JournalRecord](/docs/api/app#journalrecord-interface)                                                            | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/agents/tests/client-events.test.ts#L100)                                  |
| [ListThreadsRequest](/docs/api/app#listthreadsrequest-interface)                                                  | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [LoadThreadRequest](/docs/api/app#loadthreadrequest-interface)                                                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [LookupContinuationReceiptRequest](/docs/api/app#lookupcontinuationreceiptrequest-interface)                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [LookupControlReceiptRequest](/docs/api/app#lookupcontrolreceiptrequest-interface)                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [LookupRunReceiptRequest](/docs/api/app#lookuprunreceiptrequest-interface)                                        | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [MarkControlEffectStartedRequest](/docs/api/app#markcontroleffectstartedrequest-interface)                        | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [MemoryResource](/docs/api/integrations/langchain#memoryresource-type-alias)                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ModelProviderConfiguration](/docs/api/agents#modelproviderconfiguration-interface)                               | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ModelSelectionEffectError](/docs/api/agents#modelselectioneffecterror-class)                                     | Value | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ModelSelectionError](/docs/api/agents#modelselectionerror-class)                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#modelselectionerror-class)                                                                                       |
| [ModelSelectionErrorCode](/docs/api/agents#modelselectionerrorcode-type-alias)                                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [NativeAgentTool](/docs/api/integrations/langchain#nativeagenttool-type-alias)                                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [normalizeModelSelector](/docs/api/agents#normalizemodelselector)                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#normalizemodelselector)                                                                                          |
| [normalizeModelSelectorEffect](/docs/api/agents#normalizemodelselectoreffect)                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#normalizemodelselectoreffect)                                                                                    |
| [observeAgent](/docs/api/agents#observeagent)                                                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#observeagent)                                                                                                    |
| [parseModelProviderConfiguration](/docs/api/agents#parsemodelproviderconfiguration)                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#parsemodelproviderconfiguration)                                                                                 |
| [parseModelProviderConfigurationEffect](/docs/api/agents#parsemodelproviderconfigurationeffect)                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#parsemodelproviderconfigurationeffect)                                                                           |
| [PendingApproval](/docs/api/agents#pendingapproval-interface)                                                     | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/runtime-hono/tests/agent-approval.fixture.ts#L40)                         |
| [PersistenceContext](/docs/api/integrations/langchain#persistencecontext-interface)                               | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [PersistenceOptions](/docs/api/integrations/langchain#persistenceoptions-interface)                               | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [PersistenceResource](/docs/api/integrations/langchain#persistenceresource-interface)                             | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [PromptInstructions](/docs/api/integrations/langchain#promptinstructions-interface)                               | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [PromptTemplate](/docs/api/integrations/langchain#prompttemplate-interface)                                       | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [publicWaitingRequests](/docs/api/integrations/langchain#publicwaitingrequests)                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#publicwaitingrequests)                                                                           |
| [publicWaitingRequestsEffect](/docs/api/integrations/langchain#publicwaitingrequestseffect)                       | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#publicwaitingrequestseffect)                                                                     |
| [ReadControlsRequest](/docs/api/app#readcontrolsrequest-interface)                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ReadJournalRequest](/docs/api/app#readjournalrequest-interface)                                                  | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ReadSnapshotHistoryRequest](/docs/api/app#readsnapshothistoryrequest-interface)                                  | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [RecoverAbandonedControlRequest](/docs/api/app#recoverabandonedcontrolrequest-interface)                          | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [releaseAgentPersistence](/docs/api/integrations/langchain#releaseagentpersistence)                               | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [API example](/docs/api/integrations/langchain#releaseagentpersistence)                                                                         |
| [releaseAgentPersistenceEffect](/docs/api/integrations/langchain#releaseagentpersistenceeffect)                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#releaseagentpersistenceeffect)                                                                   |
| [RenewControlClaimRequest](/docs/api/app#renewcontrolclaimrequest-interface)                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [RenewRunClaimRequest](/docs/api/app#renewrunclaimrequest-interface)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [requiresApproval](/docs/api/agents#requiresapproval)                                                             | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#requiresapproval)                                                                                                |
| [requiresApprovalEffect](/docs/api/agents#requiresapprovaleffect)                                                 | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#requiresapprovaleffect)                                                                                          |
| [resolveAgentPersistence](/docs/api/integrations/langchain#resolveagentpersistence)                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#resolveagentpersistence)                                                                         |
| [resolveAgentPersistenceEffect](/docs/api/integrations/langchain#resolveagentpersistenceeffect)                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#resolveagentpersistenceeffect)                                                                   |
| [ResolvedGraphPersistence](/docs/api/integrations/langchain#resolvedgraphpersistence-interface)                   | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ResolvedModelSelection](/docs/api/agents#resolvedmodelselection-interface)                                       | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [resolveGraphPersistence](/docs/api/integrations/langchain#resolvegraphpersistence)                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#resolvegraphpersistence)                                                                         |
| [resolveGraphPersistenceEffect](/docs/api/integrations/langchain#resolvegraphpersistenceeffect)                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#resolvegraphpersistenceeffect)                                                                   |
| [resolveModelSelector](/docs/api/agents#resolvemodelselector)                                                     | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#resolvemodelselector)                                                                                            |
| [resolveModelSelectorEffect](/docs/api/agents#resolvemodelselectoreffect)                                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/agents#resolvemodelselectoreffect)                                                                                      |
| [runAgent](/docs/api/integrations/langchain#runagent)                                                             | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [runGraphNodeHandlerEffect](/docs/api/integrations/langchain#rungraphnodehandlereffect)                           | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#rungraphnodehandlereffect)                                                                       |
| [RunOwner](/docs/api/app#runowner-interface)                                                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [RunReceiptLookup](/docs/api/app#runreceiptlookup-type-alias)                                                     | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [RunStatus](/docs/api/app#runstatus-type-alias)                                                                   | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [runtimeIntegration](/docs/api/integrations/langchain#runtimeintegration)                                         | Value | `@relkit/langchain`, `@relkit/langchain/runtime`                 | [Module example](/docs/modules/ai)                                                                                                              |
| [SettleControlRequest](/docs/api/app#settlecontrolrequest-interface)                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [SnapshotHistoryPage](/docs/api/app#snapshothistorypage-interface)                                                | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [StoredApproval](/docs/api/app#storedapproval-interface)                                                          | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [StoredRun](/docs/api/app#storedrun-interface)                                                                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [StoredRunRouting](/docs/api/app#storedrunrouting-interface)                                                      | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [StoredThread](/docs/api/app#storedthread-interface)                                                              | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [subgraphForNode](/docs/api/integrations/langchain#subgraphfornode)                                               | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#subgraphfornode)                                                                                 |
| [subgraphForNodeEffect](/docs/api/integrations/langchain#subgraphfornodeeffect)                                   | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#subgraphfornodeeffect)                                                                           |
| [SubgraphNodeDescriptor](/docs/api/integrations/langchain#subgraphnodedescriptor-interface)                       | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [SuspendRunRequest](/docs/api/app#suspendrunrequest-interface)                                                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [SuspensionReceipt](/docs/api/app#suspensionreceipt-interface)                                                    | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgent](/docs/api/integrations/langchain#testagent-interface)                                                 | Type  | `@relkit/langchain/testing`                                      | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/native-authoring.test.ts#L55)                |
| [TestAgentApproval](/docs/api/integrations/langchain#testagentapproval-type-alias)                                | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentApprovalMode](/docs/api/integrations/langchain#testagentapprovalmode-type-alias)                        | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentApprovals](/docs/api/integrations/langchain#testagentapprovals-interface)                               | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentDescriptor](/docs/api/integrations/langchain#testagentdescriptor-type-alias)                            | Type  | `@relkit/langchain/testing`                                      | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/native-authoring.test.ts#L54)                |
| [TestAgentHarness](/docs/api/integrations/langchain#testagentharness-class)                                       | Value | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentInvocationOptions](/docs/api/integrations/langchain#testagentinvocationoptions-type-alias)              | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [testAgentLayer](/docs/api/integrations/langchain#testagentlayer)                                                 | Value | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentModel](/docs/api/integrations/langchain#testagentmodel-interface)                                       | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentModelCall](/docs/api/integrations/langchain#testagentmodelcall-interface)                               | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentModelOptions](/docs/api/integrations/langchain#testagentmodeloptions-interface)                         | Type  | `@relkit/langchain/testing`                                      | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/compatibility/agent-matrix-helpers.ts#L123)                 |
| [TestAgentOptions](/docs/api/integrations/langchain#testagentoptions-interface)                                   | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentTrace](/docs/api/integrations/langchain#testagenttrace-interface)                                       | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentTraceExpectation](/docs/api/integrations/langchain#testagenttraceexpectation-interface)                 | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestAgentTraceSnapshot](/docs/api/integrations/langchain#testagenttracesnapshot-interface)                       | Type  | `@relkit/langchain/testing`                                      | [Module example](/docs/modules/ai)                                                                                                              |
| [TestModelTurn](/docs/api/integrations/langchain#testmodelturn-type-alias)                                        | Type  | `@relkit/langchain/testing`                                      | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/testing/tests/compatibility/agent-matrix-helpers.ts#L101)                 |
| [ThreadAction](/docs/api/app#threadaction-type-alias)                                                             | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/thread-transition.test.ts#L15)               |
| [ThreadList](/docs/api/app#threadlist-interface)                                                                  | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ThreadListItem](/docs/api/app#threadlistitem-interface)                                                          | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ThreadSnapshot](/docs/api/app#threadsnapshot-interface)                                                          | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/client/tests/compatibility/agent-continuation.test.ts#L127)               |
| [ThreadStatus](/docs/api/app#threadstatus-type-alias)                                                             | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/tests/thread-transition.test.ts#L8)                |
| [ThreadTransition](/docs/api/app#threadtransition-type-alias)                                                     | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [ToolPartState](/docs/api/app#toolpartstate-type-alias)                                                           | Type  | `@relkit/langchain`                                              | [Source example](https://github.com/rel-kit/relkit/blob/main/packages/agents/tests/client-events.test.ts#L12)                                   |
| [validateGraphResumeInput](/docs/api/integrations/langchain#validategraphresumeinput-1)                           | Value | `@relkit/langchain`, `@relkit/langchain/continuation-validation` | [API example](/docs/api/integrations/langchain#validategraphresumeinput-1)                                                                      |
| [validateGraphRoute](/docs/api/integrations/langchain#validategraphroute)                                         | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#validategraphroute)                                                                              |
| [validateGraphRouteEffect](/docs/api/integrations/langchain#validategraphrouteeffect)                             | Value | `@relkit/langchain`                                              | [API example](/docs/api/integrations/langchain#validategraphrouteeffect)                                                                        |
| [validateNativeAgentResumeInput](/docs/api/integrations/langchain#validatenativeagentresumeinput-2)               | Value | `@relkit/langchain`, `@relkit/langchain/continuation-validation` | [API example](/docs/api/integrations/langchain#validatenativeagentresumeinput-2)                                                                |
| [WaitForControlsRequest](/docs/api/app#waitforcontrolsrequest-interface)                                          | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |
| [WaitForJournalRequest](/docs/api/app#waitforjournalrequest-interface)                                            | Type  | `@relkit/langchain`                                              | [Module example](/docs/modules/ai)                                                                                                              |

## `client-contract-metadata.ts`

Projects native agent and graph schemas into serializable client metadata; SDK-specific inspection remains inside this integration before the generic contract is published.

### "./client-contract-metadata.types.js" (namespace export)

Re-exports all named exports from the "./client-contract-metadata.types.js" module.

**Signature**

```ts
export * from "./client-contract-metadata.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.ts#L28)

### agentClientContractMetadata

Builds native agent metadata for existing synchronous callers.

**Throws**

The original invalid metadata error.

**Example**

```ts
agentClientContractMetadata(options);
```

**Signature**

```ts
declare const agentClientContractMetadata: (
  options: AgentClientMetadataOptions,
) => AgentClientContractMetadata;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.ts#L50)

### agentClientContractMetadataEffect

Builds client contract metadata for a native agent.

**Example**

```ts
Effect.runSync(agentClientContractMetadataEffect(options));
```

**Signature**

```ts
declare const agentClientContractMetadataEffect: (
  options: AgentClientMetadataOptions,
) => Effect.Effect<AgentClientContractMetadata, AgentDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.ts#L35)

### graphClientContractMetadata

Builds graph metadata for existing synchronous callers.

**Throws**

The original invalid graph metadata error.

**Example**

```ts
graphClientContractMetadata(options);
```

**Signature**

```ts
declare const graphClientContractMetadata: (
  options: GraphClientMetadataOptions,
) => AgentClientContractMetadata;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.ts#L103)

### graphClientContractMetadataEffect

Builds client contract metadata for a native graph.

**Example**

```ts
Effect.runSync(graphClientContractMetadataEffect(options));
```

**Signature**

```ts
declare const graphClientContractMetadataEffect: (
  options: GraphClientMetadataOptions,
) => Effect.Effect<AgentClientContractMetadata, GraphDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.ts#L88)

## `client-contract-metadata.types.ts`

Projects native agent and graph schemas into serializable client metadata; SDK-specific inspection remains inside this integration before the generic contract is published. This companion preserves the native input and output types without starting runtime work.

### AgentClientContractMetadata (interface)

Complete metadata needed to generate an agent client contract.

**Signature**

```ts
export interface AgentClientContractMetadata {
  readonly tools: readonly ClientToolMetadata[];
  readonly state: readonly ClientTypeField[];
  readonly events: readonly ClientEventMetadata[];
  readonly scopes: readonly ClientScopeMetadata[];
  readonly waiting: readonly ClientWaitingMetadata[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.types.ts#L33)

### AgentClientMetadataOptions (interface)

Inputs for native agent client metadata.

**Signature**

```ts
export interface AgentClientMetadataOptions {
  readonly id: string;
  readonly tools: readonly AgentTool[];
  readonly middleware: readonly AgentMiddleware[];
  readonly client?: AgentClientPolicy;
  readonly subagents?: readonly SubagentMetadataSource[];
  readonly interruptOn?: Readonly<Record<string, unknown>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.types.ts#L48)

### ClientEventMetadata (type alias)

Client visible event schema or dynamic event marker.

**Signature**

```ts
type ClientEventMetadata = ClientTypeField | { readonly kind: "dynamic" };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.types.ts#L9)

### ClientScopeMetadata (interface)

Client visible agent, subagent, or graph node scope.

**Signature**

```ts
export interface ClientScopeMetadata {
  readonly kind: "agent" | "subagent" | "node" | "dynamic";
  readonly id?: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.types.ts#L21)

### ClientToolMetadata (type alias)

Client visible tool schema or dynamic tool marker.

**Signature**

```ts
type ClientToolMetadata =
  | {
      readonly id: string;
      readonly input: ClientSchemaMetadata;
      readonly output: ClientSchemaMetadata;
    }
  | { readonly kind: "dynamic" };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.types.ts#L12)

### ClientWaitingMetadata (interface)

Client visible continuation response schema.

**Signature**

```ts
export interface ClientWaitingMetadata {
  readonly scope: ClientScopeMetadata;
  readonly response: ClientSchemaMetadata;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.types.ts#L27)

### GraphClientMetadataOptions (interface)

Inputs for graph client metadata.

**Signature**

```ts
export interface GraphClientMetadataOptions {
  readonly id: string;
  readonly state: { readonly getJsonSchema: () => unknown };
  readonly client?: AgentClientPolicy;
  readonly workflow: GraphWorkflow;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.types.ts#L58)

### SubagentMetadataSource (interface)

Source of nested subagent scope identities.

**Signature**

```ts
export interface SubagentMetadataSource {
  readonly id: string;
  readonly subagents?: readonly SubagentMetadataSource[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-metadata.types.ts#L42)

## `client-contract-schema.ts`

Inspects native schema adapters to describe client-visible inputs and outputs; unsupported shapes produce the existing contract errors before execution.

### ClientSchemaMetadata

**Signature**

```ts
declare const ClientSchemaMetadata: ClientSchemaMetadata;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-schema.ts#L13)

### ClientTypeField

**Signature**

```ts
declare const ClientTypeField: ClientTypeField;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-schema.ts#L14)

### clientSchemaMetadata

Synchronously projects schema metadata for existing descriptor callers.

**Example**

```ts
const metadata = clientSchemaMetadata({ type: "string" });
```

**Signature**

```ts
declare const clientSchemaMetadata: (value: unknown) => ClientSchemaMetadata;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-schema.ts#L144)

### clientSchemaMetadataEffect

Projects a schema-like value to safe client metadata.

**Example**

```ts
const metadata = Effect.runSync(clientSchemaMetadataEffect({ type: "string" }));
```

**Signature**

```ts
declare const clientSchemaMetadataEffect: (
  value: unknown,
) => Effect.Effect<ClientSchemaMetadata, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-schema.ts#L120)

### dynamicClientSchema

Marker for a schema that cannot be represented in the client contract.

**Signature**

```ts
declare const dynamicClientSchema: Readonly<{ kind: "dynamic" }>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-schema.ts#L18)

### mergeClientSchemas

Synchronously merges client schemas for existing descriptor callers.

**Example**

```ts
const schema = mergeClientSchemas([{ type: "object" }]);
```

**Signature**

```ts
declare const mergeClientSchemas: (values: readonly unknown[]) => ClientSchemaMetadata;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-schema.ts#L58)

### mergeClientSchemasEffect

Merges projected object schemas while preserving input order.

**Example**

```ts
const schema = Effect.runSync(mergeClientSchemasEffect([{ type: "object" }]));
```

**Signature**

```ts
declare const mergeClientSchemasEffect: (
  values: ReadonlyArray<unknown>,
) => Effect.Effect<JsonValue, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-schema.ts#L32)

### selectedClientFields

Synchronously selects client fields for existing descriptor callers.

**Example**

```ts
const fields = selectedClientFields({ type: "object" }, ["name"]);
```

**Signature**

```ts
declare const selectedClientFields: (
  schema: ClientSchemaMetadata,
  keys?: readonly string[],
) => readonly ClientTypeField[];
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-schema.ts#L105)

### selectedClientFieldsEffect

Selects named client state fields from a projected object schema.

**Example**

```ts
const fields = Effect.runSync(selectedClientFieldsEffect({ type: "object" }, ["name"]));
```

**Signature**

```ts
declare const selectedClientFieldsEffect: (
  schema: ClientSchemaMetadata,
  keys?: ReadonlyArray<string> | undefined,
) => Effect.Effect<ReadonlyArray<ClientTypeField>, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/client-contract-schema.ts#L71)

## `continuation-validation.ts`

Exposes graph identity and continuation validators to transport adapters without
importing the agent execution barrel. Validation remains owned by its existing
implementations and preserves their public failure and reply contracts.

### isGraphDescriptor

**Signature**

```ts
declare const isGraphDescriptor: (value: unknown) => value is GraphDescriptor;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/continuation-validation.ts#L6)

### validateGraphResumeInput

**Signature**

```ts
declare const validateGraphResumeInput: (
  descriptor: GraphDescriptor,
  requests: readonly AgentWaitingRequest[],
  value: unknown,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/continuation-validation.ts#L7)

### validateNativeAgentResumeInput

**Signature**

```ts
declare const validateNativeAgentResumeInput: (
  requests: readonly AgentWaitingRequest[],
  value: unknown,
) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/continuation-validation.ts#L8)

## `deepagent-bucket-backend.ts`

Adapts a configured RELKIT bucket to the DeepAgents file backend, sharing the invocation scope and preserving bucket failures at the native adapter.

### DeepAgentBucketBackendOptions

**Signature**

```ts
declare const DeepAgentBucketBackendOptions: DeepAgentBucketBackendOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-backend.ts#L18)

### createDeepAgentBucketBackend

Creates a backend for existing synchronous callers.

**Throws**

The original invalid bucket or prefix error.

**Example**

```ts
const backend = createDeepAgentBucketBackend(bucket);
```

**Signature**

```ts
declare const createDeepAgentBucketBackend: (
  bucket: DeepAgentBucketClient,
  options?: DeepAgentBucketBackendOptions,
) => BackendProtocolV2;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-backend.ts#L62)

### createDeepAgentBucketBackendEffect

Builds a DeepAgents backend from a RELKIT bucket client.

**Example**

```ts
Effect.runSync(createDeepAgentBucketBackendEffect(bucket));
```

**Signature**

```ts
declare const createDeepAgentBucketBackendEffect: (
  bucket: DeepAgentBucketClient,
  options?: DeepAgentBucketBackendOptions | undefined,
) => Effect.Effect<
  Readonly<{
    ls: (path: string) => Promise<LsResult>;
    read: (path: string, offset?: number, limit?: number) => Promise<ReadResult>;
    readRaw: (path: string) => Promise<ReadRawResult>;
    write: (path: string, content: string) => Promise<WriteResult>;
    edit: (
      path: string,
      oldText: string,
      newText: string,
      replaceAll?: boolean,
    ) => Promise<EditResult>;
    grep: (
      pattern: string,
      path?: string | null,
      glob?: string | null,
      maxCount?: number | null,
    ) => Promise<GrepResult>;
    glob: (pattern: string, path?: string) => Promise<GlobResult>;
    delete: (path: string) => Promise<DeleteResult>;
    uploadFiles: (files: Array<[string, Uint8Array]>) => Promise<Array<FileUploadResponse>>;
    downloadFiles: (paths: string[]) => Promise<Array<FileDownloadResponse>>;
  }>,
  DeepAgentBucketFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-backend.ts#L26)

## `deepagent-bucket-backend.types.ts`

Configuration for a DeepAgents backend bound to a RELKIT bucket.

### DeepAgentBucketBackendOptions (interface)

Configuration for a DeepAgents backend bound to a RELKIT bucket.

**Signature**

```ts
export interface DeepAgentBucketBackendOptions {
  /** Key prefix owned by this backend instance. */
  readonly prefix?: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-backend.types.ts#L2)

## `deepagent-bucket-client.types.ts`

Bucket client and prefix bound to one DeepAgents backend.

### DeepAgentBucketClient (interface)

IO operations required by the DeepAgents bucket bridge.

**Signature**

```ts
export interface DeepAgentBucketClient {
  readonly put: (
    key: string,
    bytes: Uint8Array,
    options?: {
      readonly contentType?: string;
      readonly metadata?: Readonly<Record<string, string>>;
    },
  ) => Promise<void>;
  readonly get: (key: string) => Promise<Uint8Array | undefined>;
  readonly head: (key: string) => Promise<DeepAgentBucketMetadata | undefined>;
  readonly delete: (key: string) => Promise<void>;
  readonly exists: (key: string) => Promise<boolean>;
  readonly list: (prefix?: string) => Promise<readonly string[]>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-client.types.ts#L17)

### DeepAgentBucketContext (interface)

Bucket client and prefix bound to one DeepAgents backend.

**Signature**

```ts
export interface DeepAgentBucketContext {
  readonly bucket: DeepAgentBucketClient;
  readonly prefix: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-client.types.ts#L4)

### DeepAgentBucketMetadata (interface)

Metadata needed to expose a bucket object as a virtual file.

**Signature**

```ts
export interface DeepAgentBucketMetadata {
  readonly contentType?: string;
  readonly size?: number;
  readonly metadata?: Readonly<Record<string, string>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-client.types.ts#L10)

## `deepagent-bucket-delete.ts`

Deletes normalized DeepAgents file paths through the selected bucket service and reports native file-operation results without changing unrelated keys.

### removeBucketPath

Removes a bucket path for existing DeepAgents Promise callers.

**Throws**

A cancellation or timeout failure from the bucket client.

**Example**

```ts
await removeBucketPath(context, "/notes");
```

**Signature**

```ts
declare const removeBucketPath: (
  context: DeepAgentBucketContext,
  path: string,
) => Promise<DeleteResult>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-delete.ts#L63)

### removeBucketPathEffect

Removes a virtual file or directory with at most eight bucket requests in flight.

**Example**

```ts
Effect.runPromise(Effect.provide(removeBucketPathEffect("/notes"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const removeBucketPathEffect: (
  path: string,
) => Effect.Effect<
  | { error: string; path?: never; filesUpdate?: never }
  | { path: string; filesUpdate: null; error?: never },
  DeepAgentBucketFailure,
  DeepAgentBucket
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-delete.ts#L21)

## `deepagent-bucket-error.ts`

Translates bucket operation failures into the DeepAgents backend error format while retaining the affected operation and path.

### DeepAgentBucketFailure (class)

Typed bucket validation or IO failure for DeepAgents operations.

**Signature**

```ts
declare class DeepAgentBucketFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-error.ts#L6)

### deepAgentBucketFailure

Captures a bucket error while preserving its original cause.

**Example**

```ts
deepAgentBucketFailure(new Error("not found"));
```

**Signature**

```ts
declare const deepAgentBucketFailure: (cause: unknown) => DeepAgentBucketFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-error.ts#L16)

## `deepagent-bucket-file-data.ts`

Encodes and decodes DeepAgents file records stored in bucket objects, preserving file content and timestamps across backend operations.

### putFileData

Writes a file for existing Promise callers.

**Throws**

The original bucket or path failure.

**Example**

```ts
await putFileData(context, "/a.md", "hi");
```

**Signature**

```ts
declare const putFileData: (
  context: DeepAgentBucketContext,
  path: string,
  content: string | Uint8Array,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-file-data.ts#L108)

### putFileDataEffect

Writes file content with timestamps from the Effect clock.

**Example**

```ts
Effect.runPromise(Effect.provide(putFileDataEffect("/a.md", "hi"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const putFileDataEffect: (
  path: string,
  content: string | Uint8Array<ArrayBufferLike>,
) => Effect.Effect<void, DeepAgentBucketFailure, DeepAgentBucket>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-file-data.ts#L68)

### readFileData

Reads a file for existing Promise callers.

**Throws**

The original bucket or path failure.

**Example**

```ts
await readFileData(context, "/a.md");
```

**Signature**

```ts
declare const readFileData: (
  context: DeepAgentBucketContext,
  path: string,
) => Promise<DeepAgentBucketFileData | undefined>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-file-data.ts#L50)

### readFileDataEffect

Reads bytes and metadata together from the current bucket service.

**Example**

```ts
Effect.runPromise(Effect.provide(readFileDataEffect("/a.md"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const readFileDataEffect: (path: string) => Effect.Effect<
  | {
      content: string | Uint8Array<ArrayBufferLike>;
      mimeType: string;
      created_at: string;
      modified_at: string;
    }
  | undefined,
  DeepAgentBucketFailure,
  DeepAgentBucket
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-file-data.ts#L19)

## `deepagent-bucket-file-index.ts`

Maintains the invocation file index used by bucket-backed listing and lookup; reads and mutations share the same backend state.

### infoFor

Reads metadata for existing Promise callers.

**Throws**

The original bucket or path failure.

**Example**

```ts
await infoFor(context, "deepagents/a.md");
```

**Signature**

```ts
declare const infoFor: (
  context: DeepAgentBucketContext,
  key: string,
) => Promise<FileInfo | undefined>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-file-index.ts#L98)

### infoForEffect

Reads metadata for one bucket key.

**Example**

```ts
Effect.runPromise(Effect.provide(infoForEffect("deepagents/a.md"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const infoForEffect: (
  key: string,
) => Effect.Effect<FileInfo | undefined, DeepAgentBucketFailure, DeepAgentBucket>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-file-index.ts#L68)

### scopedKeys

Lists keys for existing Promise callers.

**Throws**

The original bucket or path failure.

**Example**

```ts
await scopedKeys(context, "/notes");
```

**Signature**

```ts
declare const scopedKeys: (
  context: DeepAgentBucketContext,
  path: string | null | undefined,
) => Promise<readonly string[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-file-index.ts#L51)

### scopedKeysEffect

Lists sorted keys in a virtual file or directory.

**Example**

```ts
Effect.runPromise(Effect.provide(scopedKeysEffect("/notes"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const scopedKeysEffect: (
  path: string | null | undefined,
) => Effect.Effect<Array<string>, DeepAgentBucketFailure, DeepAgentBucket>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-file-index.ts#L19)

## `deepagent-bucket-files.ts`

Collects bucket-backed file entries for native filesystem operations after path normalization, keeping metadata separate from fetched file content.

### "./deepagent-bucket-files.types.js" (namespace export)

Re-exports all named exports from the "./deepagent-bucket-files.types.js" module.

**Signature**

```ts
export * from "./deepagent-bucket-files.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L3)

### bucketKey

**Signature**

```ts
declare const bucketKey: (context: DeepAgentBucketContext, path: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L5)

### bucketKeyEffect

**Signature**

```ts
declare const bucketKeyEffect: (
  context: DeepAgentBucketContext,
  path: string,
) => Effect<string, DeepAgentBucketFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L6)

### createBucketContext

**Signature**

```ts
declare const createBucketContext: (
  bucket: DeepAgentBucketClient,
  prefix?: string,
) => DeepAgentBucketContext;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L7)

### createBucketContextEffect

**Signature**

```ts
declare const createBucketContextEffect: (
  bucket: DeepAgentBucketClient,
  prefix?: any,
) => Effect<
  Readonly<{ bucket: DeepAgentBucketClient; prefix: string }>,
  DeepAgentBucketFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L8)

### errorMessage

**Signature**

```ts
declare const errorMessage: (cause: unknown) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L15)

### errorMessageEffect

**Signature**

```ts
declare const errorMessageEffect: (cause: unknown) => Effect<string, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L16)

### filePath

**Signature**

```ts
declare const filePath: (context: DeepAgentBucketContext, key: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L9)

### filePathEffect

**Signature**

```ts
declare const filePathEffect: (
  context: DeepAgentBucketContext,
  key: string,
) => Effect<string, DeepAgentBucketFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L10)

### isControlFailure

**Signature**

```ts
declare const isControlFailure: (cause: unknown) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L17)

### isControlFailureEffect

**Signature**

```ts
declare const isControlFailureEffect: (cause: unknown) => Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L18)

### isTextMimeType

**Signature**

```ts
declare const isTextMimeType: (mimeType: string) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L19)

### isTextMimeTypeEffect

**Signature**

```ts
declare const isTextMimeTypeEffect: (mimeType: string) => Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L20)

### normalizedPage

**Signature**

```ts
declare const normalizedPage: (
  offset?: number,
  limit?: number,
) => { offset: number; limit: number };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L21)

### normalizedPageEffect

**Signature**

```ts
declare const normalizedPageEffect: (
  offset: number,
  limit: number,
) => Effect<{ offset: number; limit: number }, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L22)

### virtualPath

**Signature**

```ts
declare const virtualPath: (value: string, directory?: boolean) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L11)

### virtualPathEffect

**Signature**

```ts
declare const virtualPathEffect: (
  value: string,
  directory?: any,
) => Effect<string, DeepAgentBucketFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.ts#L12)

## `deepagent-bucket-files.types.ts`

Collects bucket-backed file entries for native filesystem operations after path normalization, keeping metadata separate from fetched file content. This companion preserves the native input and output types without starting runtime work.

### "./deepagent-bucket-client.types.js" (namespace export)

Re-exports all named exports from the "./deepagent-bucket-client.types.js" module.

**Signature**

```ts
export * from "./deepagent-bucket-client.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.types.ts#L4)

### DeepAgentBucketFileData (type alias)

DeepAgents file payload that carries a concrete MIME type.

**Signature**

```ts
type DeepAgentBucketFileData = Extract<FileData, { readonly mimeType: string }>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-files.types.ts#L7)

## `deepagent-bucket-format.ts`

Formats bucket file records into the native DeepAgents listing and content shapes consumed by backend callers.

### errorMessage

Reads a failure message for existing synchronous callers.

**Example**

```ts
errorMessage(error);
```

**Signature**

```ts
declare const errorMessage: (cause: unknown) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-format.ts#L76)

### errorMessageEffect

Reads a failure message without requiring an Error instance.

**Example**

```ts
Effect.runSync(errorMessageEffect(error));
```

**Signature**

```ts
declare const errorMessageEffect: (cause: unknown) => Effect.Effect<string, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-format.ts#L66)

### isControlFailure

Classifies a control failure for existing synchronous callers.

**Example**

```ts
isControlFailure(error);
```

**Signature**

```ts
declare const isControlFailure: (cause: unknown) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-format.ts#L57)

### isControlFailureEffect

Classifies cancellation and timeout control failures.

**Example**

```ts
Effect.runSync(isControlFailureEffect(error));
```

**Signature**

```ts
declare const isControlFailureEffect: (cause: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-format.ts#L38)

### isTextMimeType

Checks a text MIME type for existing synchronous callers.

**Example**

```ts
isTextMimeType("text/plain");
```

**Signature**

```ts
declare const isTextMimeType: (mimeType: string) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-format.ts#L96)

### isTextMimeTypeEffect

Checks whether a MIME type should be decoded as text.

**Example**

```ts
Effect.runSync(isTextMimeTypeEffect("text/plain"));
```

**Signature**

```ts
declare const isTextMimeTypeEffect: (mimeType: string) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-format.ts#L85)

### normalizedPage

Normalizes paging for existing synchronous callers.

**Example**

```ts
normalizedPage(0, 500);
```

**Signature**

```ts
declare const normalizedPage: (
  offset?: number,
  limit?: number,
) => { offset: number; limit: number };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-format.ts#L29)

### normalizedPageEffect

Normalizes paging arguments to nonnegative integers.

**Example**

```ts
Effect.runSync(normalizedPageEffect(0, 500));
```

**Signature**

```ts
declare const normalizedPageEffect: (
  offset: number,
  limit: number,
) => Effect.Effect<{ offset: number; limit: number }, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-format.ts#L14)

## `deepagent-bucket-glob.ts`

Matches normalized bucket paths against DeepAgents glob patterns so search traverses only the backend's visible file namespace.

### compileGlob

Validates and normalizes a user glob without changing match semantics.

**Signature**

```ts
declare const compileGlob: (pattern: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-glob.ts#L87)

### globFiles

Finds files for existing DeepAgents Promise callers.

**Throws**

A cancellation or timeout failure from the bucket client.

**Example**

```ts
await globFiles(context, "*.md", "/notes");
```

**Signature**

```ts
declare const globFiles: (
  context: DeepAgentBucketContext,
  pattern: string,
  path?: string,
) => Promise<GlobResult>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-glob.ts#L69)

### globFilesEffect

Finds matching bucket files and orders them by modification time.

**Example**

```ts
Effect.runPromise(Effect.provide(globFilesEffect("*.md"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const globFilesEffect: (
  pattern: string,
  path?: any,
) => Effect.Effect<{ files: Array<FileInfo> }, DeepAgentBucketFailure, DeepAgentBucket>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-glob.ts#L24)

## `deepagent-bucket-grep.ts`

Searches bucket file content for native grep requests and projects matching lines into DeepAgents results.

### grepFiles

Searches text files for existing DeepAgents Promise callers.

**Throws**

A cancellation or timeout failure from the bucket client.

**Example**

```ts
await grepFiles(context, "TODO", "/notes", "*.md", 10);
```

**Signature**

```ts
declare const grepFiles: (
  context: DeepAgentBucketContext,
  pattern: string,
  path?: string | null,
  globPattern?: string | null,
  maxCount?: number | null,
) => Promise<GrepResult>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-grep.ts#L85)

### grepFilesEffect

Searches text files in key order and stops as soon as the match cap is exceeded.

**Example**

```ts
Effect.runPromise(Effect.provide(grepFilesEffect("TODO"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const grepFilesEffect: (
  pattern: string,
  path?: string | null | undefined,
  globPattern?: string | null | undefined,
  maxCount?: number | null | undefined,
) => Effect.Effect<
  | { matches: Array<GrepMatch>; truncated: boolean }
  | { matches: Array<GrepMatch>; truncated?: never },
  DeepAgentBucketFailure,
  DeepAgentBucket
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-grep.ts#L28)

## `deepagent-bucket-path.ts`

Normalizes native file paths into scoped bucket keys and rejects paths that would escape the configured backend prefix.

### bucketKey

Converts a virtual path to a bucket key for synchronous callers.

**Throws**

The original invalid path error.

**Example**

```ts
bucketKey(context, "/readme.md");
```

**Signature**

```ts
declare const bucketKey: (context: DeepAgentBucketContext, path: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-path.ts#L108)

### bucketKeyEffect

Converts a virtual path to its bucket key.

**Example**

```ts
Effect.runSync(bucketKeyEffect(context, "/readme.md"));
```

**Signature**

```ts
declare const bucketKeyEffect: (
  context: DeepAgentBucketContext,
  path: string,
) => Effect.Effect<string, DeepAgentBucketFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-path.ts#L92)

### createBucketContext

Creates a bucket context for existing synchronous callers.

**Throws**

The original invalid bucket or prefix error.

**Example**

```ts
createBucketContext(bucket, "agents");
```

**Signature**

```ts
declare const createBucketContext: (
  bucket: DeepAgentBucketClient,
  prefix?: string,
) => DeepAgentBucketContext;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-path.ts#L36)

### createBucketContextEffect

Validates a bucket client and creates its private prefix context.

**Example**

```ts
Effect.runSync(createBucketContextEffect(bucket));
```

**Signature**

```ts
declare const createBucketContextEffect: (
  bucket: DeepAgentBucketClient,
  prefix?: any,
) => Effect.Effect<
  Readonly<{ bucket: DeepAgentBucketClient; prefix: string }>,
  DeepAgentBucketFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-path.ts#L17)

### filePath

Converts a scoped bucket key for existing synchronous callers.

**Throws**

Error for a key outside the context prefix.

**Example**

```ts
filePath(context, "agents/readme.md");
```

**Signature**

```ts
declare const filePath: (context: DeepAgentBucketContext, key: string) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-path.ts#L142)

### filePathEffect

Converts a scoped bucket key to a virtual path.

**Example**

```ts
Effect.runSync(filePathEffect(context, "agents/readme.md"));
```

**Signature**

```ts
declare const filePathEffect: (
  context: DeepAgentBucketContext,
  key: string,
) => Effect.Effect<string, DeepAgentBucketFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-path.ts#L122)

### virtualPath

Normalizes a virtual path for existing synchronous callers.

**Throws**

Error for empty, unsafe, or traversing paths.

**Example**

```ts
virtualPath("docs/readme.md");
```

**Signature**

```ts
declare const virtualPath: (value: string, directory?: boolean) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-path.ts#L66)

### virtualPathEffect

Normalizes a virtual backend path and rejects traversal.

**Example**

```ts
Effect.runSync(virtualPathEffect("/docs/readme.md"));
```

**Signature**

```ts
declare const virtualPathEffect: (
  value: string,
  directory?: any,
) => Effect.Effect<string, DeepAgentBucketFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-path.ts#L53)

## `deepagent-bucket-read.ts`

Reads normalized native files from the selected bucket, applying the backend's content and missing-file conventions.

### readBucket

Reads a file for existing DeepAgents Promise callers.

**Throws**

A cancellation or timeout failure from the bucket client.

**Example**

```ts
await readBucket(context, "/a.md", 0, 50);
```

**Signature**

```ts
declare const readBucket: (
  context: DeepAgentBucketContext,
  path: string,
  offset?: number,
  limit?: number,
) => Promise<ReadResult>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-read.ts#L98)

### readBucketEffect

Reads a paged text file or an unmodified binary payload.

**Example**

```ts
Effect.runPromise(Effect.provide(readBucketEffect("/a.md", 0, 50), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const readBucketEffect: (
  path: string,
  offset?: any,
  limit?: any,
) => Effect.Effect<
  | { error: string; content?: never; mimeType?: never }
  | { content: string | Uint8Array<ArrayBufferLike>; mimeType: string; error?: never }
  | {
      nextOffset?: number;
      content: string;
      mimeType: string;
      totalLines: number;
      startLine: number;
      endLine: number;
      error?: never;
    },
  DeepAgentBucketFailure,
  DeepAgentBucket
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-read.ts#L60)

### readBucketRaw

Reads the full file payload for existing DeepAgents Promise callers.

**Throws**

A cancellation or timeout failure from the bucket client.

**Example**

```ts
await readBucketRaw(context, "/a.md");
```

**Signature**

```ts
declare const readBucketRaw: (
  context: DeepAgentBucketContext,
  path: string,
) => Promise<ReadRawResult>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-read.ts#L37)

### readBucketRawEffect

Reads the full file payload from the current bucket service.

**Example**

```ts
Effect.runPromise(Effect.provide(readBucketRawEffect("/a.md"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const readBucketRawEffect: (path: string) => Effect.Effect<
  | { error: string; data?: never }
  | {
      data: {
        content: string | Uint8Array<ArrayBufferLike>;
        mimeType: string;
        created_at: string;
        modified_at: string;
      };
      error?: never;
    },
  DeepAgentBucketFailure,
  DeepAgentBucket
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-read.ts#L21)

## `deepagent-bucket-scope.ts`

Owns bucket backend access for an agent invocation and closes acquired resources only after the scoped operation settles.

### createThreadBucketBackend

Creates a private thread backend for existing synchronous callers.

**Throws**

The original invalid bucket or thread error.

**Example**

```ts
const backend = createThreadBucketBackend(bucket, "agent", "thread");
```

**Signature**

```ts
declare const createThreadBucketBackend: (
  bucket: DeepAgentBucketClient,
  agentId: string,
  threadId: string,
) => Readonly<{
  ls: (path: string) => Promise<LsResult>;
  read: (path: string, offset?: number, limit?: number) => Promise<ReadResult>;
  readRaw: (path: string) => Promise<ReadRawResult>;
  write: (path: string, content: string) => Promise<WriteResult>;
  edit: (
    path: string,
    oldText: string,
    newText: string,
    replaceAll?: boolean,
  ) => Promise<EditResult>;
  grep: (
    pattern: string,
    path?: string | null,
    glob?: string | null,
    maxCount?: number | null,
  ) => Promise<GrepResult>;
  glob: (pattern: string, path?: string) => Promise<GlobResult>;
  delete: (path: string) => Promise<DeleteResult>;
  uploadFiles: (files: Array<[string, Uint8Array]>) => Promise<Array<FileUploadResponse>>;
  downloadFiles: (paths: string[]) => Promise<Array<FileDownloadResponse>>;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-scope.ts#L41)

### createThreadBucketBackendEffect

Creates a private filesystem partition for one exact agent thread.

**Example**

```ts
Effect.runSync(createThreadBucketBackendEffect(bucket, "agent", "thread"));
```

**Signature**

```ts
declare const createThreadBucketBackendEffect: (
  bucket: DeepAgentBucketClient,
  agentId: string,
  threadId: string,
) => Effect.Effect<
  Readonly<{
    ls: (path: string) => Promise<LsResult>;
    read: (path: string, offset?: number, limit?: number) => Promise<ReadResult>;
    readRaw: (path: string) => Promise<ReadRawResult>;
    write: (path: string, content: string) => Promise<WriteResult>;
    edit: (
      path: string,
      oldText: string,
      newText: string,
      replaceAll?: boolean,
    ) => Promise<EditResult>;
    grep: (
      pattern: string,
      path?: string | null,
      glob?: string | null,
      maxCount?: number | null,
    ) => Promise<GrepResult>;
    glob: (pattern: string, path?: string) => Promise<GlobResult>;
    delete: (path: string) => Promise<DeleteResult>;
    uploadFiles: (files: Array<[string, Uint8Array]>) => Promise<Array<FileUploadResponse>>;
    downloadFiles: (paths: string[]) => Promise<Array<FileDownloadResponse>>;
  }>,
  DeepAgentBucketFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-scope.ts#L17)

## `deepagent-bucket-search.ts`

Coordinates native bucket listing and content search, sharing normalized paths and file metadata with the read backend.

### listDirectory

Lists a virtual directory for existing DeepAgents Promise callers.

**Throws**

A cancellation or control failure.

**Example**

```ts
await listDirectory(context, "/notes");
```

**Signature**

```ts
declare const listDirectory: (context: DeepAgentBucketContext, path: string) => Promise<LsResult>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-search.ts#L66)

### listDirectoryEffect

Lists direct files and child directories through bounded metadata IO.

**Example**

```ts
Effect.runPromise(Effect.provide(listDirectoryEffect("/"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const listDirectoryEffect: (
  path: string,
) => Effect.Effect<{ files: Array<FileInfo> }, DeepAgentBucketFailure, DeepAgentBucket>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-search.ts#L21)

## `deepagent-bucket-service.ts`

Provides the Effect service used by native bucket operations, translating selected provider access into the backend's typed operation boundary.

### DeepAgentBucket (class)

Injectable bucket context for DeepAgents filesystem operations.

**Example**

```ts
Effect.provide(listDirectoryEffect("/"), deepAgentBucketLayer(context));
```

**Signature**

```ts
declare class DeepAgentBucket
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-service.ts#L9)

### deepAgentBucketLayer

Provides one bucket client and path prefix to an Effect operation.

**Example**

```ts
deepAgentBucketLayer({ bucket, prefix: "threads/one" });
```

**Signature**

```ts
declare const deepAgentBucketLayer: (
  context: DeepAgentBucketContext,
) => Layer.Layer<DeepAgentBucket, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-service.ts#L18)

## `deepagent-bucket-transfer.ts`

Transfers native file content between backend requests and bucket objects while retaining per-file success and failure results.

### downloadBucketFiles

Downloads files for existing DeepAgents Promise callers.

**Throws**

A cancellation or timeout failure from the bucket client.

**Example**

```ts
await downloadBucketFiles(context, ["/a"]);
```

**Signature**

```ts
declare const downloadBucketFiles: (
  context: DeepAgentBucketContext,
  paths: string[],
) => Promise<FileDownloadResponse[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-transfer.ts#L109)

### downloadBucketFilesEffect

Downloads files in input order with a result for each path.

**Example**

```ts
Effect.runPromise(Effect.provide(downloadBucketFilesEffect(["/a"]), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const downloadBucketFilesEffect: (
  paths: Array<string>,
) => Effect.Effect<
  Array<
    | { path: string; content: null; error: "file_not_found" }
    | { path: string; content: Uint8Array<ArrayBufferLike>; error: null }
    | { path: string; content: null; error: "invalid_path" }
  >,
  DeepAgentBucketFailure,
  DeepAgentBucket
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-transfer.ts#L71)

### uploadBucketFiles

Uploads files for existing DeepAgents Promise callers.

**Throws**

A cancellation or timeout failure from the bucket client.

**Example**

```ts
await uploadBucketFiles(context, [["/a", bytes]]);
```

**Signature**

```ts
declare const uploadBucketFiles: (
  context: DeepAgentBucketContext,
  files: Array<[string, Uint8Array]>,
) => Promise<FileUploadResponse[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-transfer.ts#L54)

### uploadBucketFilesEffect

Uploads files in input order so repeated paths retain last-write behavior.

**Example**

```ts
Effect.runPromise(
  Effect.provide(uploadBucketFilesEffect([["/a", bytes]]), deepAgentBucketLayer(context)),
);
```

**Signature**

```ts
declare const uploadBucketFilesEffect: (
  files: Array<[string, Uint8Array<ArrayBufferLike>]>,
) => Effect.Effect<
  Array<{ path: string; error: null } | { path: string; error: "invalid_path" }>,
  DeepAgentBucketFailure,
  DeepAgentBucket
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-transfer.ts#L17)

## `deepagent-bucket-write.ts`

Applies native file writes and edits to the selected bucket and updates the shared file index after successful storage mutations.

### editBucket

Edits text for existing DeepAgents Promise callers.

**Throws**

A cancellation or timeout failure from the bucket client.

**Example**

```ts
await editBucket(context, "/a.md", "old", "new", true);
```

**Signature**

```ts
declare const editBucket: (
  context: DeepAgentBucketContext,
  path: string,
  oldText: string,
  newText: string,
  replaceAll?: boolean,
) => Promise<EditResult>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-write.ts#L104)

### editBucketEffect

Replaces text with the existing DeepAgents edit rules.

**Example**

```ts
Effect.runPromise(
  Effect.provide(editBucketEffect("/a.md", "old", "new"), deepAgentBucketLayer(context)),
);
```

**Signature**

```ts
declare const editBucketEffect: (
  path: string,
  oldText: string,
  newText: string,
  replaceAll?: any,
) => Effect.Effect<
  | { error: string; path?: never; filesUpdate?: never; occurrences?: never }
  | { path: string; filesUpdate: null; occurrences: number; error?: never },
  DeepAgentBucketFailure,
  DeepAgentBucket
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-write.ts#L67)

### writeBucket

Writes text for existing DeepAgents Promise callers.

**Throws**

A cancellation or timeout failure from the bucket client.

**Example**

```ts
await writeBucket(context, "/a.md", "hi");
```

**Signature**

```ts
declare const writeBucket: (
  context: DeepAgentBucketContext,
  path: string,
  content: string,
) => Promise<WriteResult>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-write.ts#L42)

### writeBucketEffect

Writes a text file through the current bucket service.

**Example**

```ts
Effect.runPromise(Effect.provide(writeBucketEffect("/a.md", "hi"), deepAgentBucketLayer(context)));
```

**Signature**

```ts
declare const writeBucketEffect: (
  path: string,
  content: string,
) => Effect.Effect<{ path: string; filesUpdate: null }, DeepAgentBucketFailure, DeepAgentBucket>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/deepagent-bucket-write.ts#L18)

## `define-agent-build.ts`

Assembles validated native agent configuration into a RELKIT descriptor, preserving native model, tools and execution metadata for runtime selection.

### prepareAgentDescriptor

Validates agent options and returns an assembler for a resolved identity.

**Throws**

Validation errors from fields and client policy.

**Example**

```ts
prepareAgentDescriptor(options)("support");
```

**Signature**

```ts
declare const prepareAgentDescriptor: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const Middleware extends readonly AgentMiddleware[],
  const Tools extends readonly AgentTool[],
>(
  options: DefineAgentOptions<Id, InputSchema, OutputSchema, Middleware, Tools>,
) => (
  id: Id,
) => AgentDescriptor<
  Id,
  InferInput<InputSchema>,
  InferOutput<OutputSchema>,
  InputSchema,
  OutputSchema,
  Middleware,
  Tools
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-build.ts#L31)

## `define-agent-deep.ts`

Normalizes optional DeepAgents authoring fields without loading the DeepAgents runtime; the same defined-field selection controls the graph marker.

### "./define-agent-deep.types.js" (namespace export)

Re-exports all named exports from the "./define-agent-deep.types.js" module.

**Signature**

```ts
export * from "./define-agent-deep.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-deep.ts#L9)

### copyDeepAgentCapabilities

Copies DeepAgents options for existing synchronous authoring callers.

**Throws**

The original invalid capability error.

**Example**

```ts
const options = copyDeepAgentCapabilities({ skills: ["/skills"] });
```

**Signature**

```ts
declare const copyDeepAgentCapabilities: (value: DeepAgentCapabilities) => DeepAgentCapabilities;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-deep.ts#L31)

### copyDeepAgentCapabilitiesEffect

Validates and freezes native DeepAgents options.

**Example**

```ts
Effect.runSync(copyDeepAgentCapabilitiesEffect({ skills: ["/skills"] }));
```

**Signature**

```ts
declare const copyDeepAgentCapabilitiesEffect: (
  value: DeepAgentCapabilities,
) => Effect.Effect<DeepAgentCapabilities, AgentDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-deep.ts#L16)

### hasDeepAgentCapabilities

Checks capabilities for existing synchronous authoring callers.

**Example**

```ts
if (hasDeepAgentCapabilities(options)) enableDeep();
```

**Signature**

```ts
declare const hasDeepAgentCapabilities: (value: DeepAgentCapabilities) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-deep.ts#L81)

### hasDeepAgentCapabilitiesEffect

Checks whether a descriptor enables native DeepAgents capabilities.

**Example**

```ts
Effect.runSync(hasDeepAgentCapabilitiesEffect({ skills: ["/skills"] }));
```

**Signature**

```ts
declare const hasDeepAgentCapabilitiesEffect: (
  value: DeepAgentCapabilities,
) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-deep.ts#L71)

## `define-agent-deep.types.ts`

Normalizes optional DeepAgents authoring fields without loading the DeepAgents runtime; the same defined-field selection controls the graph marker. This companion preserves the native input and output types without starting runtime work.

### AgentFilesystemBackend (type alias)

DeepAgents filesystem backend or a state-bound backend factory.

**Signature**

```ts
type AgentFilesystemBackend =
  object | ((context: { readonly state: unknown; readonly store?: unknown }) => object);
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-deep.types.ts#L12)

### AgentSubagent (type alias)

Agent descriptor nested under a DeepAgent.

**Signature**

```ts
type AgentSubagent = AgentDescriptor<string, unknown, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-deep.types.ts#L9)

### DeepAgentCapabilities (interface)

Optional capabilities enabled for a DeepAgent.

**Signature**

```ts
export interface DeepAgentCapabilities {
  readonly subagents?: readonly AgentSubagent[];
  readonly skills?: readonly string[];
  readonly memory?: readonly string[];
  readonly backend?: AgentFilesystemBackend;
  readonly checkpointer?: BaseCheckpointSaver | CheckpointerResource;
  readonly store?: BaseStore | MemoryResource;
  readonly interruptOn?: Readonly<Record<string, boolean | InterruptOnConfig>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-deep.types.ts#L16)

## `define-agent-native-middleware.ts`

Validates and retains SDK middleware supplied by native agent authors so runtime construction receives the original middleware objects.

### copyAgentMiddleware

Copies middleware for existing synchronous authoring callers.

**Throws**

The original invalid middleware error.

**Example**

```ts
const middleware = copyAgentMiddleware([]);
```

**Signature**

```ts
declare const copyAgentMiddleware: <Middleware extends readonly AgentMiddleware[]>(
  value: Middleware | undefined,
) => Middleware;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-middleware.ts#L43)

### copyAgentMiddlewareEffect

Validates middleware names and brands, retaining input order.

**Example**

```ts
Effect.runSync(copyAgentMiddlewareEffect([]));
```

**Signature**

```ts
declare const copyAgentMiddlewareEffect: <Middleware extends readonly AgentMiddleware[]>(
  value: Middleware | undefined,
) => Effect.Effect<Middleware, AgentDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-middleware.ts#L14)

### middlewareStateKeys

Collects state keys for existing synchronous authoring callers.

**Throws**

The original schema access error.

**Example**

```ts
const keys = middlewareStateKeys([]);
```

**Signature**

```ts
declare const middlewareStateKeys: <Middleware extends readonly AgentMiddleware[]>(
  middleware: Middleware,
) => ReadonlySet<AgentClientStateKey<Middleware>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-middleware.ts#L84)

### middlewareStateKeysEffect

Collects public state keys declared by middleware schemas.

**Example**

```ts
Effect.runSync(middlewareStateKeysEffect([]));
```

**Signature**

```ts
declare const middlewareStateKeysEffect: <Middleware extends readonly AgentMiddleware[]>(
  middleware: Middleware,
) => Effect.Effect<
  ReadonlySet<MiddlewareStateKey<Middleware[number]>>,
  AgentDefinitionFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-middleware.ts#L58)

## `define-agent-native-model.ts`

Accepts native chat-model instances or supported model selectors and preserves the model's inference contract for descriptor construction.

### isAgentModel

Checks a model for existing synchronous authoring callers.

**Example**

```ts
if (isAgentModel(value)) use(value);
```

**Signature**

```ts
declare const isAgentModel: (value: unknown) => value is AgentModel;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-model.ts#L28)

### isAgentModelEffect

Checks whether a value can select or provide a native agent model.

**Example**

```ts
Effect.runSync(isAgentModelEffect("openai:gpt"));
```

**Signature**

```ts
declare const isAgentModelEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-model.ts#L12)

## `define-agent-native-tools.ts`

Separates native SDK tools from RELKIT callable references while retaining native identity and serializable generic tool references.

### copyAgentTools

Copies tools for existing synchronous authoring callers.

**Throws**

The original invalid or duplicate tool error.

**Example**

```ts
const tools = copyAgentTools([]);
```

**Signature**

```ts
declare const copyAgentTools: <Tools extends readonly AgentTool[]>(value: Tools) => Tools;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-tools.ts#L47)

### copyAgentToolsEffect

Validates and freezes RELKIT and native agent tools in input order.

**Example**

```ts
Effect.runSync(copyAgentToolsEffect([]));
```

**Signature**

```ts
declare const copyAgentToolsEffect: <Tools extends readonly AgentTool[]>(
  value: Tools,
) => Effect.Effect<Tools, AgentDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-tools.ts#L15)

### relkitToolRefs

Selects RELKIT references for existing synchronous authoring callers.

**Example**

```ts
const refs = relkitToolRefs(tools);
```

**Signature**

```ts
declare const relkitToolRefs: (tools: readonly AgentTool[]) => readonly ToolRefAny[];
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-tools.ts#L70)

### relkitToolRefsEffect

Selects RELKIT tool references from a mixed native tool list.

**Example**

```ts
Effect.runSync(relkitToolRefsEffect([]));
```

**Signature**

```ts
declare const relkitToolRefsEffect: (
  tools: ReadonlyArray<AgentTool>,
) => Effect.Effect<Array<ToolRefAny>, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native-tools.ts#L60)

## `define-agent-native.ts`

Builds the native execution payload from model, tool and middleware inputs after validation, without starting model execution during authoring.

### "./define-agent-native-middleware.js" (namespace export)

Re-exports all named exports from the "./define-agent-native-middleware.js" module.

**Signature**

```ts
export * from "./define-agent-native-middleware.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.ts#L5)

### "./define-agent-native-model.js" (namespace export)

Re-exports all named exports from the "./define-agent-native-model.js" module.

**Signature**

```ts
export * from "./define-agent-native-model.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.ts#L4)

### "./define-agent-native-tools.js" (namespace export)

Re-exports all named exports from the "./define-agent-native-tools.js" module.

**Signature**

```ts
export * from "./define-agent-native-tools.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.ts#L6)

### "./define-agent-native.types.js" (namespace export)

Re-exports all named exports from the "./define-agent-native.types.js" module.

**Signature**

```ts
export * from "./define-agent-native.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.ts#L3)

## `define-agent-native.types.ts`

Builds the native execution payload from model, tool and middleware inputs after validation, without starting model execution during authoring. This companion preserves the native input and output types without starting runtime work.

### AgentClientStateKey (type alias)

Public state keys selected from each middleware schema without erasing tuples.

**Signature**

```ts
type AgentClientStateKey<Middleware extends readonly AgentMiddleware[]> = MiddlewareStateKey<
  Middleware[number]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.types.ts#L64)

### AgentLanguageModel (interface)

Native model object accepted by an agent descriptor.

**Signature**

```ts
export interface AgentLanguageModel {
  readonly invoke: (...args: never[]) => unknown;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.types.ts#L10)

### AgentMiddleware (type alias)

SDK fields RELKIT inspects; each descriptor retains its complete inferred middleware tuple, including native hooks, tools and phantom schema data. Runtime validation checks the SDK brand.

**Signature**

```ts
type AgentMiddleware = Pick<NativeAgentMiddleware, "name" | "stateSchema">;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.types.ts#L29)

### AgentMiddlewareState (type alias)

Public state composed from middleware state schemas.

**Signature**

```ts
type AgentMiddlewareState<Middleware extends readonly AgentMiddleware[]> =
  Middleware extends readonly [infer First, ...infer Rest]
    ? First extends AgentMiddleware
      ? Rest extends readonly AgentMiddleware[]
        ? MiddlewareState<First> & AgentMiddlewareState<Rest>
        : MiddlewareState<First>
      : {}
    : {};
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.types.ts#L32)

### AgentModel (type alias)

Model selector, native model, or model factory.

**Signature**

```ts
type AgentModel = string | AgentLanguageModel | AgentModelFactory;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.types.ts#L20)

### AgentModelFactory (type alias)

Environment-bound factory for a native model.

**Signature**

```ts
type AgentModelFactory<Environment = Readonly<Record<string, unknown>>> = (
  environment: Environment,
) => MaybePromise<AgentLanguageModel>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.types.ts#L15)

### AgentTool (type alias)

RELKIT reference or native LangChain tool.

**Signature**

```ts
type AgentTool = ToolRefAny | NativeAgentTool;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.types.ts#L26)

### NativeAgentTool (type alias)

LangChain client or server tool.

**Signature**

```ts
type NativeAgentTool = ClientTool | ServerTool;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-native.types.ts#L23)

## `define-agent-validation.ts`

Validates shared and native agent configuration before descriptor assembly, keeping invalid authoring failures out of the invocation path.

### assertAgentDescriptor

Requires a descriptor for existing synchronous authoring callers.

**Throws**

TypeError when the descriptor is invalid.

**Example**

```ts
assertAgentDescriptor(candidate);
```

**Signature**

```ts
declare const assertAgentDescriptor: (value: unknown) => asserts value is AgentAny;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-validation.ts#L81)

### assertAgentDescriptorEffect

Requires a valid agent descriptor.

**Example**

```ts
Effect.runSync(assertAgentDescriptorEffect(agent));
```

**Signature**

```ts
declare const assertAgentDescriptorEffect: (
  value: unknown,
) => Effect.Effect<void, AgentDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-validation.ts#L64)

### isAgentDescriptor

Checks a descriptor for existing synchronous authoring callers.

**Example**

```ts
if (isAgentDescriptor(candidate)) use(candidate);
```

**Signature**

```ts
declare const isAgentDescriptor: (value: unknown) => value is AgentAny;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-validation.ts#L35)

### isAgentDescriptorEffect

Checks the complete runtime shape of an agent descriptor.

**Example**

```ts
Effect.runSync(isAgentDescriptorEffect(candidate));
```

**Signature**

```ts
declare const isAgentDescriptorEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-validation.ts#L25)

### normalizeAgentModel

Normalizes a model for existing synchronous authoring callers.

**Throws**

The original invalid selector error.

**Example**

```ts
const model = normalizeAgentModel("openai:gpt");
```

**Signature**

```ts
declare const normalizeAgentModel: (value: AgentModel | undefined) => AgentModel | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-validation.ts#L110)

### normalizeAgentModelEffect

Normalizes the selector of a string model definition.

**Example**

```ts
Effect.runSync(normalizeAgentModelEffect("openai:gpt"));
```

**Signature**

```ts
declare const normalizeAgentModelEffect: (
  value: AgentModel | undefined,
) => Effect.Effect<
  string | AgentLanguageModel | AgentModelFactory<Readonly<Record<string, unknown>>> | undefined,
  AgentDefinitionFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent-validation.ts#L94)

## `define-agent.ts`

Exposes SDK-native agent authoring with inferred input and output types; validation and descriptor assembly are delegated to the integration's owning helpers.

### defineAgent

Defines a native agent for existing synchronous authoring callers.

**Throws**

The original invalid authoring or identity error.

**Example**

```ts
import { defineAgent } from "@relkit/langchain";
import { z } from "@relkit/app/schema";

const support = defineAgent({
  id: "support",
  input: z.object({ message: z.string() }),
  output: z.object({ answer: z.string() }),
  instructions: "Reply briefly.",
  tools: [],
  limits: { maxSteps: 4, maxToolCalls: 2, timeoutMs: 30_000 },
});
void support;
```

**Signature**

```ts
declare const defineAgent: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const Middleware extends readonly AgentMiddleware[] = readonly [],
  const Tools extends readonly AgentTool[] = ReadonlyArray<AgentTool>,
>(
  options: DefineAgentOptions<Id, InputSchema, OutputSchema, Middleware, Tools>,
) => AgentDescriptor<
  Id,
  InferInput<InputSchema>,
  InferOutput<OutputSchema>,
  InputSchema,
  OutputSchema,
  Middleware,
  Tools
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L109)

Since v0.4.0

#### Backend and frontend example

**Backend** — these maintained files define the operation used by the frontend below.

```ts title="templates/default/v1/agent/src/services/hello/agents/assistant.agent.ts"
/** Runs an offline greeting agent with RELKIT/native tools, todo middleware and public state observation. */
import { defineAgent } from "@relkit/langchain";
import { z } from "@relkit/app/schema";
import { FakeToolCallingModel, todoListMiddleware, tool } from "langchain";
import lookup from "@app/services/hello/tools/lookup.tool.js";

export const uppercase = tool(async ({ text }: { readonly text: string }) => text.toUpperCase(), {
  name: "uppercase",
  description: "Uppercase text without leaving the process",
  schema: z.object({ text: z.string() }),
});

export default defineAgent({
  id: "hello.assistant",

  input: z.object({ message: z.string().min(1) }),
  output: z.object({ answer: z.string() }),

  model: new FakeToolCallingModel({
    toolCalls: [
      [
        {
          name: "write_todos",
          args: { todos: [{ content: "Answer the greeting", status: "completed" }] },
          id: "todo-1",
        },
      ],
      [
        {
          name: "relkit_output",
          args: { value: { answer: "Hello from the offline LangChain model." } },
          id: "output-1",
        },
      ],
    ],
  }),
  instructions: "Answer greeting questions with the available tools.",
  tools: [lookup, uppercase],
  middleware: [todoListMiddleware()],
  stateProfile: "default",
  client: {
    public: true,
    state: ["todos"],
    events: { notice: z.object({ message: z.string() }) },
  },
  chat: { input: "message", output: "answer" },
  controls: ["stop"],

  limits: {
    maxSteps: 4,
    maxToolCalls: 4,
    timeoutMs: 10_000,
  },
});
```

**Frontend**

After [frontend setup and pulling the greeting agent's contract](/guides/frontend/connect-react),
render this component under the provider. Supply a stable business `threadId` owned by your
application, such as the ID of the conversation the user opened:

```tsx title="src/Assistant.tsx"
"use client";

/** Sends one greeting to the documented hello.assistant agent and observes its typed answer. */
import { useAgent, useRelkitClient } from "@relkit/client/react";
import { useState } from "react";

/** Keeps the application-owned thread identity stable across rendering and observation.
 * @param props - Authorized conversation identity retained by the application.
 * @returns A greeting action, the observed answer, and explicit submission failure. */
export function Assistant({ threadId }: { readonly threadId: string }) {
  const { status } = useRelkitClient();
  const assistant = useAgent("hello.assistant");
  const [failure, setFailure] = useState("");

  /** Submits once and preserves uncertain outcomes for explicit recovery.
   * @returns Completion after acceptance or displaying the failure. */
  async function sendGreeting() {
    try {
      await assistant.send("Hello, RELKIT!", { threadId });
    } catch (error) {
      setFailure(String(error));
    }
  }

  return (
    <section>
      <button
        disabled={status !== "ready" || assistant.status !== "idle" || failure !== ""}
        onClick={sendGreeting}
      >
        Say hello
      </button>
      <p role="status">{assistant.output?.answer ?? assistant.status}</p>
      {failure && <p role="alert">{failure}. Check this thread before submitting again.</p>}
    </section>
  );
}
```

This is the same `hello.assistant` declaration: `client.public` exposes it, `chat.input: "message"`
makes `send` accept a string, and `chat.output: "answer"` selects its typed answer. Mounting
`useAgent` does not start a run. The backend owns models, credentials, tools, and authorization.

Reference: [`useAgent`](/docs/api/client#useagent).
Continue with [streaming and controls](/docs/modules/ai/streaming) or
[thread recovery](/docs/modules/ai/threads-recovery).

### AgentChatMapping

**Signature**

```ts
declare const AgentChatMapping: AgentChatMapping;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L28)

### AgentClientPolicy

**Signature**

```ts
declare const AgentClientPolicy: AgentClientPolicy<Guard, StateKey, Events>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L29)

### AgentClientStateKey

**Signature**

```ts
declare const AgentClientStateKey: AgentClientStateKey<Middleware>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L19)

### AgentControl

**Signature**

```ts
declare const AgentControl: AgentControl;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L30)

### AgentDescriptor

**Signature**

```ts
declare const AgentDescriptor: AgentDescriptor<
  Id,
  Input,
  Output,
  InputSchema,
  OutputSchema,
  Middleware,
  Tools
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L38)

### AgentFilesystemBackend

**Signature**

```ts
declare const AgentFilesystemBackend: AgentFilesystemBackend;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L33)

### AgentInstructions

**Signature**

```ts
declare const AgentInstructions: AgentInstructions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L39)

### AgentLimits

**Signature**

```ts
declare const AgentLimits: AgentLimits;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L40)

### AgentMiddleware

**Signature**

```ts
declare const AgentMiddleware: AgentMiddleware;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L20)

### AgentMiddlewareState

**Signature**

```ts
declare const AgentMiddlewareState: AgentMiddlewareState<Middleware>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L21)

### AgentModel

**Signature**

```ts
declare const AgentModel: AgentModel;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L22)

### AgentModelFactory

**Signature**

```ts
declare const AgentModelFactory: AgentModelFactory<Environment>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L23)

### AgentSubagent

**Signature**

```ts
declare const AgentSubagent: AgentSubagent;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L34)

### AgentTool

**Signature**

```ts
declare const AgentTool: AgentTool;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L24)

### DeepAgentCapabilities

**Signature**

```ts
declare const DeepAgentCapabilities: DeepAgentCapabilities;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L35)

### DefineAgentOptions

**Signature**

```ts
declare const DefineAgentOptions: DefineAgentOptions<
  Id,
  InputSchema,
  OutputSchema,
  Middleware,
  Tools
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L41)

### NativeAgentTool

**Signature**

```ts
declare const NativeAgentTool: NativeAgentTool;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L25)

### PromptInstructions

**Signature**

```ts
declare const PromptInstructions: PromptInstructions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L42)

### PromptTemplate

**Signature**

```ts
declare const PromptTemplate: PromptTemplate;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L43)

### assertAgentDescriptor

**Signature**

```ts
declare const assertAgentDescriptor: (value: unknown) => asserts value is AgentAny;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L13)

### copyAgentLimits

**Signature**

```ts
declare const copyAgentLimits: (value: unknown) => AgentLimits;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L15)

### copyAgentLimitsEffect

**Signature**

```ts
declare const copyAgentLimitsEffect: (
  value: unknown,
) => Effect.Effect<
  Readonly<{ maxSteps: number; maxToolCalls: number; timeoutMs: number }>,
  import("@relkit/agents/internal/define-agent-error").AgentDefinitionFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L16)

### defineAgentEffect

Defines a native agent with validated authoring options and substitutable identity generation.

**Example**

```ts
Effect.runSync(
  defineAgentEffect({ id: "support", input, output, instructions: "Reply.", tools: [], limits }),
);
```

**Signature**

```ts
declare const defineAgentEffect: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const Middleware extends readonly AgentMiddleware[] = readonly [],
  const Tools extends readonly AgentTool[] = ReadonlyArray<AgentTool>,
>(
  options: DefineAgentOptions<Id, InputSchema, OutputSchema, Middleware, Tools>,
) => Effect.Effect<
  AgentDescriptor<
    Id,
    InferInput<InputSchema>,
    InferOutput<OutputSchema>,
    InputSchema,
    OutputSchema,
    Middleware,
    Tools
  >,
  AgentDefinitionFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L51)

### isAgentDescriptor

**Signature**

```ts
declare const isAgentDescriptor: (value: unknown) => value is AgentAny;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.ts#L13)

## `define-agent.types.ts`

Exposes SDK-native agent authoring with inferred input and output types; validation and descriptor assembly are delegated to the integration's owning helpers. This companion preserves the native input and output types without starting runtime work.

### AgentDescriptor (interface)

**Signature**

```ts
export interface AgentDescriptor<
  Id extends string,
  Input,
  Output,
  InputSchema extends StandardSchemaV1 = StandardSchemaV1,
  OutputSchema extends StandardSchemaV1 = StandardSchemaV1,
  Middleware extends readonly AgentMiddleware[] = readonly AgentMiddleware[],
  Tools extends readonly AgentTool[] = readonly AgentTool[],
>
  extends
    DescriptorBase<"agent", Id>,
    AgentRef<Id, InputSchema, OutputSchema>,
    DeepAgentCapabilities {
  readonly model?: AgentModel;
  readonly instructions: AgentInstructions;
  readonly tools: Tools;
  readonly middleware: Middleware;
  readonly limits: AgentLimits;
  readonly stateProfile?: string;
  readonly client?: AgentClientPolicy<(...args: any[]) => unknown, AgentClientStateKey<Middleware>>;
  readonly chat?: AgentChatMapping;
  readonly controls?: readonly AgentControl[];
  readonly clientContract: AgentClientContractMetadata;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.types.ts#L40)

### AgentInstructions (type alias)

**Signature**

```ts
type AgentInstructions = string | PromptTemplate | PromptInstructions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.types.ts#L32)

### AgentLimits (interface)

**Signature**

```ts
export interface AgentLimits {
  readonly maxSteps: number;
  readonly maxToolCalls: number;
  readonly timeoutMs: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.types.ts#L34)

### DefineAgentOptions (interface)

**Signature**

```ts
export interface DefineAgentOptions<
  Id extends string,
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
  Middleware extends readonly AgentMiddleware[],
  Tools extends readonly AgentTool[],
>
  extends DescriptorMetadata, DeepAgentCapabilities {
  readonly id?: Id;
  readonly input: InputSchema;
  readonly output: OutputSchema;
  readonly model?: AgentModel;
  readonly instructions: AgentInstructions;
  readonly tools: Tools;
  readonly middleware?: Middleware;
  readonly limits: AgentLimits;
  readonly stateProfile?: string;
  readonly client?: AgentClientPolicy<(...args: any[]) => unknown, AgentClientStateKey<Middleware>>;
  readonly chat?: AgentChatMapping;
  readonly controls?: readonly AgentControl[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.types.ts#L65)

### PromptInstructions (interface)

**Signature**

```ts
export interface PromptInstructions {
  readonly kind: "prompt";
  readonly id: string;
  readonly ref: { readonly kind: "prompt"; readonly id: string };
  readonly value: string | readonly string[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.types.ts#L25)

### PromptTemplate (interface)

**Signature**

```ts
export interface PromptTemplate {
  readonly template: string;
  readonly variables?: readonly string[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-agent.types.ts#L20)

## `define-graph-build.ts`

Assembles graph nodes, edges, state and persistence into the authored native descriptor that compilation consumes without invoking graph nodes.

### prepareGraphDescriptor

Validates graph authoring options and returns an assembler for its identity.

**Throws**

Invalid schema, node, edge, or client policy errors.

**Example**

```ts
prepareGraphDescriptor(options)("support.graph");
```

**Signature**

```ts
declare const prepareGraphDescriptor: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const State extends AnyStateSchema,
  const Nodes extends readonly GraphNodeLike[],
>(
  options: DefineGraphOptions<Id, InputSchema, OutputSchema, State, Nodes>,
) => (id: Id) => GraphDescriptor<Id, InputSchema, OutputSchema, State, Nodes>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-build.ts#L29)

## `define-graph-error.ts`

Defines graph authoring failures reported before native compilation, retaining the invalid graph field and actionable diagnostic.

### GraphDefinitionFailure (class)

Tagged invalid graph authoring options or descriptor construction.

**Signature**

```ts
declare class GraphDefinitionFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-error.ts#L6)

### graphDefinitionFailure

Preserves a graph authoring error for Effect callers.

**Example**

```ts
graphDefinitionFailure(new TypeError("invalid graph"));
```

**Signature**

```ts
declare const graphDefinitionFailure: (cause: unknown) => GraphDefinitionFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-error.ts#L16)

## `define-graph-node.ts`

Creates typed native graph node descriptors from author callbacks and records their execution metadata for later graph compilation.

### "./define-graph-node.types.js" (namespace export)

Re-exports all named exports from the "./define-graph-node.types.js" module.

**Signature**

```ts
export * from "./define-graph-node.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.ts#L25)

### assertGraphNodeDestinations

**Signature**

```ts
declare const assertGraphNodeDestinations: (
  node: Pick<GraphNodeAny, "id" | "ends">,
  registeredNodeIds: ReadonlySet<string> | readonly string[],
) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.ts#L26)

### defineGraphNode

Defines a graph node for existing synchronous authoring callers.

**Throws**

The original authoring error for invalid options.

**Example**

```ts
const node = defineGraphNode({ id: "step", input, output, handler });
```

**Signature**

```ts
declare const defineGraphNode: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const ResumeSchema extends StandardSchemaV1 | undefined = undefined,
  const Ends extends readonly string[] = readonly [],
>(
  options: DefineGraphNodeOptions<Id, InputSchema, OutputSchema, ResumeSchema, Ends>,
) => GraphNodeDescriptor<Id, InputSchema, OutputSchema, ResumeSchema, Ends>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.ts#L121)

### defineGraphNodeEffect

Defines a native LangGraph node with RELKIT schemas and declared dynamic routes.

**Example**

```ts
Effect.runSync(defineGraphNodeEffect({ id: "step", input, output, handler }));
```

**Signature**

```ts
declare const defineGraphNodeEffect: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const ResumeSchema extends StandardSchemaV1 | undefined = undefined,
  const Ends extends readonly string[] = readonly [],
>(
  options: DefineGraphNodeOptions<Id, InputSchema, OutputSchema, ResumeSchema, Ends>,
) => Effect.Effect<
  GraphNodeDescriptor<Id, InputSchema, OutputSchema, ResumeSchema, Ends>,
  GraphNodeValidationFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.ts#L65)

### isGraphNodeDescriptor

Checks a graph node descriptor for existing synchronous callers.

**Example**

```ts
if (isGraphNodeDescriptor(value)) useNode(value);
```

**Signature**

```ts
declare const isGraphNodeDescriptor: (value: unknown) => value is GraphNodeAny;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.ts#L166)

### isGraphNodeDescriptorEffect

Checks whether a value is a native graph node descriptor.

**Example**

```ts
Effect.runSync(isGraphNodeDescriptorEffect(value));
```

**Signature**

```ts
declare const isGraphNodeDescriptorEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.ts#L142)

### runGraphNodeHandlerEffect

Runs input validation, the user handler, and output validation in one Effect.

**Example**

```ts
await Effect.runPromise(runGraphNodeHandlerEffect(options, [], input));
```

**Signature**

```ts
declare const runGraphNodeHandlerEffect: <
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
  Ends extends readonly string[],
>(
  options: Pick<
    DefineGraphNodeOptions<
      string,
      InputSchema,
      OutputSchema,
      StandardSchemaV1<unknown, unknown> | undefined,
      Ends
    >,
    "input" | "output" | "handler"
  >,
  ends: Ends,
  input: unknown,
  config?: LangGraphRunnableConfig<Record<string, any>> | undefined,
) => Effect.Effect<GraphNodeResult<OutputSchema, Ends>, GraphNodeValidationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.ts#L36)

## `define-graph-node.types.ts`

Creates typed native graph node descriptors from author callbacks and records their execution metadata for later graph compilation. This companion preserves the native input and output types without starting runtime work.

### DefineGraphNodeOptions (interface)

Authoring options for a native LangGraph node.

**Signature**

```ts
export interface DefineGraphNodeOptions<
  Id extends string,
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
  ResumeSchema extends StandardSchemaV1 | undefined,
  Ends extends readonly string[],
> extends DescriptorMetadata {
  readonly id: Id;
  readonly input: InputSchema;
  readonly output: OutputSchema;
  readonly resume?: ResumeSchema;
  readonly ends?: Ends;
  readonly handler: GraphNodeImplementation<InputSchema, OutputSchema, Ends>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.types.ts#L75)

### GraphNodeAny (type alias)

Erased graph node descriptor for runtime validation.

**Signature**

```ts
type GraphNodeAny = GraphNodeDescriptor<
  string,
  StandardSchemaV1,
  StandardSchemaV1,
  StandardSchemaV1 | undefined,
  readonly string[]
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.types.ts#L66)

### GraphNodeDescriptor (interface)

Immutable native graph node descriptor.

**Signature**

```ts
export interface GraphNodeDescriptor<
  Id extends string = string,
  InputSchema extends StandardSchemaV1 = StandardSchemaV1,
  OutputSchema extends StandardSchemaV1 = StandardSchemaV1,
  ResumeSchema extends StandardSchemaV1 | undefined = StandardSchemaV1 | undefined,
  Ends extends readonly string[] = readonly string[],
> extends DescriptorMetadata {
  readonly [RELKIT_GRAPH_NODE]: true;
  readonly kind: "graph-node";
  readonly id: Id;
  readonly input: InputSchema;
  readonly output: OutputSchema;
  readonly resume?: ResumeSchema;
  readonly ends: Ends;
  readonly handler: GraphNodeHandler<InputSchema, OutputSchema, Ends>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.types.ts#L48)

### GraphNodeHandler (type alias)

Validated handler stored on a graph node descriptor.

**Signature**

```ts
type GraphNodeHandler<
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
  Ends extends readonly string[],
> = (
  input: InferOutput<InputSchema>,
  config?: LangGraphRunnableConfig,
) => MaybePromise<GraphNodeResult<OutputSchema, Ends>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.types.ts#L25)

### GraphNodeImplementation (type alias)

User implementation before RELKIT input and output validation.

**Signature**

```ts
type GraphNodeImplementation<
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
  Ends extends readonly string[],
> = (
  input: InferOutput<InputSchema>,
  config?: LangGraphRunnableConfig,
) => MaybePromise<
  | NodeUpdateInput<OutputSchema>
  | Command<unknown, NodeUpdateInput<OutputSchema>, CommandNodes<Ends>>
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.types.ts#L35)

### GraphNodeResult (type alias)

Validated graph node result or native routing command.

**Signature**

```ts
type GraphNodeResult<OutputSchema extends StandardSchemaV1, Ends extends readonly string[]> =
  NodeUpdate<OutputSchema> | Command<unknown, NodeUpdate<OutputSchema>, CommandNodes<Ends>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph-node.types.ts#L21)

## `define-graph.ts`

Exposes typed LangGraph authoring and delegates descriptor validation and construction before any graph execution can begin.

### "./define-graph.types.js" (namespace export)

Re-exports all named exports from the "./define-graph.types.js" module.

**Signature**

```ts
export * from "./define-graph.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.ts#L19)

### defineGraph

Defines a graph for existing synchronous authoring callers.

**Throws**

The original invalid graph authoring or identity error.

**Example**

```ts
const graph = defineGraph({ id: "flow", state, input, output, nodes, edges, limits });
```

**Signature**

```ts
declare const defineGraph: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const State extends AnyStateSchema,
  const Nodes extends readonly GraphNodeLike[],
>(
  options: DefineGraphOptions<Id, InputSchema, OutputSchema, State, Nodes>,
) => GraphDescriptor<Id, InputSchema, OutputSchema, State, Nodes>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.ts#L63)

#### Backend and frontend example

**Backend** — these maintained files define the operation used by the frontend below.

```ts title="examples/commerce/src/services/orders/agents/order-review.agent.ts"
const orderReview = defineGraph({
  state,
  input: z.object({ orderId: z.string() }),
  output: z.object({ result: z.string() }),
  nodes: [inventory, risk, retry, review, finish],
  edges: (edge) =>
    edge
      .addEdge(START, "load-inventory")
      .addEdge(START, "assess-risk")
      .addEdge(["load-inventory", "assess-risk"], "retry")
      .addConditionalEdges("retry", ({ attempts }) => (attempts === 1 ? "again" : "ready"), {
        again: "retry",
        ready: "review",
      })
      .addEdge("finish", END),
  checkpointer: orderCheckpoints,
  store: orderMemory,
  limits: { maxSteps: 10, maxToolCalls: 1, timeoutMs: 20_000 },
  stateProfile: "agents",
  client: {
    public: true,
    state: ["inventory", "risk", "attempts", "approved", "result"],
  },
  controls: ["stop"],
});
```

**Frontend**

After [frontend setup and pulling the commerce contract](/guides/frontend/connect-react), render
this component under the provider with your application's stable business `threadId`:

```tsx title="src/OrderReview.tsx"
"use client";

/** Starts the commerce review graph and answers its boolean interrupt on the same business thread. */
import { useAgent, useRelkitClient } from "@relkit/client/react";
import { useState } from "react";

/** Keeps initial input and a waiting reply distinct while rendering the graph's final result.
 * @param props - Authorized order-review thread retained by the application.
 * @returns Start/approve actions, current result, and visible submission failure. */
export function OrderReview({ threadId }: { readonly threadId: string }) {
  const { status } = useRelkitClient();
  const review = useAgent("orders.order-review");
  const [failure, setFailure] = useState("");

  /** Starts one review; uncertain acceptance is left for explicit thread recovery.
   * @returns Completion after acceptance or displaying the failure. */
  async function startReview() {
    try {
      await review.run({ orderId: "demo-1" }, { threadId });
    } catch (error) {
      setFailure(String(error));
    }
  }

  /** Replies with the review node's declared boolean on the original thread.
   * @returns Completion after the continuation is accepted or its failure is displayed. */
  async function approve() {
    try {
      await review.run(true, { threadId, resume: true });
    } catch (error) {
      setFailure(String(error));
    }
  }

  return (
    <section>
      <button
        disabled={status !== "ready" || review.status !== "idle" || failure !== ""}
        onClick={startReview}
      >
        Start review
      </button>
      <button
        disabled={status !== "ready" || review.status !== "waiting" || failure !== ""}
        onClick={approve}
      >
        Approve order
      </button>
      <p role="status">{review.output?.result ?? review.status}</p>
      {failure && <p role="alert">{failure}. Check this thread before submitting again.</p>}
    </section>
  );
}
```

`defineGraph` generates an agent client too. The initial `run` receives `{ orderId }`; the review
node's `resume: z.boolean()` makes the continuation accept a boolean. Resume the same thread with
`{ resume: true }`, and show the final `output.result`. Do not send a replacement initial run to
answer an interrupt or replay an uncertain submission.

Reference: [`useAgent`](/docs/api/client#useagent).
Continue with [threads and recovery](/docs/modules/ai/threads-recovery).

### defineGraphEffect

Defines an inspectable agent backed by native LangGraph.

**Example**

```ts
Effect.runSync(defineGraphEffect({ id: "flow", state, input, output, nodes, edges, limits }));
```

**Signature**

```ts
declare const defineGraphEffect: <
  const Id extends string,
  const InputSchema extends StandardSchemaV1,
  const OutputSchema extends StandardSchemaV1,
  const State extends AnyStateSchema,
  const Nodes extends readonly GraphNodeLike[],
>(
  options: DefineGraphOptions<Id, InputSchema, OutputSchema, State, Nodes>,
) => Effect.Effect<
  GraphDescriptor<Id, InputSchema, OutputSchema, State, Nodes>,
  GraphDefinitionFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.ts#L26)

### graphExecution

Reads graph runtime state for existing synchronous callers.

**Example**

```ts
graphExecution(graph);
```

**Signature**

```ts
declare const graphExecution: (value: GraphDescriptor) => GraphExecution;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.ts#L94)

### graphExecutionEffect

Reads the hidden runtime state of an authored graph.

**Example**

```ts
Effect.runSync(graphExecutionEffect(graph));
```

**Signature**

```ts
declare const graphExecutionEffect: (
  value: GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
) => Effect.Effect<GraphExecution<InferStateSchemaValue<any>>, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.ts#L84)

### isGraphDescriptor

Checks a graph descriptor for existing synchronous callers.

**Example**

```ts
if (isGraphDescriptor(candidate)) invokeGraph(candidate);
```

**Signature**

```ts
declare const isGraphDescriptor: (value: unknown) => value is GraphDescriptor;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.ts#L122)

### isGraphDescriptorEffect

Checks whether a value is a native graph descriptor.

**Example**

```ts
Effect.runSync(isGraphDescriptorEffect(candidate));
```

**Signature**

```ts
declare const isGraphDescriptorEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.ts#L103)

## `define-graph.types.ts`

Exposes typed LangGraph authoring and delegates descriptor validation and construction before any graph execution can begin. This companion preserves the native input and output types without starting runtime work.

### DefineGraphOptions (interface)

Authoring options for a native LangGraph agent descriptor.

**Signature**

```ts
export interface DefineGraphOptions<
  Id extends string,
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
  State extends AnyStateSchema,
  Nodes extends readonly GraphNodeLike[],
> extends DescriptorMetadata {
  readonly id?: Id;
  readonly state: State;
  readonly input: InputSchema;
  readonly output: OutputSchema;
  readonly nodes: Nodes & UniqueNodes<Nodes>;
  readonly edges: (
    graph: GraphEdgeBuilder<NoInfer<Extract<GraphNodeId<Nodes>, string>>, GraphState<State>>,
  ) => unknown;
  readonly limits: AgentLimits;
  readonly stateProfile?: string;
  readonly client?: AgentClientPolicy<(...args: any[]) => unknown, GraphStateKey<State>>;
  readonly controls?: readonly AgentControl[];
  readonly checkpointer?: BaseCheckpointSaver | CheckpointerResource;
  readonly store?: BaseStore | MemoryResource;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.types.ts#L79)

### GraphDescriptor (interface)

Inspectable agent descriptor backed by a native LangGraph graph.

**Signature**

```ts
export interface GraphDescriptor<
  Id extends string = string,
  InputSchema extends StandardSchemaV1 = StandardSchemaV1,
  OutputSchema extends StandardSchemaV1 = StandardSchemaV1,
  State extends AnyStateSchema = AnyStateSchema,
  Nodes extends readonly GraphNodeLike[] = readonly GraphNodeLike[],
>
  extends DescriptorBase<"agent", Id>, AgentRef<Id, InputSchema, OutputSchema> {
  readonly execution: "graph";
  readonly input: InputSchema;
  readonly output: OutputSchema;
  readonly nodes: Nodes;
  readonly workflow: GraphWorkflow;
  readonly instructions: "";
  readonly tools: readonly [];
  readonly middleware: readonly [];
  readonly limits: AgentLimits;
  readonly stateProfile?: string;
  readonly client?: AgentClientPolicy<(...args: any[]) => unknown, GraphStateKey<State>>;
  readonly controls?: readonly AgentControl[];
  readonly clientContract: AgentClientContractMetadata;
  readonly [GRAPH_EXECUTION]: GraphExecution<GraphState<State>>;
  readonly asGraphNode: <const NodeId extends string = Id>(
    options?: GraphAsNodeOptions<NodeId>,
  ) => SubgraphNodeDescriptor<NodeId, InputSchema, OutputSchema>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.types.ts#L51)

### GraphExecution (interface)

Runtime state and persistence declarations hidden on a graph descriptor.

**Signature**

```ts
export interface GraphExecution<State = any> {
  readonly state: AnyStateSchema;
  readonly operations: readonly GraphEdgeOperation<string, State>[];
  readonly checkpointer?: BaseCheckpointSaver | CheckpointerResource;
  readonly store?: BaseStore | MemoryResource;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.types.ts#L43)

### GraphInput (type alias)

Input inferred from a graph descriptor.

**Signature**

```ts
type GraphInput<Graph extends GraphDescriptor> = InferInput<Graph["input"]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.types.ts#L103)

### GraphNodeId (type alias)

ID union of a graph's authored nodes.

**Signature**

```ts
type GraphNodeId<Nodes extends readonly GraphNodeLike[]> = Nodes[number]["id"];
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.types.ts#L21)

### GraphNodeLike (type alias)

Authored node accepted by a graph descriptor.

**Signature**

```ts
type GraphNodeLike = GraphNodeAny | FunctionGraphNodeDescriptor | SubgraphNodeDescriptor;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.types.ts#L18)

### GraphOutput (type alias)

Output inferred from a graph descriptor.

**Signature**

```ts
type GraphOutput<Graph extends GraphDescriptor> = InferOutput<Graph["output"]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.types.ts#L106)

### GraphState (type alias)

State value inferred from a LangGraph StateSchema.

**Signature**

```ts
type GraphState<State extends AnyStateSchema> = State["State"];
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.types.ts#L24)

### GraphStateKey (type alias)

Public state keys selected from a LangGraph StateSchema.

**Signature**

```ts
type GraphStateKey<State extends AnyStateSchema> = Extract<keyof GraphState<State>, string>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-graph.types.ts#L27)

## `define-persistence-guards.ts`

Recognizes supported native checkpointer and store shapes before persistence descriptors accept them, preserving SDK identity rather than cloning resources.

### assertPersistenceProtocol

Validates a resolved handle for existing synchronous callers.

**Throws**

The original protocol TypeError.

**Example**

```ts
assertPersistenceProtocol("memory", store);
```

**Signature**

```ts
declare const assertPersistenceProtocol: (
  resource: "checkpointer" | "memory",
  value: unknown,
) => asserts value is BaseCheckpointSaver | BaseStore;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence-guards.ts#L68)

### assertPersistenceProtocolEffect

Validates a resolved LangGraph checkpointer or memory store.

**Example**

```ts
Effect.runSync(assertPersistenceProtocolEffect("memory", store));
```

**Signature**

```ts
declare const assertPersistenceProtocolEffect: (
  resource: "checkpointer" | "memory",
  value: unknown,
) => Effect.Effect<void, AgentPersistenceFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence-guards.ts#L44)

### isPersistenceResource

Checks a resource for existing synchronous callers.

**Example**

```ts
if (isPersistenceResource(value)) await value.acquire(context);
```

**Signature**

```ts
declare const isPersistenceResource: (value: unknown) => value is PersistenceResource<any, any>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence-guards.ts#L34)

### isPersistenceResourceEffect

Checks whether a value is a RELKIT persistence resource descriptor.

**Example**

```ts
Effect.runSync(isPersistenceResourceEffect(candidate));
```

**Signature**

```ts
declare const isPersistenceResourceEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence-guards.ts#L15)

## `define-persistence.ts`

Creates native persistence descriptors around authored checkpointers and stores; runtime acquisition and release remain owned by the invocation scope.

### "./define-persistence.types.js" (namespace export)

Re-exports all named exports from the "./define-persistence.types.js" module.

**Signature**

```ts
export * from "./define-persistence.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.ts#L17)

### assertPersistenceProtocol

**Signature**

```ts
declare const assertPersistenceProtocol: (
  resource: "checkpointer" | "memory",
  value: unknown,
) => asserts value is BaseCheckpointSaver | BaseStore;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.ts#L19)

### assertPersistenceProtocolEffect

**Signature**

```ts
declare const assertPersistenceProtocolEffect: (
  resource: "checkpointer" | "memory",
  value: unknown,
) => Effect.Effect<void, AgentPersistenceFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.ts#L20)

### defineCheckpointerDb

Defines a checkpointer for existing synchronous authoring callers.

**Throws**

The original invalid options error.

**Example**

```ts
const resource = defineCheckpointerDb({ id: "db", client: saver });
```

**Signature**

```ts
declare const defineCheckpointerDb: <Value extends BaseCheckpointSaver>(
  options: PersistenceOptions<Value>,
) => CheckpointerResource<Value>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.ts#L45)

### defineCheckpointerDbEffect

Defines a lazily acquired checkpointer resource.

**Example**

```ts
Effect.runSync(defineCheckpointerDbEffect({ id: "db", client: saver }));
```

**Signature**

```ts
declare const defineCheckpointerDbEffect: <Value extends BaseCheckpointSaver>(
  options: PersistenceOptions<Value>,
) => Effect.Effect<PersistenceResource<"checkpointer", Value>, AgentPersistenceFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.ts#L30)

### defineMemoryDb

Defines a memory store for existing synchronous authoring callers.

**Throws**

The original invalid options error.

**Example**

```ts
const resource = defineMemoryDb({ id: "memory", client: store });
```

**Signature**

```ts
declare const defineMemoryDb: <Value extends BaseStore>(
  options: PersistenceOptions<Value>,
) => MemoryResource<Value>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.ts#L75)

### defineMemoryDbEffect

Defines a lazily acquired memory store resource.

**Example**

```ts
Effect.runSync(defineMemoryDbEffect({ id: "memory", client: store }));
```

**Signature**

```ts
declare const defineMemoryDbEffect: <Value extends BaseStore>(
  options: PersistenceOptions<Value>,
) => Effect.Effect<PersistenceResource<"memory", Value>, AgentPersistenceFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.ts#L60)

### isPersistenceResource

**Signature**

```ts
declare const isPersistenceResource: (value: unknown) => value is PersistenceResource<any, any>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.ts#L21)

### isPersistenceResourceEffect

**Signature**

```ts
declare const isPersistenceResourceEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.ts#L22)

## `define-persistence.types.ts`

Creates native persistence descriptors around authored checkpointers and stores; runtime acquisition and release remain owned by the invocation scope. This companion preserves the native input and output types without starting runtime work.

### CheckpointerResource (type alias)

Checkpointer resource passed to a LangGraph runtime.

**Signature**

```ts
type CheckpointerResource<Value extends BaseCheckpointSaver = BaseCheckpointSaver> =
  PersistenceResource<"checkpointer", Value>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.types.ts#L24)

### MemoryResource (type alias)

Memory store resource passed to a LangGraph runtime.

**Signature**

```ts
type MemoryResource<Value extends BaseStore = BaseStore> = PersistenceResource<"memory", Value>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.types.ts#L27)

### PersistenceContext (interface)

Environment made available while acquiring persistence.

**Signature**

```ts
export interface PersistenceContext {
  readonly env: Readonly<Record<string, unknown>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.types.ts#L8)

### PersistenceOptions (interface)

Acquisition and disposal configuration for an agent persistence resource.

**Signature**

```ts
export interface PersistenceOptions<Value> {
  readonly id: string;
  readonly client: Value | ((context: PersistenceContext) => MaybePromise<Value>);
  readonly ownership?: "owned" | "borrowed";
  readonly dispose?: (value: Value) => MaybePromise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.types.ts#L33)

### PersistenceResource (interface)

Lazily acquired, explicitly released persistence descriptor.

**Signature**

```ts
export interface PersistenceResource<Kind extends "checkpointer" | "memory", Value> {
  readonly [RELKIT_PERSISTENCE]: true;
  readonly kind: "agent-persistence";
  readonly resource: Kind;
  readonly id: string;
  readonly ownership: "owned" | "borrowed";
  readonly acquire: (context: PersistenceContext) => Promise<Value>;
  readonly release: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/define-persistence.types.ts#L13)

## `graph-compile-error.ts`

Defines typed failures for native graph compilation, preserving the graph identity and underlying native compile cause.

### GraphCompilationFailure (class)

Tagged graph compilation or route execution failure.

**Signature**

```ts
declare class GraphCompilationFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-compile-error.ts#L6)

### graphCompilationFailure

Preserves a graph compilation or route error for Effect callers.

**Example**

```ts
graphCompilationFailure(new TypeError("invalid route"));
```

**Signature**

```ts
declare const graphCompilationFailure: (cause: unknown) => GraphCompilationFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-compile-error.ts#L16)

## `graph-compile.ts`

Compiles validated RELKIT graph descriptors into LangGraph execution objects using the authored nodes, edges, state and persistence options.

### compileGraph

Compiles a graph for existing synchronous runtime callers.

**Throws**

The original compilation error.

**Example**

```ts
const runnable = compileGraph(graph);
```

**Signature**

```ts
declare const compileGraph: (
  descriptor: GraphDescriptor,
  persistence?: ResolvedGraphPersistence,
) => any;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-compile.ts#L112)

### compileGraphEffect

Compiles a graph descriptor and its resolved persistence resources.

**Example**

```ts
Effect.runSync(compileGraphEffect(graph));
```

**Signature**

```ts
declare const compileGraphEffect: (
  descriptor: GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  persistence?: ResolvedGraphPersistence | undefined,
) => Effect.Effect<any, GraphCompilationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-compile.ts#L61)

### runGraphRouteEffect

Runs a user route and validates its destination with linked cancellation.

**Example**

```ts
await Effect.runPromise(runGraphRouteEffect(route, state, config, ids));
```

**Signature**

```ts
declare const runGraphRouteEffect: <Id extends string>(
  route: (state: unknown, config: LangGraphRunnableConfig) => MaybePromise<unknown>,
  state: unknown,
  config: LangGraphRunnableConfig<Record<string, any>>,
  nodeIds: ReadonlySet<Id>,
  destinations?: Readonly<Record<string, "__end__" | Id>> | undefined,
) => Effect.Effect<unknown, GraphCompilationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-compile.ts#L25)

## `graph-continuation-error.ts`

Defines continuation failures for persisted native graphs so invalid or unavailable resume state remains distinct from invocation failures.

### GraphContinuationFailure (class)

Tagged validation or state failure while resuming a graph.

**Signature**

```ts
declare class GraphContinuationFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation-error.ts#L6)

### graphContinuationFailure

Preserves the original graph continuation error.

**Example**

```ts
graphContinuationFailure(new TypeError("invalid reply"));
```

**Signature**

```ts
declare const graphContinuationFailure: (cause: unknown) => GraphContinuationFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation-error.ts#L16)

## `graph-continuation-validation.ts`

Checks persisted graph continuation input and identity before native resume admission, preventing execution against a mismatched thread or graph.

### validateGraphResumeInput

Validates graph continuation replies for existing Promise callers.

**Throws**

The original continuation validation error.

**Example**

```ts
await validateGraphResumeInput(graph, requests, reply);
```

**Signature**

```ts
declare const validateGraphResumeInput: (
  descriptor: GraphDescriptor,
  requests: readonly AgentWaitingRequest[],
  value: unknown,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation-validation.ts#L67)

### validateGraphResumeInputEffect

Validates one or more graph continuation replies with bounded concurrency.

**Example**

```ts
Effect.runPromise(validateGraphResumeInputEffect(graph, requests, reply));
```

**Signature**

```ts
declare const validateGraphResumeInputEffect: (
  descriptor: GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  requests: ReadonlyArray<AgentWaitingRequest>,
  value: unknown,
) => Effect.Effect<unknown, GraphContinuationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation-validation.ts#L19)

## `graph-continuation-waiting.ts`

Projects native graph interrupts into durable waiting state used by the RELKIT continuation protocol before returning control to callers.

### waitingInterrupts

Reads waiting interrupts for existing Promise callers.

**Throws**

The original graph state or schema failure.

**Example**

```ts
await waitingInterrupts(graph, descriptor, config);
```

**Signature**

```ts
declare const waitingInterrupts: (
  graph: CompiledGraph,
  descriptor: GraphDescriptor,
  config: GraphConfig,
) => Promise<readonly GraphWaitingInterrupt[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation-waiting.ts#L42)

### waitingInterruptsEffect

Reads waiting interrupts from the graph state snapshot.

**Example**

```ts
Effect.runPromise(waitingInterruptsEffect(graph, descriptor, config));
```

**Signature**

```ts
declare const waitingInterruptsEffect: (
  graph: any,
  descriptor: GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  config: GraphConfig,
) => Effect.Effect<ReadonlyArray<GraphWaitingInterrupt>, GraphContinuationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation-waiting.ts#L20)

## `graph-continuation.ts`

Coordinates native graph resume requests with persisted waiting state and the invocation scope, preserving continuation failures and thread identity.

### GraphConfig

**Signature**

```ts
declare const GraphConfig: GraphConfig;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.ts#L13)

### graphConfig

Builds graph run configuration for existing synchronous callers.

**Throws**

The original missing thread error.

**Example**

```ts
const config = graphConfig(graph, "thread");
```

**Signature**

```ts
declare const graphConfig: (descriptor: GraphDescriptor, threadId?: string) => GraphConfig;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.ts#L48)

### graphConfigEffect

Builds a persistent graph run configuration.

**Example**

```ts
Effect.runSync(graphConfigEffect(graph, "thread"));
```

**Signature**

```ts
declare const graphConfigEffect: (
  descriptor: GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  threadId?: string | undefined,
) => Effect.Effect<GraphConfig, GraphContinuationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.ts#L26)

### resumeCommand

Constructs a native resume command for existing Promise callers.

**Throws**

The original state or continuation validation error.

**Example**

```ts
await resumeCommand(graph, descriptor, config, reply);
```

**Signature**

```ts
declare const resumeCommand: (
  graph: CompiledGraph,
  descriptor: GraphDescriptor,
  config: GraphConfig,
  value: unknown,
) => Promise<Command>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.ts#L98)

### resumeCommandEffect

Validates a reply and constructs a native LangGraph resume command.

**Example**

```ts
Effect.runPromise(resumeCommandEffect(graph, descriptor, config, reply));
```

**Signature**

```ts
declare const resumeCommandEffect: (
  graph: any,
  descriptor: GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  config: GraphConfig,
  value: unknown,
) => Effect.Effect<
  Command<unknown, Record<string, unknown>, string>,
  GraphContinuationFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.ts#L64)

### validateGraphResumeInput

**Signature**

```ts
declare const validateGraphResumeInput: (
  descriptor: GraphDescriptor,
  requests: readonly AgentWaitingRequest[],
  value: unknown,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.ts#L15)

### validateGraphResumeInputEffect

**Signature**

```ts
declare const validateGraphResumeInputEffect: (
  descriptor: GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  requests: ReadonlyArray<AgentWaitingRequest>,
  value: unknown,
) => Effect.Effect<unknown, GraphContinuationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.ts#L16)

### waitingInterrupts

**Signature**

```ts
declare const waitingInterrupts: (
  graph: CompiledGraph,
  descriptor: GraphDescriptor,
  config: GraphConfig,
) => Promise<readonly GraphWaitingInterrupt[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.ts#L18)

### waitingInterruptsEffect

**Signature**

```ts
declare const waitingInterruptsEffect: (
  graph: any,
  descriptor: GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  config: GraphConfig,
) => Effect.Effect<ReadonlyArray<GraphWaitingInterrupt>, GraphContinuationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.ts#L18)

## `graph-continuation.types.ts`

Coordinates native graph resume requests with persisted waiting state and the invocation scope, preserving continuation failures and thread identity. This companion preserves the native input and output types without starting runtime work.

### CompiledGraph (type alias)

Compiled graph accepted by continuation helpers.

**Signature**

```ts
type CompiledGraph = ReturnType<typeof compileGraph>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.types.ts#L9)

### GraphConfig (type alias)

LangGraph run configuration with an optional persistent thread identity.

**Signature**

```ts
type GraphConfig = {} | { readonly configurable: { readonly thread_id: string } };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-continuation.types.ts#L6)

## `graph-definition.ts`

Validates graph structure and resolves authored node identities before native compilation, reporting missing or inconsistent graph definitions.

### prepareGraphDefinition

Validates graph authoring for existing synchronous callers.

**Throws**

The original graph authoring error.

**Example**

```ts
const prepared = prepareGraphDefinition(state, input, output, nodes, edges);
```

**Signature**

```ts
declare const prepareGraphDefinition: (
  state: AnyStateSchema,
  input: StandardSchemaV1,
  output: StandardSchemaV1,
  sourceNodes: readonly GraphNodeLike[],
  edges: (builder: GraphEdgeBuilder<string, any>) => unknown,
) => {
  readonly nodes: readonly GraphNodeLike[];
  readonly operations: readonly GraphEdgeOperation<string, any>[];
  readonly stateKeys: Set<string>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-definition.ts#L53)

### prepareGraphDefinitionEffect

Validates graph state, nodes, and edge declarations.

**Example**

```ts
Effect.runSync(prepareGraphDefinitionEffect(state, input, output, nodes, edges));
```

**Signature**

```ts
declare const prepareGraphDefinitionEffect: (
  state: AnyStateSchema,
  input: StandardSchemaV1<unknown, unknown>,
  output: StandardSchemaV1<unknown, unknown>,
  sourceNodes: ReadonlyArray<GraphNodeLike>,
  edges: (builder: GraphEdgeBuilder<string, any>) => unknown,
) => Effect.Effect<
  {
    readonly nodes: readonly GraphNodeLike[];
    readonly operations: readonly GraphEdgeOperation<string, any>[];
    readonly stateKeys: Set<string>;
  },
  GraphDefinitionFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-definition.ts#L28)

## `graph-edge-destinations.ts`

Validates native graph endpoints and conditional route results before execution.
Mutation builders reuse the same endpoint and duplicate-edge rules.

### addUnique

**Signature**

```ts
declare const addUnique: (signatures: Set<string>, signature: string) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-destinations.ts#L140)

### assertEndpoint

**Signature**

```ts
declare const assertEndpoint: <Id extends string>(
  value: unknown,
  nodeIds: ReadonlySet<Id>,
  source: boolean,
) => asserts value is Id | typeof START | typeof END;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-destinations.ts#L122)

### assertGraphDestination

Checks native route targets for existing synchronous callers.

**Throws**

The original invalid destination error.

**Example**

```ts
assertGraphDestination("next", ids);
```

**Signature**

```ts
declare const assertGraphDestination: <Id extends string>(
  value: unknown,
  nodeIds: ReadonlySet<Id>,
) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-destinations.ts#L32)

### assertGraphDestinationEffect

Checks native route targets against registered nodes.

**Example**

```ts
Effect.runSync(assertGraphDestinationEffect("next", ids));
```

**Signature**

```ts
declare const assertGraphDestinationEffect: <Id extends string>(
  value: unknown,
  nodeIds: ReadonlySet<Id>,
) => Effect.Effect<void, GraphDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-destinations.ts#L16)

### copyDestinations

**Signature**

```ts
declare const copyDestinations: <Id extends string>(
  value: Readonly<Record<string, Id | typeof END>>,
  nodeIds: ReadonlySet<Id>,
) => Readonly<Record<string, Id | typeof END>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-destinations.ts#L112)

### validateGraphRoute

Validates dynamic routes for existing synchronous callers.

**Throws**

The original invalid route error.

**Example**

```ts
validateGraphRoute("yes", ids, { yes: "next" });
```

**Signature**

```ts
declare const validateGraphRoute: <Id extends string>(
  value: unknown,
  nodeIds: ReadonlySet<Id>,
  destinations?: Readonly<Record<string, Id | typeof END>>,
) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-destinations.ts#L82)

### validateGraphRouteEffect

Validates dynamic route labels or node destinations.

**Example**

```ts
Effect.runSync(validateGraphRouteEffect("yes", ids, { yes: "next" }));
```

**Signature**

```ts
declare const validateGraphRouteEffect: <Id extends string>(
  value: unknown,
  nodeIds: ReadonlySet<Id>,
  destinations?: Readonly<Record<string, "__end__" | Id>> | undefined,
) => Effect.Effect<void, GraphDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-destinations.ts#L61)

## `graph-edge-mutations.ts`

Applies validated edge mutations to one builder-owned operation log. Factories
retain that builder's closure so duplicate checks and mutation order stay local.

### conditionalEdgeMutation

Creates conditional mutations sharing one checked operation log.

**Signature**

```ts
declare const conditionalEdgeMutation: <Id extends string, State>(
  context: GraphEdgeMutationContext<Id, State>,
) => (
  source: "__start__" | Id,
  route: (state: State, config: LangGraphRunnableConfig) => MaybePromise<unknown>,
  destinations?: Readonly<Record<string, "__end__" | Id>> | undefined,
) => Effect.Effect<GraphEdgeBuilder<Id, State>, GraphDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-mutations.ts#L18)

### edgeMutation

Creates direct/join mutations sharing the same checked operation log.

**Signature**

```ts
declare const edgeMutation: <Id extends string, State>(
  context: GraphEdgeMutationContext<Id, State>,
) => (
  start: "__start__" | Id | ReadonlyArray<Id>,
  end: "__end__" | Id,
) => Effect.Effect<GraphEdgeBuilder<Id, State>, GraphDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-mutations.ts#L55)

## `graph-edge-mutations.types.ts`

One graph builder's private ordered mutation authority.

### GraphEdgeMutationContext (interface)

**Signature**

```ts
export interface GraphEdgeMutationContext<Id extends string, State> {
  readonly nodeIds: ReadonlySet<Id>;
  readonly operations: GraphEdgeOperation<Id, State>[];
  readonly signatures: Set<string>;
  readonly builder: () => GraphEdgeBuilder<Id, State>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edge-mutations.types.ts#L3)

## `graph-edges.ts`

Defines typed native graph edge and routing descriptors whose endpoints are checked during graph assembly and compilation.

### "./graph-edges.types.js" (namespace export)

Re-exports all named exports from the "./graph-edges.types.js" module.

**Signature**

```ts
export * from "./graph-edges.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.ts#L12)

### assertGraphDestination

**Signature**

```ts
declare const assertGraphDestination: <Id extends string>(
  value: unknown,
  nodeIds: ReadonlySet<Id>,
) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.ts#L62)

### assertGraphDestinationEffect

**Signature**

```ts
declare const assertGraphDestinationEffect: <Id extends string>(
  value: unknown,
  nodeIds: ReadonlySet<Id>,
) => Effect.Effect<void, GraphDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.ts#L63)

### createGraphEdgeBuilder

Creates an edge builder for existing synchronous graph authoring.

**Example**

```ts
const { builder, operations } = createGraphEdgeBuilder(ids);
```

**Signature**

```ts
declare const createGraphEdgeBuilder: <Id extends string, State>(
  nodeIds: ReadonlySet<Id>,
) => {
  readonly builder: GraphEdgeBuilder<Id, State>;
  readonly operations: readonly GraphEdgeOperation<Id, State>[];
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.ts#L52)

### createGraphEdgeBuilderEffect

Creates an edge builder whose mutations run through Effect.

**Example**

```ts
Effect.runSync(createGraphEdgeBuilderEffect(ids));
```

**Signature**

```ts
declare const createGraphEdgeBuilderEffect: <Id extends string, State>(
  nodeIds: ReadonlySet<Id>,
) => Effect.Effect<
  {
    builder: Readonly<GraphEdgeBuilder<Id, State>>;
    operations: Array<GraphEdgeOperation<Id, State>>;
  },
  never,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.ts#L18)

### validateGraphRoute

**Signature**

```ts
declare const validateGraphRoute: <Id extends string>(
  value: unknown,
  nodeIds: ReadonlySet<Id>,
  destinations?: Readonly<Record<string, Id | typeof END>>,
) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.ts#L64)

### validateGraphRouteEffect

**Signature**

```ts
declare const validateGraphRouteEffect: <Id extends string>(
  value: unknown,
  nodeIds: ReadonlySet<Id>,
  destinations?: Readonly<Record<string, "__end__" | Id>> | undefined,
) => Effect.Effect<void, GraphDefinitionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.ts#L65)

## `graph-edges.types.ts`

Defines typed native graph edge and routing descriptors whose endpoints are checked during graph assembly and compilation. This companion preserves the native input and output types without starting runtime work.

### GraphConditionalRoute (type alias)

Label based graph conditional route callback.

**Signature**

```ts
type GraphConditionalRoute<Id extends string, State, Key extends string> = (
  state: State,
  config: LangGraphRunnableConfig,
) => MaybePromise<Key | Send<Id, Partial<State>> | readonly (Key | Send<Id, Partial<State>>)[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.types.ts#L13)

### GraphEdgeBuilder (interface)

Mutable graph edge authoring interface backed by Effect operations.

**Signature**

```ts
export interface GraphEdgeBuilder<Id extends string, State> {
  /** Adds a static or join edge.
   * @param start - One or more source nodes.
   * @param end - Destination node.
   * @returns This builder.
   * @throws TypeError for invalid or duplicate edges.
   * @example edge.addEdge("start", "finish");
   */
  addEdge(
    start: typeof START | NoInfer<Id> | readonly NoInfer<Id>[],
    end: NoInfer<Id> | typeof END,
  ): GraphEdgeBuilder<Id, State>;
  /** Adds a dynamic edge.
   * @param source - Source node.
   * @param route - Route callback.
   * @returns This builder.
   * @throws TypeError for invalid or duplicate routes.
   * @example edge.addConditionalEdges("start", () => "finish");
   */
  addConditionalEdges(
    source: typeof START | NoInfer<Id>,
    route: GraphRoute<NoInfer<Id>, State>,
  ): GraphEdgeBuilder<Id, State>;
  /** Adds a labeled dynamic edge.
   * @param source - Source node.
   * @param route - Route callback.
   * @param destinations - Label to destination mapping.
   * @returns This builder.
   * @throws TypeError for invalid or duplicate routes.
   * @example edge.addConditionalEdges("start", () => "yes", { yes: "finish" });
   */
  addConditionalEdges<const Key extends string>(
    source: typeof START | NoInfer<Id>,
    route: GraphConditionalRoute<NoInfer<Id>, State, Key>,
    destinations: Readonly<Record<Key, NoInfer<Id> | typeof END>>,
  ): GraphEdgeBuilder<Id, State>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.types.ts#L19)

### GraphEdgeOperation (type alias)

Recorded edge operation consumed by the LangGraph compiler.

**Signature**

```ts
type GraphEdgeOperation<Id extends string, State> =
  | {
      readonly kind: "edge";
      readonly start: typeof START | Id | readonly Id[];
      readonly end: Id | typeof END;
    }
  | {
      readonly kind: "conditional";
      readonly source: typeof START | Id;
      readonly route: (state: State, config: LangGraphRunnableConfig) => MaybePromise<unknown>;
      readonly destinations?: Readonly<Record<string, Id | typeof END>>;
    };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.types.ts#L58)

### GraphRoute (type alias)

Native graph conditional route callback.

**Signature**

```ts
type GraphRoute<Id extends string, State> = (
  state: State,
  config: LangGraphRunnableConfig,
) => MaybePromise<Id | typeof END | Send<Id> | readonly (Id | Send<Id>)[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-edges.types.ts#L7)

## `graph-execution-symbol.ts`

Private nonenumerable slot holding compiled graph authoring data.

### GRAPH_EXECUTION

Private nonenumerable slot holding compiled graph authoring data.

**Signature**

```ts
declare const GRAPH_EXECUTION: unique symbol;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-execution-symbol.ts#L2)

## `graph-interruption.ts`

Converts native graph interrupt observations into RELKIT continuation data while preserving the interrupt identifiers needed for resume.

### GraphInterruptedError (class)

Internal control result used by the server to publish a durable waiting snapshot.

**Example**

```ts
throw new GraphInterruptedError("thread-1", interrupts);
```

**Signature**

```ts
declare class GraphInterruptedError { constructor(
    readonly threadId: string,
    readonly interrupts: readonly GraphWaitingInterrupt[],
  ) }
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L115)

### code (property)

**Signature**

```ts
readonly code: "RELKIT_GRAPH_INTERRUPTED"
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L116)

### GraphWaitingInterrupt

**Signature**

```ts
declare const GraphWaitingInterrupt: GraphWaitingInterrupt;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L9)

### GraphWaitingResponseError (class)

No pending request is available to form a graph interruption response.

**Signature**

```ts
declare class GraphWaitingResponseError
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L17)

### graphWaitingResponse

Combines pending graph responses for synchronous runtime callers.

**Throws**

TypeError when no request is pending.

**Example**

```ts
const response = graphWaitingResponse([{ node: "review", response: true }]);
```

**Signature**

```ts
declare const graphWaitingResponse: (interrupts: readonly GraphWaitingInterrupt[]) => JsonValue;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L63)

### graphWaitingResponseEffect

Combines pending graph responses into one JSON schema.

**Example**

```ts
const response = Effect.runSync(graphWaitingResponseEffect([{ node: "review", response: true }]));
```

**Signature**

```ts
declare const graphWaitingResponseEffect: (
  interrupts: ReadonlyArray<GraphWaitingInterrupt>,
) => Effect.Effect<JsonValue, GraphWaitingResponseError, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L30)

### isGraphInterruptedError

Recognizes graph interruption errors for synchronous callers.

**Example**

```ts
if (isGraphInterruptedError(error)) console.log(error.threadId);
```

**Signature**

```ts
declare const isGraphInterruptedError: (value: unknown) => value is GraphInterruptedError;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L151)

### isGraphInterruptedErrorEffect

Recognizes the internal graph interruption control result.

**Example**

```ts
const interrupted = Effect.runSync(isGraphInterruptedErrorEffect(error));
```

**Signature**

```ts
declare const isGraphInterruptedErrorEffect: (
  value: unknown,
) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L135)

### publicWaitingRequests

Returns public waiting requests for synchronous runtime callers.

**Example**

```ts
const requests = publicWaitingRequests(interrupts);
```

**Signature**

```ts
declare const publicWaitingRequests: (
  interrupts: readonly GraphWaitingInterrupt[],
) => readonly AgentWaitingRequest[];
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L103)

### publicWaitingRequestsEffect

Removes internal identifiers while retaining public waiting request order.

**Example**

```ts
const requests = Effect.runSync(publicWaitingRequestsEffect(interrupts));
```

**Signature**

```ts
declare const publicWaitingRequestsEffect: (
  interrupts: ReadonlyArray<GraphWaitingInterrupt>,
) => Effect.Effect<Array<{ response: JsonValue; value?: {} | null; node: string }>, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.ts#L83)

## `graph-interruption.types.ts`

Converts native graph interrupt observations into RELKIT continuation data while preserving the interrupt identifiers needed for resume. This companion preserves the native input and output types without starting runtime work.

### GraphWaitingInterrupt (interface)

Pending graph interruption and its public response schema.
The optional ID is internal and omitted from published waiting requests.

**Example**

```ts
const interrupt: GraphWaitingInterrupt = { node: "review", response: true };
```

**Signature**

```ts
export interface GraphWaitingInterrupt {
  readonly id?: string;
  readonly node: string;
  readonly value?: unknown;
  readonly response: JsonValue;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-interruption.types.ts#L12)

## `graph-node-schema-validation.ts`

Validates native node input, output and optional resume schemas in authoring order before handler or identity construction; schema failures retain their existing graph-node boundary.

### validateGraphNodeSchemasEffect

Validates each authored schema without invoking the user's node handler.

**Signature**

```ts
declare const validateGraphNodeSchemasEffect: (
  options: Pick<GraphNodeAny, "input" | "output" | "resume">,
) => Effect.Effect<void, GraphNodeValidationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-schema-validation.ts#L12)

## `graph-node-symbol.ts`

Private brand identifying a validated RELKIT graph node.

### RELKIT_GRAPH_NODE

Private brand identifying a validated RELKIT graph node.

**Signature**

```ts
declare const RELKIT_GRAPH_NODE: unique symbol;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-symbol.ts#L2)

## `graph-node-validation-error.ts`

Defines authoring failures for native graph nodes and retains the invalid field for focused descriptor diagnostics.

### GraphNodeValidationFailure (class)

Tagged graph node validation failure.

**Signature**

```ts
declare class GraphNodeValidationFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-error.ts#L6)

### graphNodeValidationFailure

Preserves a graph node validation error for Effect callers.

**Example**

```ts
graphNodeValidationFailure(new TypeError("invalid"));
```

**Signature**

```ts
declare const graphNodeValidationFailure: (cause: unknown) => GraphNodeValidationFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-error.ts#L16)

## `graph-node-validation-value.ts`

Checks graph node authoring values and callable shapes before construction, keeping runtime callbacks untouched after validation.

### commandUpdate

Converts a native command update for existing synchronous callers.

**Throws**

TypeError for malformed entry lists.

**Example**

```ts
commandUpdate([["count", 1]]);
```

**Signature**

```ts
declare const commandUpdate: (value: unknown) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-value.ts#L75)

### commandUpdateEffect

Converts a native command update entry list into an object.

**Example**

```ts
Effect.runSync(commandUpdateEffect([["count", 1]]));
```

**Signature**

```ts
declare const commandUpdateEffect: (
  value: unknown,
) => Effect.Effect<unknown, GraphNodeValidationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-value.ts#L63)

### validateDestinations

Checks native command destinations for existing synchronous callers.

**Throws**

TypeError for invalid or undeclared destinations.

**Example**

```ts
validateDestinations(["next"], "next");
```

**Signature**

```ts
declare const validateDestinations: (ends: readonly string[], value: unknown) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-value.ts#L31)

### validateDestinationsEffect

Checks that native command destinations were declared by the node.

**Example**

```ts
Effect.runSync(validateDestinationsEffect(["next"], "next"));
```

**Signature**

```ts
declare const validateDestinationsEffect: (
  ends: ReadonlyArray<string>,
  value: unknown,
) => Effect.Effect<void, GraphNodeValidationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-value.ts#L15)

### validatedUpdate

Validates a node output for existing Promise callers.

**Throws**

The original schema or record error.

**Example**

```ts
await validatedUpdate(schema, output);
```

**Signature**

```ts
declare const validatedUpdate: <Schema extends StandardSchemaV1>(
  schema: Schema,
  value: unknown,
) => Promise<Extract<InferOutput<Schema>, Record<string, unknown>>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-value.ts#L121)

### validatedUpdateEffect

Validates a graph node output as a record.

**Example**

```ts
await Effect.runPromise(validatedUpdateEffect(schema, output));
```

**Signature**

```ts
declare const validatedUpdateEffect: <Schema extends StandardSchemaV1>(
  schema: Schema,
  value: unknown,
) => Effect.Effect<
  Extract<InferOutput<Schema>, Record<string, unknown>>,
  GraphNodeValidationFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-value.ts#L101)

### validatedValue

Validates a node value for existing Promise callers.

**Throws**

The original schema validation error.

**Example**

```ts
await validatedValue(schema, input, "input");
```

**Signature**

```ts
declare const validatedValue: <Schema extends StandardSchemaV1>(
  schema: Schema,
  value: unknown,
  phase: "input" | "output",
) => Promise<InferOutput<Schema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-value.ts#L165)

### validatedValueEffect

Validates a graph node input or output through its Standard Schema.

**Example**

```ts
await Effect.runPromise(validatedValueEffect(schema, input, "input"));
```

**Signature**

```ts
declare const validatedValueEffect: <Schema extends StandardSchemaV1>(
  schema: Schema,
  value: unknown,
  phase: "input" | "output",
) => Effect.Effect<InferOutput<Schema>, GraphNodeValidationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation-value.ts#L139)

## `graph-node-validation.ts`

Validates native graph node contracts and execution configuration before the node descriptor is published to graph assembly.

### assertGraphNodeDestinations

Checks destinations for existing synchronous graph callers.

**Throws**

The original unknown destination error.

**Example**

```ts
assertGraphNodeDestinations(node, ids);
```

**Signature**

```ts
declare const assertGraphNodeDestinations: (
  node: Pick<GraphNodeAny, "id" | "ends">,
  registeredNodeIds: ReadonlySet<string> | readonly string[],
) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation.ts#L52)

### assertGraphNodeDestinationsEffect

Checks that every declared node destination exists in the graph.

**Example**

```ts
Effect.runSync(assertGraphNodeDestinationsEffect(node, ids));
```

**Signature**

```ts
declare const assertGraphNodeDestinationsEffect: (
  node: Pick<GraphNodeAny, "id" | "ends">,
  registeredNodeIds: ReadonlyArray<string> | ReadonlySet<string>,
) => Effect.Effect<void, GraphNodeValidationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation.ts#L23)

### copyGraphNodeEnds

Copies destinations for existing synchronous graph callers.

**Throws**

The original invalid or duplicate destination error.

**Example**

```ts
const ends = copyGraphNodeEnds([END]);
```

**Signature**

```ts
declare const copyGraphNodeEnds: (value: readonly string[] | undefined) => readonly string[];
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation.ts#L93)

### copyGraphNodeEndsEffect

Validates and freezes a node's static destination list.

**Example**

```ts
Effect.runSync(copyGraphNodeEndsEffect([END]));
```

**Signature**

```ts
declare const copyGraphNodeEndsEffect: (
  value: ReadonlyArray<string> | undefined,
) => Effect.Effect<ReadonlyArray<string>, GraphNodeValidationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation.ts#L68)

### validateGraphNodeResult

Validates a node result for existing Promise graph callers.

**Throws**

The original schema, update, or destination error.

**Example**

```ts
await validateGraphNodeResult(schema, [], value);
```

**Signature**

```ts
declare const validateGraphNodeResult: <
  OutputSchema extends StandardSchemaV1,
  Ends extends readonly string[],
>(
  output: OutputSchema,
  ends: Ends,
  result: unknown,
) => Promise<GraphNodeResult<OutputSchema, Ends>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation.ts#L135)

### validateGraphNodeResultEffect

Validates a node result and any native command update.

**Example**

```ts
Effect.runPromise(validateGraphNodeResultEffect(schema, [], value));
```

**Signature**

```ts
declare const validateGraphNodeResultEffect: <
  OutputSchema extends StandardSchemaV1,
  Ends extends readonly string[],
>(
  output: OutputSchema,
  ends: Ends,
  result: unknown,
) => Effect.Effect<GraphNodeResult<OutputSchema, Ends>, GraphNodeValidationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation.ts#L108)

### validatedGraphNodeInput

Validates graph node input for existing Promise graph callers.

**Throws**

The original schema validation error.

**Example**

```ts
await validatedGraphNodeInput(schema, value);
```

**Signature**

```ts
declare const validatedGraphNodeInput: <Schema extends StandardSchemaV1>(
  schema: Schema,
  value: unknown,
) => Promise<InferOutput<Schema>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation.ts#L165)

### validatedGraphNodeInputEffect

Validates graph node input against its standard schema.

**Example**

```ts
Effect.runPromise(validatedGraphNodeInputEffect(schema, value));
```

**Signature**

```ts
declare const validatedGraphNodeInputEffect: <Schema extends StandardSchemaV1>(
  schema: Schema,
  value: unknown,
) => Effect.Effect<InferOutput<Schema>, GraphNodeValidationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-node-validation.ts#L152)

## `graph-persistence-release.ts`

Releases native graph persistence resources through their supported close protocol after graph work has settled.

### releaseAgentPersistence

Releases persistence resources for existing Promise callers.

**Throws**

The first release error in descriptor order.

**Example**

```ts
await releaseAgentPersistence([agent]);
```

**Signature**

```ts
declare const releaseAgentPersistence: (descriptors: readonly unknown[]) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence-release.ts#L45)

### releaseAgentPersistenceEffect

Releases declared persistence resources with bounded concurrency.

**Example**

```ts
Effect.runPromise(releaseAgentPersistenceEffect([agent]));
```

**Signature**

```ts
declare const releaseAgentPersistenceEffect: (
  descriptors: ReadonlyArray<unknown>,
) => Effect.Effect<undefined, AgentPersistenceFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence-release.ts#L15)

## `graph-persistence.ts`

Acquires native graph checkpointer and store configuration for invocation and supplies the release action to the owning graph scope.

### AgentPersistenceDeclaration

**Signature**

```ts
declare const AgentPersistenceDeclaration: AgentPersistenceDeclaration;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.ts#L17)

### ResolvedGraphPersistence

**Signature**

```ts
declare const ResolvedGraphPersistence: ResolvedGraphPersistence;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.ts#L18)

### releaseAgentPersistence

**Signature**

```ts
declare const releaseAgentPersistence: (descriptors: readonly unknown[]) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.ts#L21)

### releaseAgentPersistenceEffect

**Signature**

```ts
declare const releaseAgentPersistenceEffect: (
  descriptors: ReadonlyArray<unknown>,
) => Effect.Effect<undefined, AgentPersistenceFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.ts#L22)

### resolveAgentPersistence

Resolves agent persistence for existing Promise callers.

**Throws**

The original factory or protocol error.

**Example**

```ts
await resolveAgentPersistence(agent, {});
```

**Signature**

```ts
declare const resolveAgentPersistence: (
  descriptor: AgentPersistenceDeclaration,
  env: Readonly<Record<string, unknown>>,
  signal?: AbortSignal,
) => Promise<ResolvedGraphPersistence>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.ts#L89)

### resolveAgentPersistenceEffect

Resolves an agent's declared persistence handles.

**Example**

```ts
Effect.runPromise(resolveAgentPersistenceEffect(agent, {}));
```

**Signature**

```ts
declare const resolveAgentPersistenceEffect: (
  descriptor: AgentPersistenceDeclaration,
  env: Readonly<Record<string, unknown>>,
) => Effect.Effect<ResolvedGraphPersistence, AgentPersistenceFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.ts#L73)

### resolveGraphPersistence

Resolves graph persistence for existing Promise callers.

**Throws**

The original factory or protocol error.

**Example**

```ts
await resolveGraphPersistence(graph, {});
```

**Signature**

```ts
declare const resolveGraphPersistence: (
  descriptor: GraphDescriptor,
  env: Readonly<Record<string, unknown>>,
  signal?: AbortSignal,
) => Promise<ResolvedGraphPersistence>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.ts#L53)

### resolveGraphPersistenceEffect

Resolves a graph's declared persistence handles.

**Example**

```ts
Effect.runPromise(resolveGraphPersistenceEffect(graph, {}));
```

**Signature**

```ts
declare const resolveGraphPersistenceEffect: (
  descriptor: GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  env: Readonly<Record<string, unknown>>,
) => Effect.Effect<ResolvedGraphPersistence, AgentPersistenceFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.ts#L34)

## `graph-persistence.types.ts`

Acquires native graph checkpointer and store configuration for invocation and supplies the release action to the owning graph scope. This companion preserves the native input and output types without starting runtime work.

### AgentPersistenceDeclaration (interface)

Optional checkpointer and store declarations on an agent.

**Signature**

```ts
export interface AgentPersistenceDeclaration {
  readonly checkpointer?: unknown;
  readonly store?: unknown;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.types.ts#L13)

### AnyPersistenceResource (type alias)

A persistence descriptor being resolved for one invocation.

**Signature**

```ts
type AnyPersistenceResource = PersistenceResource<"checkpointer" | "memory", unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.types.ts#L19)

### ResolutionState (interface)

Pending and committed resolution state for one shared resource.

**Signature**

```ts
export interface ResolutionState {
  pending: number;
  committed: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.types.ts#L22)

### ResolvedGraphPersistence (interface)

Resolved handles passed to a compiled graph.

**Signature**

```ts
export interface ResolvedGraphPersistence {
  readonly checkpointer?: BaseCheckpointSaver;
  readonly store?: BaseStore;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-persistence.types.ts#L7)

## `graph-runtime-error.ts`

Translates native graph execution failures into the RELKIT graph error boundary while preserving their original causes.

### GraphInvocationFailure (class)

Tagged graph invocation failure with the original runtime cause.

**Signature**

```ts
declare class GraphInvocationFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-error.ts#L6)

### graphInvocationFailure

Preserves a graph invocation failure for Effect callers.

**Example**

```ts
graphInvocationFailure(new Error("graph failed"));
```

**Signature**

```ts
declare const graphInvocationFailure: (cause: unknown) => GraphInvocationFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-error.ts#L16)

## `graph-runtime-execution.ts`

Runs a compiled graph within the invocation context, coordinating input, continuation and persistence before projecting final output.

### runCompiledGraph

Runs a compiled graph for existing Promise callers.

**Throws**

The original graph, persistence, output, or cancellation error.

**Example**

```ts
await runCompiledGraph(options, input, signal, id, trace, 1024);
```

**Signature**

```ts
declare const runCompiledGraph: (
  options: GraphRuntimeOptions,
  input: unknown,
  signal: AbortSignal,
  invocationId: string,
  traceId: string,
  maxOutputBytes: number,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-execution.ts#L88)

### runCompiledGraphEffect

Runs one compiled graph with persistence and a linked invocation scope.

**Example**

```ts
await Effect.runPromise(runCompiledGraphEffect(options, input, signal, id, trace, 1024));
```

**Signature**

```ts
declare const runCompiledGraphEffect: (
  options: GraphRuntimeOptions,
  input: unknown,
  signal: AbortSignal,
  invocationId: string,
  traceId: string,
  maxOutputBytes: number,
) => Effect.Effect<JsonValue, GraphInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-execution.ts#L26)

## `graph-runtime-identity.ts`

Derives graph invocation, thread and checkpoint identity used consistently by native execution and persisted continuation lookup.

### GraphInvocationIdentity (class)

Substitutable random source for graph invocation IDs.

**Example**

```ts
Effect.provide(invokeGraphEffect(options), GraphInvocationIdentityLive);
```

**Signature**

```ts
declare class GraphInvocationIdentity
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-identity.ts#L9)

### GraphInvocationIdentityLive

Live graph invocation identity source.

**Example**

```ts
Effect.runPromise(Effect.provide(invokeGraphEffect(options), GraphInvocationIdentityLive));
```

**Signature**

```ts
declare const GraphInvocationIdentityLive: Layer.Layer<GraphInvocationIdentity, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-identity.ts#L17)

## `graph-runtime-identity.types.ts`

Random identity source used by graph invocation Effects.

### GraphInvocationIdentityService (interface)

Random identity source used by graph invocation Effects.

**Signature**

```ts
export interface GraphInvocationIdentityService {
  readonly randomUUID: () => string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-identity.types.ts#L2)

## `graph-runtime-stream-state.ts`

Collects graph state, waiting requests and validated output from an already
acquired native stream. Its caller retains stream abort/finalization ownership.

### collectCompiledGraphStateEffect

Collects the original native events before settling public graph state.

**Signature**

```ts
declare const collectCompiledGraphStateEffect: (
  context: CompiledGraphStreamContext,
) => Effect.Effect<JsonValue, GraphInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-stream-state.ts#L25)

## `graph-runtime-stream.ts`

Consumes native graph streams and publishes RELKIT execution events, finalizing the native iterator before settling the invocation.

### streamCompiledGraphEffect

Streams one compiled graph and validates its final public output.

**Example**

```ts
await Effect.runPromise(streamCompiledGraphEffect(options, graph, config, input, signal, 1024));
```

**Signature**

```ts
declare const streamCompiledGraphEffect: (
  options: GraphRuntimeOptions,
  graph: any,
  config: GraphConfig,
  input: unknown,
  signal: AbortSignal,
  maxOutputBytes: number,
) => Effect.Effect<JsonValue, GraphInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-stream.ts#L33)

## `graph-runtime-stream.types.ts`

Acquired native stream and public sinks retained by one graph invocation.

### CompiledGraphStreamContext (interface)

**Signature**

```ts
export interface CompiledGraphStreamContext {
  readonly options: GraphRuntimeOptions;
  readonly graph: ReturnType<typeof compileGraph>;
  readonly config: GraphConfig;
  readonly signal: AbortSignal;
  readonly maxOutputBytes: number;
  readonly run: Awaited<ReturnType<ReturnType<typeof compileGraph>["streamEvents"]>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime-stream.types.ts#L5)

## `graph-runtime.ts`

Composes graph compilation, scoped persistence and execution into the native invocation entrypoint, retaining stream and continuation behavior.

### GraphInvocationFailure

**Signature**

```ts
declare const GraphInvocationFailure: typeof GraphInvocationFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime.ts#L17)

### GraphInvocationIdentity

**Signature**

```ts
declare const GraphInvocationIdentity: typeof GraphInvocationIdentity;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime.ts#L18)

### GraphInvocationIdentityLive

**Signature**

```ts
declare const GraphInvocationIdentityLive: Layer<GraphInvocationIdentity, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime.ts#L18)

### GraphRuntimeOptions

**Signature**

```ts
declare const GraphRuntimeOptions: GraphRuntimeOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime.ts#L16)

### invokeGraph

Invokes a graph for existing Promise runtime callers.

**Throws**

The original graph, provider, validation, or cancellation error.

**Example**

```ts
await invokeGraph(options);
```

**Signature**

```ts
declare const invokeGraph: (options: GraphRuntimeOptions) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime.ts#L84)

### invokeGraphEffect

Invokes a graph with scoped signal cleanup and linked Effect cancellation.

**Example**

```ts
Effect.runPromise(Effect.provide(invokeGraphEffect(options), GraphInvocationIdentityLive));
```

**Signature**

```ts
declare const invokeGraphEffect: (
  options: GraphRuntimeOptions,
) => Effect.Effect<unknown, GraphInvocationFailure, GraphInvocationIdentity>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime.ts#L25)

## `graph-runtime.types.ts`

Composes graph compilation, scoped persistence and execution into the native invocation entrypoint, retaining stream and continuation behavior. This companion preserves the native input and output types without starting runtime work.

### GraphRuntimeOptions (type alias)

Runtime options for invoking a compiled graph descriptor.

**Signature**

```ts
type GraphRuntimeOptions = AgentRuntimeOptions &
  AgentInvocationOptions & { readonly agent: GraphDescriptor };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-runtime.types.ts#L7)

## `graph-state-schema.ts`

Adapts authored state schemas to the native graph state contract and preserves the reducers and validated channel shapes required by compilation.

### GraphStateSelectionError (class)

Expected graph state projection failure in the Effect error channel.

**Signature**

```ts
declare class GraphStateSelectionError
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-state-schema.ts#L13)

### selectGraphState

Projects graph state for existing synchronous graph definition callers.

**Throws**

AgentRuntimeError when the selection or one of its fields is unavailable.

**Example**

```ts
const projected = selectGraphState(state, z.object({ answer: z.string() }));
```

**Signature**

```ts
declare const selectGraphState: (
  state: AnyStateSchema,
  selection: StandardSchemaV1,
) => AnyStateSchema;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-state-schema.ts#L71)

### selectGraphStateEffect

Projects a graph state to the fields declared by a client selection schema.

**Throws**

A defect if LangGraph rejects an otherwise valid StateSchema construction.

**Example**

```ts
const projected = Effect.runSync(selectGraphStateEffect(state, z.object({ answer: z.string() })));
```

**Signature**

```ts
declare const selectGraphStateEffect: (
  state: AnyStateSchema,
  selection: StandardSchemaV1<unknown, unknown>,
) => Effect.Effect<StateSchema<Record<string, any>>, GraphStateSelectionError, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-state-schema.ts#L28)

## `graph-subgraph-symbol.ts`

Marker for a graph embedded as a native node.

### RELKIT_SUBGRAPH

Hidden reference to the embedded graph descriptor.

**Signature**

```ts
declare const RELKIT_SUBGRAPH: unique symbol;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph-symbol.ts#L5)

### RELKIT_SUBGRAPH_NODE

Marker for a graph embedded as a native node.

**Signature**

```ts
declare const RELKIT_SUBGRAPH_NODE: unique symbol;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph-symbol.ts#L2)

## `graph-subgraph.ts`

Creates nested graph descriptors with their native execution metadata so parent compilation can retain subgraph state and interruption semantics.

### "./graph-subgraph.types.js" (namespace export)

Re-exports all named exports from the "./graph-subgraph.types.js" module.

**Signature**

```ts
export * from "./graph-subgraph.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph.ts#L14)

### createSubgraphNode

Creates an embedded graph node for existing synchronous callers.

**Throws**

The original invalid options or destination error.

**Example**

```ts
const node = createSubgraphNode(graph, { id: "nested" });
```

**Signature**

```ts
declare const createSubgraphNode: <
  const Id extends string,
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
>(
  graph: GraphDescriptor<string, InputSchema, OutputSchema>,
  options?: GraphAsNodeOptions<Id>,
) => SubgraphNodeDescriptor<Id, InputSchema, OutputSchema>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph.ts#L62)

### createSubgraphNodeEffect

Creates a native node backed by another graph.

**Example**

```ts
Effect.runSync(createSubgraphNodeEffect(graph, { id: "nested" }));
```

**Signature**

```ts
declare const createSubgraphNodeEffect: <
  const Id extends string,
  InputSchema extends StandardSchemaV1,
  OutputSchema extends StandardSchemaV1,
>(
  graph: GraphDescriptor<
    string,
    InputSchema,
    OutputSchema,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  options?: GraphAsNodeOptions<Id> | undefined,
) => Effect.Effect<
  SubgraphNodeDescriptor<Id, InputSchema, OutputSchema>,
  GraphNodeValidationFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph.ts#L22)

### isSubgraphNode

Checks embedded graph nodes for existing synchronous callers.

**Example**

```ts
if (isSubgraphNode(value)) subgraphForNode(value);
```

**Signature**

```ts
declare const isSubgraphNode: (value: unknown) => value is SubgraphNodeDescriptor;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph.ts#L102)

### isSubgraphNodeEffect

Checks whether a value is an embedded graph node.

**Example**

```ts
Effect.runSync(isSubgraphNodeEffect(value));
```

**Signature**

```ts
declare const isSubgraphNodeEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph.ts#L82)

### subgraphForNode

Reads the source graph for existing synchronous callers.

**Example**

```ts
const nested = subgraphForNode(node);
```

**Signature**

```ts
declare const subgraphForNode: (value: SubgraphNodeDescriptor) => GraphDescriptor;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph.ts#L121)

### subgraphForNodeEffect

Reads the source graph from a subgraph node.

**Example**

```ts
Effect.runSync(subgraphForNodeEffect(node));
```

**Signature**

```ts
declare const subgraphForNodeEffect: (
  value: SubgraphNodeDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>
  >,
) => Effect.Effect<
  GraphDescriptor<
    string,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    AnyStateSchema,
    ReadonlyArray<GraphNodeLike>
  >,
  never,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph.ts#L111)

## `graph-subgraph.types.ts`

Creates nested graph descriptors with their native execution metadata so parent compilation can retain subgraph state and interruption semantics. This companion preserves the native input and output types without starting runtime work.

### GraphAsNodeOptions (interface)

Authoring options for a graph embedded as a node.

**Signature**

```ts
export interface GraphAsNodeOptions<Id extends string = string> {
  readonly id?: Id;
  readonly ends?: readonly string[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph.types.ts#L8)

### SubgraphNodeDescriptor (interface)

Native graph node whose action is another graph.

**Signature**

```ts
export interface SubgraphNodeDescriptor<
  Id extends string = string,
  InputSchema extends StandardSchemaV1 = StandardSchemaV1,
  OutputSchema extends StandardSchemaV1 = StandardSchemaV1,
> {
  readonly [RELKIT_SUBGRAPH_NODE]: true;
  readonly kind: "subgraph-node";
  readonly id: Id;
  readonly input: InputSchema;
  readonly output: OutputSchema;
  readonly ends: readonly string[];
  readonly [RELKIT_SUBGRAPH]: GraphDescriptor;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-subgraph.types.ts#L14)

## `graph-workflow-error.ts`

Defines graph workflow failures at the RELKIT execution boundary, preserving graph identity and the native failure cause.

### GraphWorkflowFailure (class)

Tagged graph workflow projection failure.

**Signature**

```ts
declare class GraphWorkflowFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow-error.ts#L6)

### graphWorkflowFailure

Preserves a graph workflow projection error.

**Example**

```ts
graphWorkflowFailure(new TypeError("invalid node"));
```

**Signature**

```ts
declare const graphWorkflowFailure: (cause: unknown) => GraphWorkflowFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow-error.ts#L16)

## `graph-workflow.ts`

Adapts native graph execution to the RELKIT workflow contract, carrying invocation context and scoped persistence through completion.

### "./graph-workflow.types.js" (namespace export)

Re-exports all named exports from the "./graph-workflow.types.js" module.

**Signature**

```ts
export * from "./graph-workflow.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow.ts#L19)

### graphWorkflow

Projects a workflow for existing synchronous graph callers.

**Throws**

The original node or schema projection error.

**Example**

```ts
graphWorkflow(nodes, edges);
```

**Signature**

```ts
declare const graphWorkflow: <Id extends string, State>(
  nodes: readonly (GraphNodeAny | FunctionGraphNodeDescriptor | SubgraphNodeDescriptor)[],
  edges: readonly GraphEdgeOperation<Id, State>[],
) => GraphWorkflow;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow.ts#L53)

### graphWorkflowEffect

Projects a frozen serializable graph workflow from authoring nodes and edges.

**Example**

```ts
Effect.runSync(graphWorkflowEffect(nodes, edges));
```

**Signature**

```ts
declare const graphWorkflowEffect: <Id extends string, State>(
  nodes: ReadonlyArray<
    | GraphNodeAny
    | SubgraphNodeDescriptor<
        string,
        StandardSchemaV1<unknown, unknown>,
        StandardSchemaV1<unknown, unknown>
      >
    | FunctionGraphNodeDescriptor<
        string,
        string,
        unknown,
        unknown,
        ReadonlyArray<ErrorDescriptorAny>,
        StandardSchemaV1<unknown, unknown>,
        StandardSchemaV1<unknown, unknown>,
        FunctionDependencies
      >
  >,
  edges: ReadonlyArray<GraphEdgeOperation<Id, State>>,
) => Effect.Effect<GraphWorkflow, GraphWorkflowFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow.ts#L27)

### graphWorkflowRequiresPersistence

Checks persistence needs for existing synchronous graph callers.

**Example**

```ts
graphWorkflowRequiresPersistence(workflow);
```

**Signature**

```ts
declare const graphWorkflowRequiresPersistence: (workflow: GraphWorkflow) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow.ts#L79)

### graphWorkflowRequiresPersistenceEffect

Checks whether any graph node has a resumable continuation.

**Example**

```ts
Effect.runSync(graphWorkflowRequiresPersistenceEffect(workflow));
```

**Signature**

```ts
declare const graphWorkflowRequiresPersistenceEffect: (
  workflow: GraphWorkflow,
) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow.ts#L69)

## `graph-workflow.types.ts`

Adapts native graph execution to the RELKIT workflow contract, carrying invocation context and scoped persistence through completion. This companion preserves the native input and output types without starting runtime work.

### GraphWorkflow (interface)

Immutable serializable graph topology for runtime and clients.

**Signature**

```ts
export interface GraphWorkflow {
  readonly version: 1;
  readonly start: typeof START;
  readonly end: typeof END;
  readonly nodes: readonly GraphWorkflowNode[];
  readonly edges: readonly GraphWorkflowEdge[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow.types.ts#L30)

### GraphWorkflowEdge (type alias)

Serializable static, join, or conditional graph edge.

**Signature**

```ts
type GraphWorkflowEdge =
  | { readonly kind: "edge"; readonly from: string; readonly to: string }
  | { readonly kind: "join"; readonly from: readonly string[]; readonly to: string }
  | {
      readonly kind: "conditional";
      readonly from: string;
      readonly routes: readonly { readonly label: string; readonly to: string }[];
      readonly dynamic: boolean;
    };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow.types.ts#L19)

### GraphWorkflowNode (interface)

Serializable node entry in an agent graph workflow.

**Signature**

```ts
export interface GraphWorkflowNode {
  readonly id: string;
  readonly kind: "node" | "function" | "subgraph";
  readonly input: JsonValue;
  readonly output: JsonValue;
  readonly resume?: JsonValue;
  readonly ends: readonly string[];
  readonly targetFunctionId?: string;
  readonly workflow?: GraphWorkflow;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/graph-workflow.types.ts#L7)

## `index.ts`

Publishes the explicit LangChain integration authoring and execution surface; generic application imports remain owned by the SDK-free agents package.

### "./define-agent.js" (namespace export)

Re-exports all named exports from the "./define-agent.js" module.

**Signature**

```ts
export * from "./define-agent.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L3)

### "./define-graph-node.js" (namespace export)

Re-exports all named exports from the "./define-graph-node.js" module.

**Signature**

```ts
export * from "./define-graph-node.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L4)

### "./define-graph.js" (namespace export)

Re-exports all named exports from the "./define-graph.js" module.

**Signature**

```ts
export * from "./define-graph.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L5)

### "./define-persistence.js" (namespace export)

Re-exports all named exports from the "./define-persistence.js" module.

**Signature**

```ts
export * from "./define-persistence.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L6)

### "./graph-edges.js" (namespace export)

Re-exports all named exports from the "./graph-edges.js" module.

**Signature**

```ts
export * from "./graph-edges.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L7)

### "./graph-interruption.js" (namespace export)

Re-exports all named exports from the "./graph-interruption.js" module.

**Signature**

```ts
export * from "./graph-interruption.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L14)

### "./graph-persistence.js" (namespace export)

Re-exports all named exports from the "./graph-persistence.js" module.

**Signature**

```ts
export * from "./graph-persistence.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L12)

### "./graph-runtime.js" (namespace export)

Re-exports all named exports from the "./graph-runtime.js" module.

**Signature**

```ts
export * from "./graph-runtime.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L9)

### "./graph-subgraph.js" (namespace export)

Re-exports all named exports from the "./graph-subgraph.js" module.

**Signature**

```ts
export * from "./graph-subgraph.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L13)

### "./graph-workflow.js" (namespace export)

Re-exports all named exports from the "./graph-workflow.js" module.

**Signature**

```ts
export * from "./graph-workflow.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L8)

### "./runtime-service.js" (namespace export)

Re-exports all named exports from the "./runtime-service.js" module.

**Signature**

```ts
export * from "./runtime-service.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L21)

### "./runtime.js" (namespace export)

Re-exports all named exports from the "./runtime.js" module.

**Signature**

```ts
export * from "./runtime.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L20)

### "@relkit/agents/internal/agent-client" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/agent-client" module.

**Signature**

```ts
export * from "@relkit/agents/internal/agent-client";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L15)

### "@relkit/agents/internal/agent-telemetry" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/agent-telemetry" module.

**Signature**

```ts
export * from "@relkit/agents/internal/agent-telemetry";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L25)

### "@relkit/agents/internal/approval" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/approval" module.

**Signature**

```ts
export * from "@relkit/agents/internal/approval";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L17)

### "@relkit/agents/internal/client-events" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/client-events" module.

**Signature**

```ts
export * from "@relkit/agents/internal/client-events";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L16)

### "@relkit/agents/internal/generated-function" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/generated-function" module.

**Signature**

```ts
export * from "@relkit/agents/internal/generated-function";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L18)

### "@relkit/agents/internal/model-selection" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/model-selection" module.

**Signature**

```ts
export * from "@relkit/agents/internal/model-selection";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L26)

### "@relkit/agents/internal/observability" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/observability" module.

**Signature**

```ts
export * from "@relkit/agents/internal/observability";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L24)

### "@relkit/agents/internal/runtime-events" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/runtime-events" module.

**Signature**

```ts
export * from "@relkit/agents/internal/runtime-events";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L23)

### "@relkit/agents/internal/state-control-requests.types" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/state-control-requests.types" module.

**Signature**

```ts
export * from "@relkit/agents/internal/state-control-requests.types";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L27)

### "@relkit/agents/internal/state-provider.types" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/state-provider.types" module.

**Signature**

```ts
export * from "@relkit/agents/internal/state-provider.types";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L28)

### "@relkit/agents/internal/state-receipts.types" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/state-receipts.types" module.

**Signature**

```ts
export * from "@relkit/agents/internal/state-receipts.types";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L29)

### "@relkit/agents/internal/state-thread-requests.types" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/state-thread-requests.types" module.

**Signature**

```ts
export * from "@relkit/agents/internal/state-thread-requests.types";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L30)

### "@relkit/agents/internal/state.types" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/state.types" module.

**Signature**

```ts
export * from "@relkit/agents/internal/state.types";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L31)

### "@relkit/agents/internal/thread-transition" (namespace export)

Re-exports all named exports from the "@relkit/agents/internal/thread-transition" module.

**Signature**

```ts
export * from "@relkit/agents/internal/thread-transition";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L32)

### assertAgentRuntimeDependencies

**Signature**

```ts
declare const assertAgentRuntimeDependencies: (
  agents: readonly AgentDescriptor<string, unknown, unknown>[],
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L22)

### createGeneratedAgentFunction

**Signature**

```ts
declare const createGeneratedAgentFunction: (
  agentId: unknown,
  executor?: GeneratedAgentExecutor,
) => GeneratedAgentFunction;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L19)

### validateGraphResumeInput

**Signature**

```ts
declare const validateGraphResumeInput: (
  descriptor: GraphDescriptor,
  requests: readonly AgentWaitingRequest[],
  value: unknown,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L10)

### validateNativeAgentResumeInput

**Signature**

```ts
declare const validateNativeAgentResumeInput: (
  requests: readonly AgentWaitingRequest[],
  value: unknown,
) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/index.ts#L11)

## `native-agent-interruption-error.ts`

Defines failures for native agent interrupt handling so malformed interruption data stays distinct from normal approval suspension.

### NativeAgentInterruptionFailure (class)

Tagged native agent continuation or state failure.

**Signature**

```ts
declare class NativeAgentInterruptionFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-error.ts#L6)

### nativeAgentInterruptionFailure

Wraps a native continuation failure for Effect callers.

**Example**

```ts
nativeAgentInterruptionFailure(new TypeError("invalid reply"));
```

**Signature**

```ts
declare const nativeAgentInterruptionFailure: (cause: unknown) => NativeAgentInterruptionFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-error.ts#L16)

## `native-agent-interruption-schema.ts`

Declares executable schemas for native interruption payloads before they cross the durable RELKIT continuation boundary.

### "./native-agent-interruption-schema.types.js" (namespace export)

Re-exports all named exports from the "./native-agent-interruption-schema.types.js" module.

**Signature**

```ts
export * from "./native-agent-interruption-schema.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L12)

### hitlResponseSchema

Constructs the response schema for existing synchronous callers.

**Example**

```ts
const schema = hitlResponseSchema(configs);
```

**Signature**

```ts
declare const hitlResponseSchema: (configs: readonly ReviewConfig[]) => JsonValue;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L47)

### hitlResponseSchemaEffect

Constructs the exact response schema for pending reviews.

**Example**

```ts
Effect.runSync(hitlResponseSchemaEffect(configs));
```

**Signature**

```ts
declare const hitlResponseSchemaEffect: (
  configs: ReadonlyArray<ReviewConfig>,
) => Effect.Effect<JsonValue, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L19)

### isDecision

Checks a decision label for existing synchronous callers.

**Example**

```ts
if (isDecision(value)) useDecision(value);
```

**Signature**

```ts
declare const isDecision: (value: unknown) => value is DecisionType;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L132)

### isDecisionEffect

Checks one native human decision label.

**Example**

```ts
Effect.runSync(isDecisionEffect("approve"));
```

**Signature**

```ts
declare const isDecisionEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L122)

### isHitlRequest

Checks a native human review request for existing synchronous callers.

**Example**

```ts
if (isHitlRequest(value)) handle(value);
```

**Signature**

```ts
declare const isHitlRequest: (value: unknown) => value is HitlRequest;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L82)

### isHitlRequestEffect

Validates the native human review request shape.

**Example**

```ts
Effect.runSync(isHitlRequestEffect(value));
```

**Signature**

```ts
declare const isHitlRequestEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L56)

### isRecord

Checks a record for existing synchronous callers.

**Example**

```ts
if (isRecord(value)) read(value.name);
```

**Signature**

```ts
declare const isRecord: (value: unknown) => value is Record<string, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L155)

### isRecordEffect

Checks a non-null, non-array record.

**Example**

```ts
Effect.runSync(isRecordEffect({ name: "tool" }));
```

**Signature**

```ts
declare const isRecordEffect: (value: unknown) => Effect.Effect<boolean, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L145)

### publicHitlRequest

Projects a review request for existing synchronous callers.

**Example**

```ts
const request = publicHitlRequest(nativeRequest);
```

**Signature**

```ts
declare const publicHitlRequest: (value: HitlRequest) => HitlRequest;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L113)

### publicHitlRequestEffect

Projects a review request to public action fields.

**Example**

```ts
Effect.runSync(publicHitlRequestEffect(request));
```

**Signature**

```ts
declare const publicHitlRequestEffect: (
  value: HitlRequest,
) => Effect.Effect<HitlRequest, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.ts#L91)

## `native-agent-interruption-schema.types.ts`

Declares executable schemas for native interruption payloads before they cross the durable RELKIT continuation boundary. This companion preserves the native input and output types without starting runtime work.

### DecisionType (type alias)

Human review decision accepted by a native agent.

**Signature**

```ts
type DecisionType = "approve" | "edit" | "reject";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.types.ts#L6)

### HitlRequest (interface)

Public set of actions awaiting human review.

**Signature**

```ts
export interface HitlRequest {
  readonly actionRequests: readonly Record<string, unknown>[];
  readonly reviewConfigs: readonly ReviewConfig[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.types.ts#L16)

### ReviewConfig (interface)

Review policy for one pending action.

**Signature**

```ts
export interface ReviewConfig {
  readonly actionName: string;
  readonly allowedDecisions: readonly DecisionType[];
  readonly argsSchema?: JsonValue;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-schema.types.ts#L9)

## `native-agent-interruption-validation.ts`

Decodes native agent interruption data and rejects invalid continuation payloads before approval or resume processing.

### snapshotInterrupts

Extracts public native interruptions from nested graph state.

**Example**

```ts
const requests = snapshotInterrupts(snapshot, []);
```

**Signature**

```ts
declare const snapshotInterrupts: (
  snapshot: unknown,
  path: readonly string[],
) => GraphWaitingInterrupt[];
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-validation.ts#L21)

### validateNativeAgentResumeInputCore

Validates one or more replies against pending native reviews.

**Throws**

TypeError for absent, mismatched, or invalid replies.

**Example**

```ts
const replies = validateNativeAgentResumeInputCore(requests, input);
```

**Signature**

```ts
declare const validateNativeAgentResumeInputCore: (
  requests: readonly AgentWaitingRequest[],
  value: unknown,
) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption-validation.ts#L55)

## `native-agent-interruption.ts`

Projects native agent interruption state into RELKIT approval and continuation records without losing native interrupt identity.

### nativeAgentResumeCommand

Builds a native resume command for existing Promise callers.

**Throws**

The original state or validation error.

**Example**

```ts
await nativeAgentResumeCommand(agent, config, reply);
```

**Signature**

```ts
declare const nativeAgentResumeCommand: (
  agent: NativeAgent,
  config: NativeAgentConfig,
  value: unknown,
) => Promise<Command>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption.ts#L51)

### nativeAgentResumeCommandEffect

Reads native pending requests and constructs a resume command.

**Example**

```ts
await Effect.runPromise(nativeAgentResumeCommandEffect(agent, config, reply));
```

**Signature**

```ts
declare const nativeAgentResumeCommandEffect: (
  agent: NativeAgent,
  config: RunnableConfig<Record<string, any>>,
  value: unknown,
) => Effect.Effect<
  Command<{ [k: string]: unknown }, Record<string, unknown>, string>,
  NativeAgentInterruptionFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption.ts#L21)

### nativeAgentWaitingInterrupts

Reads waiting native interruptions for existing Promise callers.

**Throws**

The original native state provider error.

**Example**

```ts
await nativeAgentWaitingInterrupts(agent, config);
```

**Signature**

```ts
declare const nativeAgentWaitingInterrupts: (
  agent: NativeAgent,
  config: NativeAgentConfig,
) => Promise<readonly import("./graph-interruption.js").GraphWaitingInterrupt[]>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption.ts#L98)

### nativeAgentWaitingInterruptsEffect

Reads and projects waiting native interruptions.

**Example**

```ts
await Effect.runPromise(nativeAgentWaitingInterruptsEffect(agent, config));
```

**Signature**

```ts
declare const nativeAgentWaitingInterruptsEffect: (
  agent: NativeAgent,
  config: RunnableConfig<Record<string, any>>,
) => Effect.Effect<Array<GraphWaitingInterrupt>, NativeAgentInterruptionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption.ts#L69)

### validateNativeAgentResumeInput

Validates native continuation replies for existing synchronous callers.

**Throws**

The original invalid continuation error.

**Example**

```ts
const reply = validateNativeAgentResumeInput(requests, value);
```

**Signature**

```ts
declare const validateNativeAgentResumeInput: (
  requests: readonly AgentWaitingRequest[],
  value: unknown,
) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption.ts#L131)

### validateNativeAgentResumeInputEffect

Validates native continuation replies against pending requests.

**Example**

```ts
Effect.runSync(validateNativeAgentResumeInputEffect(requests, reply));
```

**Signature**

```ts
declare const validateNativeAgentResumeInputEffect: (
  requests: ReadonlyArray<AgentWaitingRequest>,
  value: unknown,
) => Effect.Effect<unknown, NativeAgentInterruptionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption.ts#L115)

## `native-agent-interruption.types.ts`

Native LangGraph agent state access used by continuation operations.

### NativeAgent (type alias)

Native LangGraph agent state access used by continuation operations.

**Signature**

```ts
type NativeAgent = Pick<ReturnType<typeof import("langchain").createAgent>, "getState">;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption.types.ts#L2)

### NativeAgentConfig (type alias)

State lookup configuration accepted by a native agent.

**Signature**

```ts
type NativeAgentConfig = Parameters<NativeAgent["getState"]>[0];
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/native-agent-interruption.types.ts#L5)

## `persistence-error.ts`

Defines typed failures for native persistence acquisition and release, retaining the selected resource and underlying cause.

### AgentPersistenceFailure (class)

A typed persistence acquire, validation, or release failure.

**Signature**

```ts
declare class AgentPersistenceFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/persistence-error.ts#L6)

### agentPersistenceFailure

Retains the original failure for compatibility callers.

**Example**

```ts
agentPersistenceFailure(new Error("store unavailable"));
```

**Signature**

```ts
declare const agentPersistenceFailure: (cause: unknown) => AgentPersistenceFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/persistence-error.ts#L16)

## `persistence-symbol.ts`

Shared marker used to recognize RELKIT persistence descriptors.

### RELKIT_PERSISTENCE

Shared marker used to recognize RELKIT persistence descriptors.

**Signature**

```ts
declare const RELKIT_PERSISTENCE: unique symbol;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/persistence-symbol.ts#L2)

## `runtime-approval-decision.ts`

Converts supported approval reply forms to the canonical record while keeping
approval policy, tracing and tool lifecycle in their existing owners.

### resolveApprovalDecisionEffect

Normalizes the supported reply forms without changing approval semantics.

**Signature**

```ts
declare const resolveApprovalDecisionEffect: (
  approval: PendingApproval,
  response: ApprovalDecision,
) => Effect.Effect<ApprovalRecord, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-approval-decision.ts#L19)

## `runtime-dependencies.ts`

Exposes dependency preflight without making optional DeepAgents declarations part of ordinary native authoring.

### assertAgentRuntimeDependencies

Checks selected native capabilities and preserves the original loader failure and lifecycle.

**Signature**

```ts
declare const assertAgentRuntimeDependencies: (
  agents: readonly AgentDescriptor<string, unknown, unknown>[],
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-dependencies.ts#L9)

## `runtime-effect-error.ts`

Normalizes Effect failures from native invocation adapters while retaining the original failure cause at the public runtime boundary.

### AgentInvocationFailure (class)

A typed Effect failure that retains the public invocation error as its cause.

**Signature**

```ts
declare class AgentInvocationFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-effect-error.ts#L7)

### agentInvocationFailure

Captures an invocation failure without losing compatibility error details.

**Example**

```ts
agentInvocationFailure(new Error("model unavailable"));
```

**Signature**

```ts
declare const agentInvocationFailure: (cause: unknown) => AgentInvocationFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-effect-error.ts#L17)

## `runtime-errors.ts`

Constructs invocation failures with agent identity and native causes, including selected dependency failures and execution errors.

### AgentRuntimeError (class)

Safe public failure fields; a non-enumerable native cause is private diagnostic data.

**Signature**

```ts
declare class AgentRuntimeError { constructor(
    readonly code: string,
    message: string,
    readonly issues?: readonly StandardIssue[],
    options?: ErrorOptions,
  ) }
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-errors.ts#L6)

## `runtime-failure-diagnostics.ts`

Records bounded failure categories at the invocation boundary; native causes remain private and are never logged raw.

### logAgentFailure

Logs one safe diagnostic before public failure mapping, without retrying execution.

**Signature**

```ts
declare const logAgentFailure: (
  failure: AgentInvocationFailure,
  options: AgentRuntimeOptions & AgentInvocationOptions,
) => Effect.Effect<void, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-failure-diagnostics.ts#L45)

## `runtime-integration.ts`

Advertises native execution registrations to the existing verified integration
plan. Provider acquisition skips these execution-only capabilities.

### runtimeIntegration

**Signature**

```ts
declare const runtimeIntegration: Readonly<{
  kind: "runtime-integration";
  integrationId: "langchain";
  registrations: ReadonlyArray<{ capability: string; adapterId: string; protocolVersion: number }>;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-integration.ts#L7)

## `runtime-invoke.ts`

Resolves model and invocation identities before acquiring the scoped native
signal; stream work inherits the same tracing and cancellation context.

### invokeNativeWithContextEffect

Runs native work inside the original scoped signal and trace boundary.

**Signature**

```ts
declare const invokeNativeWithContextEffect: (
  options: NativeAgentRuntimeOptions,
  service: AgentExecutionService,
  invocation: {
    capture: AgentCapturePolicy;
    invocationId: StableId;
    traceId: StableId;
    runtimeModel: ResolvedRuntimeModel;
  },
) => Effect.Effect<unknown, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-invoke.ts#L58)

### resolveNativeInvocationEffect

Resolves validated invocation identity, capture policy and native model.

**Signature**

```ts
declare const resolveNativeInvocationEffect: (
  options: NativeAgentRuntimeOptions,
  service: AgentExecutionService,
) => Effect.Effect<
  {
    capture: AgentCapturePolicy;
    invocationId: StableId;
    traceId: StableId;
    runtimeModel: ResolvedRuntimeModel;
  },
  AgentInvocationFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-invoke.ts#L21)

## `runtime-loop-context.types.ts`

Carries one native loop's already acquired runnable, identity, state selection
and signal to stream/settlement helpers without allocating another lifetime.

### NativeAgentLoopContext (interface)

**Signature**

```ts
export interface NativeAgentLoopContext {
  readonly options: AgentLoopOptions;
  readonly native: Awaited<ReturnType<typeof createNativeAgent>>;
  readonly config: { readonly configurable?: { readonly thread_id: string } };
  readonly input: unknown;
  readonly signal: AbortSignal;
  readonly maxInputBytes: number;
  readonly maxOutputBytes: number;
  readonly observe: ReturnType<typeof createLoopTelemetry>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-context.types.ts#L9)

## `runtime-loop-execution.ts`

Executes one native agent stream while retaining model failure precedence.
Public wrappers own Effect interruption; state helpers use the same signal.

### runAgentLoopCore

**Signature**

```ts
declare const runAgentLoopCore: (
  options: AgentLoopOptions,
  model: NativeModel,
  modelId: string,
  signal: AbortSignal,
  input: unknown,
  maxInputBytes: number,
  maxOutputBytes: number,
  invocationId: string,
  traceId: string,
  capture: AgentCapturePolicy,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-execution.ts#L17)

## `runtime-loop-state.ts`

Streams one already acquired native runnable and settles its public output or
interruption using the same checkpoint identity, byte limits and content sink.

### settleNativeAgentLoop

Publishes waiting state or validated output without changing persistence identity.

**Signature**

```ts
declare const settleNativeAgentLoop: (
  context: NativeAgentLoopContext,
  state: unknown,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-state.ts#L65)

### streamNativeAgentLoop

Collects the native stream under its caller's existing trace and signal.

**Signature**

```ts
declare const streamNativeAgentLoop: (context: NativeAgentLoopContext) => Promise<any>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-state.ts#L25)

## `runtime-loop-telemetry.ts`

Publishes native invocation loop observations to RELKIT telemetry using the current execution context and stable agent identifiers.

### createLoopTelemetry

**Signature**

```ts
declare const createLoopTelemetry: (
  runtime: AgentRuntimeOptions,
  modelId: string,
) => (event: ProtocolEvent) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-telemetry.ts#L10)

## `runtime-loop-values.ts`

Extracts validated loop input and output values for native execution, keeping schema failure handling at the invocation boundary.

### nativeMessages

Builds native messages for existing synchronous callers.

**Throws**

The original input JSON or byte limit error.

**Example**

```ts
nativeMessages(options, input, 1024);
```

**Signature**

```ts
declare const nativeMessages: (
  options: AgentLoopOptions,
  input: unknown,
  maxInputBytes: number,
) => Array<{ role: "user" | "assistant"; content: string }>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-values.ts#L39)

### nativeMessagesEffect

Builds the native message list from prior turns and validated input.

**Example**

```ts
Effect.runSync(nativeMessagesEffect(options, input, 1024));
```

**Signature**

```ts
declare const nativeMessagesEffect: (
  options: AgentLoopOptions,
  input: unknown,
  maxInputBytes: number,
) => Effect.Effect<
  Array<{ role: "user" | "assistant"; content: string }>,
  AgentInvocationFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-values.ts#L17)

### responseValue

Extracts structured output for existing synchronous callers.

**Throws**

AgentRuntimeError when structured output is absent.

**Example**

```ts
responseValue(state);
```

**Signature**

```ts
declare const responseValue: (state: unknown) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-values.ts#L79)

### responseValueEffect

Extracts the structured model output value.

**Example**

```ts
Effect.runSync(responseValueEffect(state));
```

**Signature**

```ts
declare const responseValueEffect: (
  state: unknown,
) => Effect.Effect<unknown, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-values.ts#L52)

### unwrapNativeCause

Unwraps native causes for existing synchronous callers.

**Example**

```ts
unwrapNativeCause(error);
```

**Signature**

```ts
declare const unwrapNativeCause: (value: unknown) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-values.ts#L111)

### unwrapNativeCauseEffect

Unwraps nested native provider causes without looping on cyclic causes.

**Example**

```ts
Effect.runSync(unwrapNativeCauseEffect(error));
```

**Signature**

```ts
declare const unwrapNativeCauseEffect: (value: unknown) => Effect.Effect<unknown, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop-values.ts#L92)

## `runtime-loop.ts`

Exposes native loop execution as an observed Effect and Promise facade.
Cancellation remains linked to the caller and the native stream owner.

### AgentLoopOptions

**Signature**

```ts
declare const AgentLoopOptions: AgentLoopOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop.ts#L12)

### NativeModel

**Signature**

```ts
declare const NativeModel: NativeModel;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop.ts#L12)

### runAgentLoop

Runs the native model loop for existing Promise callers.

**Throws**

The original model, tool, validation, or cancellation error.

**Example**

```ts
await runAgentLoop(options, model, id, signal, input, 1024, 1024, invocation, trace, capture);
```

**Signature**

```ts
declare const runAgentLoop: (
  options: AgentLoopOptions,
  model: NativeModel,
  modelId: string,
  signal: AbortSignal,
  input: unknown,
  maxInputBytes: number,
  maxOutputBytes: number,
  invocationId: string,
  traceId: string,
  capture: AgentCapturePolicy,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop.ts#L75)

### runAgentLoopEffect

Runs one native model loop with linked Effect cancellation.

**Example**

```ts
await Effect.runPromise(
  runAgentLoopEffect(options, model, id, signal, input, 1024, 1024, invocation, trace, capture),
);
```

**Signature**

```ts
declare const runAgentLoopEffect: (
  options: AgentLoopOptions,
  model: NativeModel,
  modelId: string,
  signal: AbortSignal,
  input: unknown,
  maxInputBytes: number,
  maxOutputBytes: number,
  invocationId: string,
  traceId: string,
  capture: AgentCapturePolicy,
) => Effect.Effect<unknown, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop.ts#L28)

## `runtime-loop.types.ts`

Coordinates native invocation steps, output validation and settlement while retaining tool, interruption and stream finalization order. This companion preserves the native input and output types without starting runtime work.

### AgentLoopOptions (type alias)

Runtime and invocation options consumed by the native model loop.

**Signature**

```ts
type AgentLoopOptions = AgentRuntimeOptions & AgentInvocationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop.types.ts#L7)

### NativeModel (type alias)

Resolved native model or provider selector.

**Signature**

```ts
type NativeModel = string | LanguageModelLike;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-loop.types.ts#L10)

## `runtime-model-error.ts`

Defines model selection and initialization failures with the selected model identifier and underlying SDK cause.

### AgentModelResolutionFailure (class)

Tagged model resolution or content limit failure.

**Signature**

```ts
declare class AgentModelResolutionFailure
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model-error.ts#L6)

### agentModelResolutionFailure

Preserves a model provider or limit error for Effect callers.

**Example**

```ts
agentModelResolutionFailure(new Error("unavailable"));
```

**Signature**

```ts
declare const agentModelResolutionFailure: (cause: unknown) => AgentModelResolutionFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model-error.ts#L16)

## `runtime-model.ts`

Resolves authored model selectors or native model instances for an invocation without replacing the caller's model resource identity.

### AgentContentLimits

**Signature**

```ts
declare const AgentContentLimits: AgentContentLimits;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.ts#L16)

### ResolvedRuntimeModel

**Signature**

```ts
declare const ResolvedRuntimeModel: ResolvedRuntimeModel;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.ts#L17)

### RuntimeModelOptions

**Signature**

```ts
declare const RuntimeModelOptions: RuntimeModelOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.ts#L18)

### resolveAgentContentLimits

Validates content byte limits for existing synchronous runtime callers.

**Throws**

The original AgentRuntimeError for invalid limits.

**Example**

```ts
resolveAgentContentLimits({ maxInputBytes: 1024 });
```

**Signature**

```ts
declare const resolveAgentContentLimits: (
  options: Pick<RuntimeModelOptions, "maxInputBytes" | "maxOutputBytes">,
) => AgentContentLimits;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.ts#L112)

### resolveAgentContentLimitsEffect

Validates content byte limits against fixed package maximums.

**Example**

```ts
Effect.runSync(resolveAgentContentLimitsEffect({ maxInputBytes: 1024 }));
```

**Signature**

```ts
declare const resolveAgentContentLimitsEffect: (
  options: Pick<RuntimeModelOptions, "maxOutputBytes" | "maxInputBytes">,
) => Effect.Effect<AgentContentLimits, AgentModelResolutionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.ts#L94)

### resolveRuntimeModel

Resolves a model for existing Promise runtime callers.

**Throws**

The original provider or AgentRuntimeError cause.

**Example**

```ts
await resolveRuntimeModel({ model: "test", registry: null, environment: {} });
```

**Signature**

```ts
declare const resolveRuntimeModel: (options: RuntimeModelOptions) => Promise<ResolvedRuntimeModel>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.ts#L81)

### resolveRuntimeModelEffect

Resolves a model factory, native model, registry selection, or string selector.

**Example**

```ts
Effect.runPromise(resolveRuntimeModelEffect({ model: "test", registry: null, environment: {} }));
```

**Signature**

```ts
declare const resolveRuntimeModelEffect: (
  options: RuntimeModelOptions,
) => Effect.Effect<ResolvedRuntimeModel, AgentModelResolutionFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.ts#L29)

## `runtime-model.types.ts`

Resolves authored model selectors or native model instances for an invocation without replacing the caller's model resource identity. This companion preserves the native input and output types without starting runtime work.

### AgentContentLimits (interface)

Validated maximum byte counts for agent input and output.

**Signature**

```ts
export interface AgentContentLimits {
  readonly maxInputBytes: number;
  readonly maxOutputBytes: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.types.ts#L16)

### ResolvedRuntimeModel (interface)

Selected native model and validated content limits.

**Signature**

```ts
export interface ResolvedRuntimeModel extends AgentContentLimits {
  readonly id: string;
  readonly model: string | LanguageModelLike;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.types.ts#L22)

### RuntimeModelOptions (interface)

Inputs used to select a native model and content limits.

**Signature**

```ts
export interface RuntimeModelOptions {
  readonly model?: AgentModel;
  readonly registry: unknown;
  readonly environment: Readonly<Record<string, unknown>>;
  readonly maxInputBytes?: number;
  readonly maxOutputBytes?: number;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-model.types.ts#L7)

## `runtime-native-agent-build.ts`

Constructs the native agent from resolved model, tools, middleware and optional DeepAgents configuration immediately before invocation.

### childModelEffect

Resolves a child model or inherits its parent model.

**Example**

```ts
await Effect.runPromise(childModelEffect(child, model, runtime));
```

**Signature**

```ts
declare const childModelEffect: (
  child: AgentDescriptor<
    string,
    unknown,
    unknown,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    ReadonlyArray<AgentMiddleware>,
    ReadonlyArray<AgentTool>
  >,
  inherited: string | LanguageModelLike,
  runtime: NativeAgentRuntimeOptions,
) => Effect.Effect<string | LanguageModelLike, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent-build.ts#L52)

### createSubagentsEffect

Builds child and nested DeepAgents declarations in authored order.

**Example**

```ts
await Effect.runPromise(
  createSubagentsEffect(children, model, backend, runtime, options, groups, deepagents, limits),
);
```

**Signature**

```ts
declare const createSubagentsEffect: (
  children: ReadonlyArray<
    AgentDescriptor<
      string,
      unknown,
      unknown,
      StandardSchemaV1<unknown, unknown>,
      StandardSchemaV1<unknown, unknown>,
      ReadonlyArray<AgentMiddleware>,
      ReadonlyArray<AgentTool>
    >
  >,
  inheritedModel: string | LanguageModelLike,
  inheritedBackend: unknown,
  runtime: NativeAgentRuntimeOptions,
  options: CreateNativeAgentOptions,
  groups: Array<NativeTools>,
  deepagents: typeof import("deepagents"),
  limitMiddleware: AnyAgentMiddleware,
) => Effect.Effect<Array<unknown>, AgentInvocationFailure, NativeToolIdentity>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent-build.ts#L81)

### createToolsForAgentEffect

Materializes tools for a root or child agent.

**Example**

```ts
Effect.runSync(createToolsForAgentEffect(runtime, options, child));
```

**Signature**

```ts
declare const createToolsForAgentEffect: (
  runtime: NativeAgentRuntimeOptions,
  options: CreateNativeAgentOptions,
  agent: AgentDescriptor<
    string,
    unknown,
    unknown,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    ReadonlyArray<AgentMiddleware>,
    ReadonlyArray<AgentTool>
  >,
) => Effect.Effect<NativeTools, AgentInvocationFailure, NativeToolIdentity>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent-build.ts#L29)

### responseFormatEffect

**Signature**

```ts
declare const responseFormatEffect: (
  schema: StandardSchemaV1<unknown, unknown>,
  model?: NativeModel | undefined,
) => Effect.Effect<
  ProviderStrategy<Record<string, unknown>> | TypedToolStrategy<Record<string, unknown>>,
  AgentInvocationFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent-build.ts#L161)

## `runtime-native-agent.ts`

Owns native agent construction and invocation adaptation, retaining the authored SDK configuration and selected persistence context.

### CreateNativeAgentOptions

**Signature**

```ts
declare const CreateNativeAgentOptions: CreateNativeAgentOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent.ts#L27)

### NativeAgent

**Signature**

```ts
declare const NativeAgent: ReactAgent<
  AgentTypeConfig<
    Record<string, any>,
    StateDefinitionInit | undefined,
    InteropZodObject | AnyAnnotationRoot,
    ReadonlyArray<AnyAgentMiddleware>,
    ReadonlyArray<ClientTool | ServerTool>,
    ReadonlyArray<() => StreamTransformer<any>>
  >
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent.ts#L27)

### StructuredOutputParsingError

**Signature**

```ts
declare const StructuredOutputParsingError: typeof StructuredOutputParsingError;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent.ts#L26)

### createNativeAgent

Builds a native agent for existing Promise callers.

**Throws**

The original model, schema, persistence, or dependency error.

**Example**

```ts
await createNativeAgent(options);
```

**Signature**

```ts
declare const createNativeAgent: (
  options: CreateNativeAgentOptions,
) => Promise<{ readonly agent: NativeAgent; readonly tools: NativeTools }>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent.ts#L90)

### createNativeAgentEffect

Builds a native LangChain or DeepAgents runnable for one invocation.

**Example**

```ts
await Effect.runPromise(
  Effect.provide(
    createNativeAgentEffect(options),
    Layer.merge(DeepAgentsLoaderLive, NativeToolIdentityLive),
  ),
);
```

**Signature**

```ts
declare const createNativeAgentEffect: (options: CreateNativeAgentOptions) => Effect.Effect<
  | {
      agent: ReactAgent<
        AgentTypeConfig<
          ResponseFormatUndefined,
          undefined,
          AnyAnnotationRoot,
          Array<AnyAgentMiddleware>,
          ReadonlyArray<
            | ClientTool
            | ServerTool
            | DynamicStructuredTool<
                InteropZodObject | JsonSchema7Type | InteropZodType<string>,
                unknown,
                unknown,
                unknown,
                unknown,
                string
              >
            | DynamicTool<unknown, unknown>
          >,
          readonly []
        >
      >;
      tools: NativeTools;
    }
  | {
      agent: ReactAgent<
        AgentTypeConfig<
          Record<string, any>,
          StateDefinitionInit | undefined,
          InteropZodObject | AnyAnnotationRoot,
          ReadonlyArray<AnyAgentMiddleware>,
          ReadonlyArray<ClientTool | ServerTool>,
          ReadonlyArray<() => StreamTransformer<any>>
        >
      >;
      tools: NativeTools;
    },
  AgentInvocationFailure,
  NativeToolIdentity | DeepAgentsLoader
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent.ts#L34)

## `runtime-native-agent.types.ts`

Owns native agent construction and invocation adaptation, retaining the authored SDK configuration and selected persistence context. This companion preserves the native input and output types without starting runtime work.

### CreateNativeAgentOptions (interface)

Inputs required to build one native agent invocation.

**Signature**

```ts
export interface CreateNativeAgentOptions {
  readonly runtime: NativeAgentRuntimeOptions;
  readonly model: string | LanguageModelLike;
  readonly signal: AbortSignal;
  readonly maxOutputBytes: number;
  readonly invocationId: string;
  readonly traceId: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent.types.ts#L18)

### NativeAgent (type alias)

Native LangChain agent runnable.

**Signature**

```ts
type NativeAgent = ReturnType<typeof createAgent>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent.types.ts#L15)

### NativeAgentRuntimeOptions (type alias)

Runtime options narrowed to a native agent descriptor.

**Signature**

```ts
type NativeAgentRuntimeOptions = Omit<AgentRuntimeOptions, "agent"> &
  AgentInvocationOptions & {
    readonly agent: AgentDescriptor<string, unknown, unknown>;
  };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-agent.types.ts#L9)

## `runtime-native-event-tools.ts`

Projects native tool events into RELKIT tool lifecycle observations while preserving tool call identifiers and status order.

### emitToolEvent

Emits a native tool event for existing Promise callers.

**Throws**

The original sink or cancellation error.

**Example**

```ts
await emitToolEvent(event, sink, ids, names, calls, signal);
```

**Signature**

```ts
declare const emitToolEvent: (
  event: ProtocolEvent,
  sink: AgentContentSink | undefined,
  toolIds: ReadonlyMap<string, string>,
  relkitNames: ReadonlySet<string>,
  toolNames: Map<string, string>,
  signal: AbortSignal,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-event-tools.ts#L86)

### emitToolEventEffect

Emits public lifecycle updates for a native tool event.

**Example**

```ts
await Effect.runPromise(emitToolEventEffect(event, sink, ids, names, calls, signal));
```

**Signature**

```ts
declare const emitToolEventEffect: (
  event: ProtocolEvent,
  sink: AgentContentSink | undefined,
  toolIds: ReadonlyMap<string, string>,
  relkitNames: ReadonlySet<string>,
  toolNames: Map<string, string>,
  signal: AbortSignal,
) => Effect.Effect<void, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-event-tools.ts#L22)

## `runtime-native-events-helpers.ts`

Extracts native event identifiers and payload fragments shared by stream adapters, retaining the SDK's event identity conventions.

### executionContext

Resolves the nearest execution context for a nested event.

**Example**

```ts
executionContext(event, contexts);
```

**Signature**

```ts
declare const executionContext: (
  event: ProtocolEvent,
  contexts: ReadonlyMap<string, NativeExecutionContext>,
) => NativeExecutionContext;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-events-helpers.ts#L46)

### isModelStart

Checks whether an event starts a model call.

**Example**

```ts
isModelStart(event);
```

**Signature**

```ts
declare const isModelStart: (event: ProtocolEvent) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-events-helpers.ts#L66)

### isToolStart

Checks whether an event starts a tool call.

**Example**

```ts
isToolStart(event);
```

**Signature**

```ts
declare const isToolStart: (event: ProtocolEvent) => boolean;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-events-helpers.ts#L80)

### trackExecutionContext

Tracks agent and subagent identity from native protocol events.

**Example**

```ts
trackExecutionContext(event, contexts);
```

**Signature**

```ts
declare const trackExecutionContext: (
  event: ProtocolEvent,
  contexts: Map<string, NativeExecutionContext>,
) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-events-helpers.ts#L12)

## `runtime-native-events.ts`

Maps the native event stream into RELKIT execution events and public observations in the order delivered by the native iterator.

### collectNativeEvents

Collects native events for existing Promise runtime callers.

**Throws**

The original stream, sink, validation, or cancellation error.

**Example**

```ts
await collectNativeEvents(
  events,
  sink,
  ids,
  names,
  signal,
  limits,
  schemas,
  failure,
  observe,
  abort,
);
```

**Signature**

```ts
declare const collectNativeEvents: (
  events: AsyncIterable<ProtocolEvent>,
  sink: AgentContentSink | undefined,
  toolIds: ReadonlyMap<string, string>,
  relkitNames: ReadonlySet<string>,
  signal: AbortSignal,
  limits: { readonly maxSteps: number; readonly maxToolCalls: number },
  stateSchemas: ReadonlyMap<string, StandardSchemaV1>,
  failure: () => unknown,
  observe: ((event: ProtocolEvent) => void) | undefined,
  abort: (reason: unknown) => void,
  eventSchemas?: Readonly<Record<string, StandardSchemaV1>>,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-events.ts#L95)

### collectNativeEventsEffect

Collects native events with linked Effect interruption.

**Example**

```ts
await Effect.runPromise(
  collectNativeEventsEffect(
    events,
    sink,
    ids,
    names,
    signal,
    limits,
    schemas,
    failure,
    observe,
    abort,
  ),
);
```

**Signature**

```ts
declare const collectNativeEventsEffect: (
  events: AsyncIterable<ProtocolEvent>,
  sink: AgentContentSink | undefined,
  toolIds: ReadonlyMap<string, string>,
  relkitNames: ReadonlySet<string>,
  signal: AbortSignal,
  limits: { readonly maxSteps: number; readonly maxToolCalls: number },
  stateSchemas: ReadonlyMap<string, StandardSchemaV1<unknown, unknown>>,
  failure: () => unknown,
  observe: ((event: ProtocolEvent) => void) | undefined,
  abort: (reason: unknown) => void,
  eventSchemas?: Readonly<Record<string, StandardSchemaV1<unknown, unknown>>> | undefined,
) => Effect.Effect<undefined, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-events.ts#L36)

## `runtime-native-limits.ts`

Applies authored step, tool-call and timeout limits at native invocation boundaries and reports the existing limit failures.

### createNativeLimitMiddleware

Creates native invocation guards for existing synchronous callers.

**Throws**

The original middleware creation error.

**Example**

```ts
createNativeLimitMiddleware(limits);
```

**Signature**

```ts
declare const createNativeLimitMiddleware: (limits: AgentLimits) => AnyAgentMiddleware;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-limits.ts#L62)

### createNativeLimitMiddlewareEffect

Creates per-invocation model and tool call guards.

**Example**

```ts
Effect.runSync(createNativeLimitMiddlewareEffect(limits));
```

**Signature**

```ts
declare const createNativeLimitMiddlewareEffect: (
  limits: AgentLimits,
) => Effect.Effect<AnyAgentMiddleware, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-limits.ts#L15)

## `runtime-native-messages.ts`

Converts invocation messages into native LangChain message shapes while preserving content, tool calls and reply correlation.

### NativeMessageAccumulator (class)

Per-invocation accumulator of streamed native assistant message parts.

**Example**

```ts
const messages = new NativeMessageAccumulator();
```

**Signature**

```ts
declare class NativeMessageAccumulator
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-messages.ts#L12)

### update (method)

Applies one event for existing synchronous callers.

**Example**

```ts
messages.update(event);
```

**Signature**

```ts
declare const update: (event: AgentExecutionEvent) => BrowserMessage | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-messages.ts#L30)

### updateCore (method)

**Signature**

```ts
declare const updateCore: (event: AgentExecutionEvent) => BrowserMessage | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-messages.ts#L34)

### updateEffect (property)

Applies one public event to the message accumulator.

**Example**

```ts
Effect.runSync(messages.updateEffect(event));
```

**Signature**

```ts
readonly updateEffect: (event: AgentExecutionEvent) => Effect.Effect<BrowserMessage | undefined, never, never>
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-messages.ts#L20)

## `runtime-native-messages.types.ts`

Mutable text parts for one native assistant message.

### MessageState (interface)

Mutable text parts for one native assistant message.

**Signature**

```ts
export interface MessageState {
  readonly messageId: string;
  readonly createdAt: string;
  readonly parts: Map<number, string>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-messages.types.ts#L2)

## `runtime-native-public-state.ts`

Projects permitted native state values for public client events using the agent's declared visibility policy.

### selectEffect

Validates selected fields from one state object with bounded concurrency.

**Example**

```ts
await Effect.runPromise(selectEffect(state, schemas));
```

**Signature**

```ts
declare const selectEffect: (
  value: Record<string, unknown>,
  schemas: ReadonlyMap<string, StandardSchemaV1<unknown, unknown>>,
) => Effect.Effect<{ [k: string]: unknown }, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public-state.ts#L49)

### selectedStateEffect

Projects selected state keys from direct or nested native updates.

**Example**

```ts
await Effect.runPromise(selectedStateEffect(update, schemas));
```

**Signature**

```ts
declare const selectedStateEffect: (
  value: unknown,
  schemas: ReadonlyMap<string, StandardSchemaV1<unknown, unknown>>,
) => Effect.Effect<{ [k: string]: unknown } | undefined, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public-state.ts#L14)

## `runtime-native-public-tools.ts`

Projects native tool activity into client-visible tool events after applying the declared public visibility contract.

### publicToolValue

Projects a native tool result for existing synchronous callers.

**Example**

```ts
publicToolValue(result);
```

**Signature**

```ts
declare const publicToolValue: (value: unknown) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public-tools.ts#L21)

### publicToolValueEffect

Projects a native tool result to its public value.

**Example**

```ts
Effect.runSync(publicToolValueEffect(result));
```

**Signature**

```ts
declare const publicToolValueEffect: (value: unknown) => Effect.Effect<unknown, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public-tools.ts#L11)

## `runtime-native-public.ts`

Coordinates native state and tool projection for public execution sinks without exposing undeclared private state.

### NativeExecutionContext

**Signature**

```ts
declare const NativeExecutionContext: NativeExecutionContext;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public.ts#L14)

### nativePublicEvent

Projects a native event for existing Promise callers.

**Throws**

The original schema or timestamp error.

**Example**

```ts
await nativePublicEvent(event, schemas);
```

**Signature**

```ts
declare const nativePublicEvent: (
  event: ProtocolEvent,
  stateSchemas: ReadonlyMap<string, StandardSchemaV1>,
  context?: NativeExecutionContext,
  eventSchemas?: Readonly<Record<string, StandardSchemaV1>>,
) => Promise<AgentExecutionEvent>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public.ts#L63)

### nativePublicEventEffect

Projects a native protocol event to its public, validated form.

**Example**

```ts
await Effect.runPromise(nativePublicEventEffect(event, schemas));
```

**Signature**

```ts
declare const nativePublicEventEffect: (
  event: ProtocolEvent,
  stateSchemas: ReadonlyMap<string, StandardSchemaV1<unknown, unknown>>,
  context?: NativeExecutionContext | undefined,
  eventSchemas?: Readonly<Record<string, StandardSchemaV1<unknown, unknown>>> | undefined,
) => Effect.Effect<AgentExecutionEvent, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public.ts#L25)

### publicToolValue

**Signature**

```ts
declare const publicToolValue: (value: unknown) => unknown;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public.ts#L15)

### publicToolValueEffect

**Signature**

```ts
declare const publicToolValueEffect: (value: unknown) => Effect.Effect<unknown, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public.ts#L15)

## `runtime-native-public.types.ts`

Coordinates native state and tool projection for public execution sinks without exposing undeclared private state. This companion preserves the native input and output types without starting runtime work.

### NativeExecutionContext (type alias)

Agent and parent context attached to a public native event.

**Signature**

```ts
type NativeExecutionContext = Pick<AgentExecutionEvent, "agent" | "parent">;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-public.types.ts#L6)

## `runtime-native-response-format.ts`

Converts a validated RELKIT output schema to the native structured response
strategy, preserving schema failures and disabling native silent recovery.

### responseFormatEffect

Creates the native structured output strategy.

**Example**

```ts
Effect.runSync(responseFormatEffect(output));
```

**Signature**

```ts
declare const responseFormatEffect: (
  schema: StandardSchemaV1<unknown, unknown>,
  model?: NativeModel | undefined,
) => Effect.Effect<
  ProviderStrategy<Record<string, unknown>> | TypedToolStrategy<Record<string, unknown>>,
  AgentInvocationFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-response-format.ts#L20)

## `runtime-native-subagents.ts`

Builds native child configurations and nested runnables after model, tools and
persistence have been resolved by the existing ordered subagent traversal.

### childAgentCommon

Projects an already resolved child's native runnable configuration.

**Signature**

```ts
declare const childAgentCommon: (
  child: AgentDescriptor<string, unknown, unknown>,
  model: string | LanguageModelLike,
  instructions: string,
  format: Effect.Success<ReturnType<typeof responseFormatEffect>>,
  childTools: NativeTools,
  limitMiddleware: AnyAgentMiddleware,
) => {
  name: string;
  model: string | LanguageModelLike;
  systemPrompt: string;
  tools: Array<
    | ClientTool
    | ServerTool
    | DynamicStructuredTool<
        InteropZodObject | JsonSchema7Type | InteropZodType<string>,
        unknown,
        unknown,
        unknown,
        unknown,
        string
      >
    | DynamicTool<unknown, unknown>
  >;
  middleware: Array<AnyAgentMiddleware>;
  responseFormat:
    ProviderStrategy<Record<string, unknown>> | TypedToolStrategy<Record<string, unknown>>;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-subagents.ts#L25)

### nestedChildAgentEffect

Constructs one nested runnable with the existing native exception boundary.

**Signature**

```ts
declare const nestedChildAgentEffect: (
  child: AgentDescriptor<
    string,
    unknown,
    unknown,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    ReadonlyArray<AgentMiddleware>,
    ReadonlyArray<AgentTool>
  >,
  common: {
    name: string;
    model: string | LanguageModelLike;
    systemPrompt: string;
    tools: Array<
      | ClientTool
      | ServerTool
      | DynamicStructuredTool<
          InteropZodObject | JsonSchema7Type | InteropZodType<string>,
          unknown,
          unknown,
          unknown,
          unknown,
          string
        >
      | DynamicTool<unknown, unknown>
    >;
    middleware: Array<AnyAgentMiddleware>;
    responseFormat:
      ProviderStrategy<Record<string, unknown>> | TypedToolStrategy<Record<string, unknown>>;
  },
  persistence: ResolvedGraphPersistence,
  nested: Array<unknown>,
  backend: unknown,
  deepagents: typeof import("deepagents"),
) => Effect.Effect<NativeNestedSubagent, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-subagents.ts#L55)

## `runtime-native-subagents.types.ts`

Native nested subagent declaration consumed by DeepAgents construction.

### NativeNestedSubagent (interface)

Native nested subagent declaration consumed by DeepAgents construction.

**Signature**

```ts
export interface NativeNestedSubagent {
  readonly name: string;
  readonly description: string;
  readonly runnable: ReturnType<typeof import("deepagents").createDeepAgent>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-subagents.types.ts#L2)

## `runtime-native-support.ts`

Resolves native execution support, including optional DeepAgents loading, preserving initialization and nested dependency errors as invocation causes.

### DeepAgentsLoader (class)

Substitutable loader for the optional DeepAgents dependency.

**Example**

```ts
Effect.provide(loadDeepAgentsEffect(), DeepAgentsLoaderLive);
```

**Signature**

```ts
declare class DeepAgentsLoader
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L16)

### DeepAgentsLoaderLive

Live dynamic import of the optional DeepAgents dependency.

**Example**

```ts
Effect.runPromise(Effect.provide(loadDeepAgentsEffect(), DeepAgentsLoaderLive));
```

**Signature**

```ts
declare const DeepAgentsLoaderLive: Layer.Layer<DeepAgentsLoader, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L23)

### DeepAgentsLoaderService

**Signature**

```ts
declare const DeepAgentsLoaderService: DeepAgentsLoaderService;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L11)

### assertAgentRuntimeDependencies

Verifies optional runtime dependencies for existing Promise callers.

**Throws**

AgentRuntimeError for an unavailable dependency.

**Example**

```ts
await assertAgentRuntimeDependencies(agents);
```

**Signature**

```ts
declare const assertAgentRuntimeDependencies: (
  agents: readonly AgentDescriptor<string, unknown, unknown>[],
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L152)

### assertAgentRuntimeDependenciesEffect

Verifies optional runtime dependencies for authored agents.

**Example**

```ts
await Effect.runPromise(
  Effect.provide(assertAgentRuntimeDependenciesEffect(agents), DeepAgentsLoaderLive),
);
```

**Signature**

```ts
declare const assertAgentRuntimeDependenciesEffect: (
  agents: ReadonlyArray<
    AgentDescriptor<
      string,
      unknown,
      unknown,
      StandardSchemaV1<unknown, unknown>,
      StandardSchemaV1<unknown, unknown>,
      ReadonlyArray<AgentMiddleware>,
      ReadonlyArray<AgentTool>
    >
  >,
) => Effect.Effect<void, AgentInvocationFailure, DeepAgentsLoader>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L139)

### combineNativeTools

Combines tool groups for existing synchronous callers.

**Throws**

The original invalid group error.

**Example**

```ts
combineNativeTools(groups);
```

**Signature**

```ts
declare const combineNativeTools: (groups: readonly NativeTools[]) => NativeTools;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L64)

### combineNativeToolsEffect

Combines public IDs and failures from native tool groups.

**Example**

```ts
Effect.runSync(combineNativeToolsEffect(groups));
```

**Signature**

```ts
declare const combineNativeToolsEffect: (
  groups: ReadonlyArray<NativeTools>,
) => Effect.Effect<NativeTools, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L35)

### loadDeepAgents

Loads DeepAgents for existing Promise callers.

**Throws**

AgentRuntimeError when the module is unavailable.

**Example**

```ts
await loadDeepAgents();
```

**Signature**

```ts
declare const loadDeepAgents: () => Promise<typeof import("deepagents")>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L125)

### loadDeepAgentsEffect

Loads the optional DeepAgents module through a replaceable service.

**Example**

```ts
await Effect.runPromise(Effect.provide(loadDeepAgentsEffect(), DeepAgentsLoaderLive));
```

**Signature**

```ts
declare const loadDeepAgentsEffect: () => Effect.Effect<
  typeof import("deepagents"),
  AgentInvocationFailure,
  DeepAgentsLoader
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L109)

### nativeInstructions

Projects native instructions for existing synchronous callers.

**Throws**

The original invalid instructions error.

**Example**

```ts
nativeInstructions(agent);
```

**Signature**

```ts
declare const nativeInstructions: (agent: AgentDescriptor<string, unknown, unknown>) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L97)

### nativeInstructionsEffect

Projects authored instructions to native system prompt text.

**Example**

```ts
Effect.runSync(nativeInstructionsEffect(agent));
```

**Signature**

```ts
declare const nativeInstructionsEffect: (
  agent: AgentDescriptor<
    string,
    unknown,
    unknown,
    StandardSchemaV1<unknown, unknown>,
    StandardSchemaV1<unknown, unknown>,
    ReadonlyArray<AgentMiddleware>,
    ReadonlyArray<AgentTool>
  >,
) => Effect.Effect<string, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.ts#L77)

## `runtime-native-support.types.ts`

Replaceable loader for the optional DeepAgents runtime dependency.

### DeepAgentsLoaderService (interface)

Replaceable loader for the optional DeepAgents runtime dependency.

**Signature**

```ts
export interface DeepAgentsLoaderService {
  /** Loads the optional runtime module.
   * @returns The DeepAgents module.
   * @example await loader.load();
   */
  readonly load: () => Promise<typeof import("deepagents")>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-support.types.ts#L2)

## `runtime-native-tool-build.ts`

Converts one checked reference into a native tool while preserving common-engine
execution, trace context and the deferred approval failure reader.

### nativeToolEntry

Resolves one authored tool and records its public native mapping.

**Signature**

```ts
declare const nativeToolEntry: (
  entry: AgentTool,
  index: number,
  context: NativeToolBuildContext,
) => ClientTool | ServerTool | ReturnType<typeof tool>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tool-build.ts#L23)

## `runtime-native-tool-build.types.ts`

Invocation-owned tool identity maps and deferred native failure authority.

### NativeToolBuildContext (interface)

**Signature**

```ts
export interface NativeToolBuildContext {
  readonly options: NativeToolRuntimeOptions;
  readonly signal: AbortSignal;
  readonly maxOutputBytes: number;
  readonly invocationId: string;
  readonly traceId: string;
  readonly identity: NativeToolIdentityService;
  readonly publicIds: Map<string, string>;
  readonly relkitNames: Set<string>;
  readonly setFailure: (cause: unknown) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tool-build.types.ts#L6)

## `runtime-native-tools-identity.ts`

Derives stable native tool identities used by descriptor adaptation and runtime dispatch without cloning the SDK tool instances.

### NativeToolIdentity (class)

Substitutable native tool call identity source.

**Example**

```ts
Effect.provide(createNativeToolsEffect(options, signal, 1024, id, trace), NativeToolIdentityLive);
```

**Signature**

```ts
declare class NativeToolIdentity
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools-identity.ts#L9)

### NativeToolIdentityLive

Live UUID source for native tool calls.

**Example**

```ts
Effect.runSync(Effect.provide(effect, NativeToolIdentityLive));
```

**Signature**

```ts
declare const NativeToolIdentityLive: Layer.Layer<NativeToolIdentity, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools-identity.ts#L17)

## `runtime-native-tools.ts`

Combines authored native tools and RELKIT callable adapters for invocation, retaining input schemas and native dispatch identity.

### NativeToolIdentity

**Signature**

```ts
declare const NativeToolIdentity: typeof NativeToolIdentity;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools.ts#L18)

### NativeToolIdentityLive

**Signature**

```ts
declare const NativeToolIdentityLive: Layer<NativeToolIdentity, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools.ts#L18)

### NativeTools

**Signature**

```ts
declare const NativeTools: NativeTools;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools.ts#L17)

### createNativeTools

Materializes native tools for existing synchronous callers.

**Throws**

The original unknown tool or schema error.

**Example**

```ts
createNativeTools(options, signal, 1024, id, trace);
```

**Signature**

```ts
declare const createNativeTools: (
  options: NativeToolRuntimeOptions,
  signal: AbortSignal,
  maxOutputBytes: number,
  invocationId: string,
  traceId: string,
) => NativeTools;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools.ts#L77)

### createNativeToolsEffect

Materializes LangChain tools with public IDs and an invocation failure reader.

**Example**

```ts
Effect.runSync(
  Effect.provide(createNativeToolsEffect(options, signal, 1024, id, trace), NativeToolIdentityLive),
);
```

**Signature**

```ts
declare const createNativeToolsEffect: (
  options: NativeToolRuntimeOptions,
  signal: AbortSignal,
  maxOutputBytes: number,
  invocationId: string,
  traceId: string,
) => Effect.Effect<NativeTools, AgentInvocationFailure, NativeToolIdentity>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools.ts#L29)

## `runtime-native-tools.types.ts`

Combines authored native tools and RELKIT callable adapters for invocation, retaining input schemas and native dispatch identity. This companion preserves the native input and output types without starting runtime work.

### NativeToolIdentityService (interface)

Replaceable identity source for native tool calls.

**Signature**

```ts
export interface NativeToolIdentityService {
  /** Creates a call identity when LangChain does not supply one.
   * @returns A UUID.
   * @example identity.randomUUID();
   */
  readonly randomUUID: () => string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools.types.ts#L20)

### NativeToolRuntimeOptions (type alias)

Runtime context used to materialize native tools.

**Signature**

```ts
type NativeToolRuntimeOptions = AgentRuntimeOptions & AgentInvocationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools.types.ts#L17)

### NativeTools (interface)

Native tools and public identity mapping for one invocation.

**Signature**

```ts
export interface NativeTools {
  readonly values: readonly (
    ClientTool | ServerTool | ReturnType<typeof import("langchain").tool>
  )[];
  readonly publicIds: ReadonlyMap<string, string>;
  readonly relkitNames: ReadonlySet<string>;
  readonly failure: () => unknown;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-native-tools.types.ts#L7)

## `runtime-service.ts`

Provides the Effect runtime service that composes native model resolution, tools and loop execution under the invocation owner.

### AgentExecution (class)

Injectable model, graph, loop, and identity boundary.

**Example**

```ts
Effect.provide(invokeAgentEffect(options), AgentExecutionLive);
```

**Signature**

```ts
declare class AgentExecution
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-service.ts#L14)

### AgentExecutionLive

Live agent integrations used by the Promise compatibility API.

**Example**

```ts
Effect.runPromise(Effect.provide(invokeAgentEffect(options), AgentExecutionLive));
```

**Signature**

```ts
declare const AgentExecutionLive: Layer.Layer<AgentExecution, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-service.ts#L21)

### AgentExecutionService

**Signature**

```ts
declare const AgentExecutionService: AgentExecutionService;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-service.ts#L9)

## `runtime-service.types.ts`

Provides the Effect runtime service that composes native model resolution, tools and loop execution under the invocation owner. This companion preserves the native input and output types without starting runtime work.

### AgentExecutionService (interface)

Substitutable integrations used while invoking an agent.

**Signature**

```ts
export interface AgentExecutionService {
  readonly resolveModel: typeof resolveRuntimeModel;
  readonly runLoop: typeof runAgentLoop;
  readonly invokeGraph: typeof invokeGraph;
  readonly randomUUID: () => string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-service.types.ts#L8)

## `runtime-state-schemas.ts`

Decodes invocation state and output values at the native runtime boundary before persisted or public projections consume them.

### selectedStateSchemas

Resolves public state validators for existing synchronous callers.

**Throws**

TypeError for a selected key without a validator.

**Example**

```ts
selectedStateSchemas([state], ["answer"]);
```

**Signature**

```ts
declare const selectedStateSchemas: (
  sources: readonly unknown[],
  selected: readonly string[],
) => ReadonlyMap<string, StandardSchemaV1>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-state-schemas.ts#L30)

### selectedStateSchemasEffect

Resolves validators for selected public state keys.

**Example**

```ts
Effect.runSync(selectedStateSchemasEffect([state], ["answer"]));
```

**Signature**

```ts
declare const selectedStateSchemasEffect: (
  sources: ReadonlyArray<unknown>,
  selected: ReadonlyArray<string>,
) => Effect.Effect<
  ReadonlyMap<string, StandardSchemaV1<unknown, unknown>>,
  AgentInvocationFailure,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-state-schemas.ts#L14)

## `runtime-strict-response-schema.ts`

Selects the structural JSON-schema subset that can use provider enforcement without making optional fields required.

### strictResponseSchema

Closes declared objects for native generation; runtime validation still uses the authored schema.

**Signature**

```ts
declare const strictResponseSchema: (schema: JsonSchema, depth?: number) => JsonSchema | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-strict-response-schema.ts#L24)

## `runtime-tool-adapter.ts`

Adapts RELKIT callable tools to native SDK tools while preserving validated input, execution context and typed invocation failures.

### createAgentInvocationDispatcher

**Signature**

```ts
declare const createAgentInvocationDispatcher: (
  engine: ToolEngine,
  options: RuntimeToolOptions,
  invocationId: string,
  traceId: string | undefined,
  parentSpanId: string | undefined,
  signal: AbortSignal,
) => InvocationDispatcher;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-adapter.ts#L24)

### createAgentInvocationDispatcherEffect

**Signature**

```ts
declare const createAgentInvocationDispatcherEffect: (
  engine: ToolEngine,
  options: RuntimeToolOptions,
  invocationId: string,
  traceId: string | undefined,
  parentSpanId: string | undefined,
  signal: AbortSignal,
) => Effect.Effect<
  Readonly<{
    dispatch: <Input, Output, Context extends { readonly signal: AbortSignal }>(
      request: InvocationDispatchRequest<Input, Output, Context>,
    ) => Promise<Output>;
  }>,
  never,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-adapter.ts#L25)

### invokeAgentTool

Invokes an allowed tool for existing Promise callers.

**Throws**

The original validation, sink, approval, or tool error.

**Example**

```ts
await invokeAgentTool(engine, tool, turn, options, signal, id);
```

**Signature**

```ts
declare const invokeAgentTool: (
  engine: ToolEngine,
  tool: ToolDescriptor<string>,
  turn: AgentToolCall,
  options: RuntimeToolOptions,
  signal: AbortSignal,
  invocationId: string,
  traceId?: string,
  parentSpanId?: string,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-adapter.ts#L104)

### invokeAgentToolEffect

Invokes an allowed tool with validated input and public lifecycle events.

**Example**

```ts
await Effect.runPromise(invokeAgentToolEffect(engine, tool, turn, options, signal, id));
```

**Signature**

```ts
declare const invokeAgentToolEffect: (
  engine: ToolEngine,
  tool: ToolDescriptor<string>,
  turn: AgentToolCall,
  options: RuntimeToolOptions,
  signal: AbortSignal,
  invocationId: string,
  traceId?: string | undefined,
  parentSpanId?: string | undefined,
) => Effect.Effect<unknown, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-adapter.ts#L40)

## `runtime-tool-dispatcher.ts`

Dispatches native tool calls to the selected RELKIT tool target and carries approval and execution failures back to the native loop.

### createAgentInvocationDispatcher

Creates a nested function dispatcher for existing synchronous callers.

**Example**

```ts
createAgentInvocationDispatcher(engine, options, id, trace, span, signal);
```

**Signature**

```ts
declare const createAgentInvocationDispatcher: (
  engine: ToolEngine,
  options: RuntimeToolOptions,
  invocationId: string,
  traceId: string | undefined,
  parentSpanId: string | undefined,
  signal: AbortSignal,
) => InvocationDispatcher;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-dispatcher.ts#L89)

### createAgentInvocationDispatcherEffect

Creates a nested function dispatcher with stable agent parent context.

**Example**

```ts
Effect.runSync(createAgentInvocationDispatcherEffect(engine, options, id, trace, span, signal));
```

**Signature**

```ts
declare const createAgentInvocationDispatcherEffect: (
  engine: ToolEngine,
  options: RuntimeToolOptions,
  invocationId: string,
  traceId: string | undefined,
  parentSpanId: string | undefined,
  signal: AbortSignal,
) => Effect.Effect<
  Readonly<{
    dispatch: <Input, Output, Context extends { readonly signal: AbortSignal }>(
      request: InvocationDispatchRequest<Input, Output, Context>,
    ) => Promise<Output>;
  }>,
  never,
  never
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-dispatcher.ts#L24)

## `runtime-tool-events.ts`

Publishes tool lifecycle observations for native calls with stable call identity, preserving failure and completion ordering.

### emitTool

Emits a tool transition for existing Promise callers.

**Throws**

The original sink or cancellation error.

**Example**

```ts
await emitTool(options, turn, "running", undefined, signal);
```

**Signature**

```ts
declare const emitTool: (
  options: RuntimeToolOptions,
  turn: Pick<AgentToolCall, "callId" | "toolId">,
  state: ToolPartState,
  value: unknown,
  signal: AbortSignal,
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-events.ts#L70)

### emitToolEffect

Emits a public tool transition with linked Effect cancellation.

**Example**

```ts
await Effect.runPromise(emitToolEffect(options, turn, "running", undefined, signal));
```

**Signature**

```ts
declare const emitToolEffect: (
  options: RuntimeToolOptions,
  turn: Pick<AgentToolCall, "callId" | "toolId">,
  state: ToolPartState,
  value: unknown,
  signal: AbortSignal,
) => Effect.Effect<undefined, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-events.ts#L29)

### resolveAgentApproval

Resolves approval for existing Promise callers.

**Throws**

The original approval, sink, or cancellation error.

**Example**

```ts
await resolveAgentApproval(options, request, callId, id, signal);
```

**Signature**

```ts
declare const resolveAgentApproval: (
  options: RuntimeToolOptions,
  request: ToolApprovalRequest,
  toolCallId: string,
  invocationId: string,
  signal: AbortSignal,
) => Promise<true>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-events.ts#L163)

### resolveAgentApprovalEffect

Resolves tool approval and emits its lifecycle transitions.

**Example**

```ts
await Effect.runPromise(resolveAgentApprovalEffect(options, request, callId, id, signal));
```

**Signature**

```ts
declare const resolveAgentApprovalEffect: (
  options: RuntimeToolOptions,
  request: FunctionToolApprovalRequest,
  toolCallId: string,
  invocationId: string,
  signal: AbortSignal,
) => Effect.Effect<true, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-events.ts#L94)

## `runtime-tool-events.types.ts`

Publishes tool lifecycle observations for native calls with stable call identity, preserving failure and completion ordering. This companion preserves the native input and output types without starting runtime work.

### RuntimeToolOptions (type alias)

Runtime integrations needed to emit tool events and resolve approval.
The invocation options supply the approval callback and content sink.

**Example**

```ts
const options: RuntimeToolOptions = { ...runtime, input };
```

**Signature**

```ts
type RuntimeToolOptions = AgentRuntimeOptions & AgentInvocationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-events.types.ts#L9)

## `runtime-tool-invocation.ts`

Executes a validated tool in the original invocation scope and emits terminal
lifecycle records without changing approval or progress routing.

### invokeRegisteredAgentToolEffect

Dispatches a checked tool inside its existing call scope.

**Signature**

```ts
declare const invokeRegisteredAgentToolEffect: (
  engine: ToolEngine,
  tool: ToolDescriptor<string>,
  turn: AgentToolCall,
  options: RuntimeToolOptions,
  signal: AbortSignal,
  invocationId: string,
  traceId: string | undefined,
  parentSpanId: string | undefined,
  progressSink: ProgressSink | undefined,
) => Effect.Effect<unknown, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-invocation.ts#L32)

## `runtime-tool-lookup.ts`

Resolves authored RELKIT tool references against the invocation tool registry before native tool construction.

### findModelTool

Finds a native tool for existing synchronous callers.

**Example**

```ts
findModelTool(tools, refs, "math_add_0");
```

**Signature**

```ts
declare const findModelTool: (
  source: ToolSource,
  refs: readonly { readonly ref: { readonly id: string } }[],
  name: string,
) => ToolDescriptor<string> | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-lookup.ts#L57)

### findModelToolEffect

Finds a native tool by direct or model-facing name.

**Example**

```ts
Effect.runSync(findModelToolEffect(tools, refs, "math_add_0"));
```

**Signature**

```ts
declare const findModelToolEffect: (
  source: ToolSource,
  refs: ReadonlyArray<{ readonly ref: { readonly id: string } }>,
  name: string,
) => Effect.Effect<ToolDescriptor<string> | undefined, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-lookup.ts#L39)

### findTool

Finds a tool for existing synchronous callers.

**Example**

```ts
findTool(tools, "math.add");
```

**Signature**

```ts
declare const findTool: (source: ToolSource, id: string) => ToolDescriptor<string> | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-lookup.ts#L82)

### findToolEffect

Finds a registered tool by map key or descriptor ID.

**Example**

```ts
Effect.runSync(findToolEffect(tools, "math.add"));
```

**Signature**

```ts
declare const findToolEffect: (
  source: ToolSource,
  id: string,
) => Effect.Effect<ToolDescriptor<string> | undefined, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-lookup.ts#L71)

### modelToolName

Produces a native tool name for existing synchronous callers.

**Example**

```ts
modelToolName("math.add", 0);
```

**Signature**

```ts
declare const modelToolName: (id: string, index: number) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-lookup.ts#L28)

### modelToolNameEffect

Produces a bounded model-facing name for one tool ID.

**Example**

```ts
Effect.runSync(modelToolNameEffect("math.add", 0));
```

**Signature**

```ts
declare const modelToolNameEffect: (
  id: string,
  index: number,
) => Effect.Effect<string, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tool-lookup.ts#L13)

## `runtime-tools.ts`

Builds invocation tool bindings from the selected RELKIT registry and native tool descriptors, keeping execution ownership with the caller.

### AgentToolCall

**Signature**

```ts
declare const AgentToolCall: AgentToolCall;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.ts#L17)

### findModelTool

**Signature**

```ts
declare const findModelTool: (
  source: ToolSource,
  refs: readonly { readonly ref: { readonly id: string } }[],
  name: string,
) => ToolDescriptor<string> | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.ts#L19)

### findModelToolEffect

**Signature**

```ts
declare const findModelToolEffect: (
  source: ToolSource,
  refs: ReadonlyArray<{ readonly ref: { readonly id: string } }>,
  name: string,
) => Effect.Effect<ToolDescriptor<string> | undefined, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.ts#L20)

### findTool

**Signature**

```ts
declare const findTool: (source: ToolSource, id: string) => ToolDescriptor<string> | undefined;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.ts#L21)

### findToolEffect

**Signature**

```ts
declare const findToolEffect: (
  source: ToolSource,
  id: string,
) => Effect.Effect<ToolDescriptor<string> | undefined, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.ts#L22)

### modelToolName

**Signature**

```ts
declare const modelToolName: (id: string, index: number) => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.ts#L23)

### modelToolNameEffect

**Signature**

```ts
declare const modelToolNameEffect: (
  id: string,
  index: number,
) => Effect.Effect<string, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.ts#L24)

### runTool

Executes a tool for existing Promise callers.

**Throws**

ApprovalRequiredError or AgentRuntimeError for cancellation.

**Example**

```ts
await runTool(options, turn, signal, 1024, id);
```

**Signature**

```ts
declare const runTool: (
  options: AgentRuntimeOptions & AgentInvocationOptions,
  turn: AgentToolCall,
  signal: AbortSignal,
  maxOutputBytes: number,
  invocationId: string,
  traceId?: string,
  parentSpanId?: string,
) => Promise<JsonValue>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.ts#L99)

### runToolEffect

Executes an allowed RELKIT tool with safe public error projection.

**Example**

```ts
await Effect.runPromise(runToolEffect(options, turn, signal, 1024, id));
```

**Signature**

```ts
declare const runToolEffect: (
  options: AgentRuntimeBaseOptions & { readonly modelRegistry?: unknown } & AgentInvocationOptions,
  turn: AgentToolCall,
  signal: AbortSignal,
  maxOutputBytes: number,
  invocationId: string,
  traceId?: string | undefined,
  parentSpanId?: string | undefined,
) => Effect.Effect<JsonValue, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.ts#L38)

## `runtime-tools.types.ts`

One model requested RELKIT tool call.

### AgentToolCall (interface)

One model requested RELKIT tool call.

**Signature**

```ts
export interface AgentToolCall {
  readonly callId: string;
  readonly toolId: string;
  readonly input: unknown;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-tools.types.ts#L2)

## `runtime-utils.ts`

Normalizes native invocation utility values shared by runtime adapters without changing the owning request's execution context.

### createExecutionSignal

**Signature**

```ts
declare const createExecutionSignal: (options: ExecutionSignalOptions) => ExecutionSignalHandle;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-utils.ts#L10)

### jsonValue

Produces bounded JSON for existing synchronous callers.

**Throws**

AgentRuntimeError for invalid JSON or byte limits.

**Example**

```ts
jsonValue({ ok: true }, 1024, "output");
```

**Signature**

```ts
declare const jsonValue: (value: unknown, maxBytes: number, label: string) => JsonValue;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-utils.ts#L95)

### jsonValueEffect

Produces bounded, canonical JSON from a runtime value.

**Example**

```ts
Effect.runSync(jsonValueEffect({ ok: true }, 1024, "output"));
```

**Signature**

```ts
declare const jsonValueEffect: (
  value: unknown,
  maxBytes: number,
  label: string,
) => Effect.Effect<JsonValue, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-utils.ts#L78)

### modelFailure

Classifies a model failure for existing synchronous callers.

**Example**

```ts
modelFailure(error, signal);
```

**Signature**

```ts
declare const modelFailure: (cause: unknown, signal: AbortSignal) => AgentRuntimeError;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-utils.ts#L132)

### modelFailureEffect

Classifies a model failure without exposing provider details.

**Example**

```ts
Effect.runSync(modelFailureEffect(error, signal));
```

**Signature**

```ts
declare const modelFailureEffect: (
  cause: unknown,
  signal: AbortSignal,
) => Effect.Effect<AgentRuntimeError, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-utils.ts#L121)

### signalFailure

**Signature**

```ts
declare const signalFailure: (signal: AbortSignal) => AgentRuntimeError;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-utils.ts#L10)

### validateValue

Validates an invocation value for existing Promise callers.

**Throws**

AgentRuntimeError for invalid values.

**Example**

```ts
await validateValue(schema, input, "input");
```

**Signature**

```ts
declare const validateValue: (
  schema: StandardSchemaV1,
  value: unknown,
  phase: "input" | "output",
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-utils.ts#L36)

### validateValueEffect

Validates an invocation value through a Standard Schema.

**Example**

```ts
await Effect.runPromise(validateValueEffect(schema, input, "input"));
```

**Signature**

```ts
declare const validateValueEffect: (
  schema: StandardSchemaV1<unknown, unknown>,
  value: unknown,
  phase: "input" | "output",
) => Effect.Effect<unknown, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-utils.ts#L19)

### withSignal

**Signature**

```ts
declare const withSignal: <T>(work: MaybePromise<T>, signal: AbortSignal) => Promise<T>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime-utils.ts#L10)

## `runtime.ts`

Exposes generated and direct native invocation entrypoints plus dependency and persistence lifecycle operations for the selected integration.

### "./runtime.types.js" (namespace export)

Re-exports all named exports from the "./runtime.types.js" module.

**Signature**

```ts
export * from "./runtime.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L19)

### AgentInvocationFailure

**Signature**

```ts
declare const AgentInvocationFailure: typeof AgentInvocationFailure;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L26)

### AgentRuntimeError

**Signature**

```ts
declare const AgentRuntimeError: typeof AgentRuntimeError;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L25)

### assertAgentRuntimeDependencies

**Signature**

```ts
declare const assertAgentRuntimeDependencies: (
  agents: readonly AgentDescriptor<string, unknown, unknown>[],
) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L23)

### createAgentRuntime

Binds one agent catalog for existing synchronous callers.

**Example**

```ts
const runtime = createAgentRuntime(options);
```

**Signature**

```ts
declare const createAgentRuntime: (options: AgentRuntimeOptions) => AgentRuntime;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L116)

### createAgentRuntimeEffect

Creates a reusable runtime through an observable Effect.

**Example**

```ts
Effect.runSync(createAgentRuntimeEffect(options));
```

**Signature**

```ts
declare const createAgentRuntimeEffect: (
  options: AgentRuntimeOptions,
) => Effect.Effect<AgentRuntime, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L99)

### createGeneratedAgentFunction

**Signature**

```ts
declare const createGeneratedAgentFunction: (
  agentId: unknown,
  executor?: GeneratedAgentExecutor,
) => GeneratedAgentFunction;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L21)

### invokeAgent

Runs an agent through the live Effect Layer for existing Promise callers.

**Throws**

The original validation, provider, cancellation, or runtime error.

**Example**

```ts
await invokeAgent({ ...options, input: { message: "hi" } });
```

**Signature**

```ts
declare const invokeAgent: (
  options: AgentRuntimeOptions & AgentInvocationOptions,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L64)

### invokeAgentEffect

Invokes an agent with typed failures and interruption linked to its work.

**Example**

```ts
Effect.runPromise(Effect.provide(invokeAgentEffect(options), AgentExecutionLive));
```

**Signature**

```ts
declare const invokeAgentEffect: (
  options: AgentRuntimeBaseOptions & { readonly modelRegistry?: unknown } & AgentInvocationOptions,
) => Effect.Effect<unknown, AgentInvocationFailure, AgentExecution>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L33)

### invokeAgentFunction

Runs an agent once for generated function actions, retaining output failure identity.

**Example**

```ts
await invokeAgentFunction(options);
```

**Signature**

```ts
declare const invokeAgentFunction: (
  options: AgentRuntimeOptions & AgentInvocationOptions,
) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L82)

### releaseAgentPersistence

**Signature**

```ts
declare const releaseAgentPersistence: (descriptors: readonly unknown[]) => Promise<void>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L22)

### runAgent

**Signature**

```ts
declare const runAgent: (options: AgentRuntimeOptions & AgentInvocationOptions) => Promise<unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L120)

### runtimeIntegration

**Signature**

```ts
declare const runtimeIntegration: Readonly<{
  kind: "runtime-integration";
  integrationId: "langchain";
  registrations: ReadonlyArray<{ capability: string; adapterId: string; protocolVersion: number }>;
}>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.ts#L20)

## `runtime.types.ts`

Exposes generated and direct native invocation entrypoints plus dependency and persistence lifecycle operations for the selected integration. This companion preserves the native input and output types without starting runtime work.

### AgentApprovalHandler (type alias)

Resolves a pending tool approval for an invocation.

**Signature**

```ts
type AgentApprovalHandler = (
  approval: import("@relkit/agents/internal/approval").PendingApproval,
) => MaybePromise<ApprovalDecision>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.types.ts#L13)

### AgentContentSink (interface)

Sends agent output and events to the surrounding runtime.

**Signature**

```ts
export interface AgentContentSink {
  readonly emitOutput: (value: unknown, signal: AbortSignal) => MaybePromise<void>;
  readonly finishOutput?: (signal: AbortSignal) => MaybePromise<void>;
  readonly progressSinkForTool?: (tool: {
    readonly toolCallId: string;
    readonly toolId: string;
  }) => import("@relkit/invocation").ProgressSink;
  readonly emitTool?: (
    value: {
      readonly toolCallId: string;
      readonly toolId: string;
      readonly state: import("@relkit/agents/internal/state.types").ToolPartState;
      readonly value?: unknown;
    },
    signal: AbortSignal,
  ) => MaybePromise<void>;
  readonly emitEvent?: (
    value: import("@relkit/agents/internal/runtime-events").AgentExecutionEvent,
    signal: AbortSignal,
  ) => MaybePromise<void>;
  readonly emitMessage?: (
    value: import("@relkit/contracts").BrowserMessage,
    signal: AbortSignal,
  ) => MaybePromise<void>;
  readonly emitWaiting?: (
    value: Omit<
      import("@relkit/agents/internal/state.types").AgentWaitingState,
      "revision" | "runId"
    >,
    signal: AbortSignal,
  ) => MaybePromise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.types.ts#L29)

### AgentConversationMessage (interface)

One user or assistant message in a native agent conversation.

**Signature**

```ts
export interface AgentConversationMessage {
  readonly role: "user" | "assistant";
  readonly content: string;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.types.ts#L23)

### AgentInvocationOptions (interface)

Per-call identity, input, cancellation, and control options.

**Signature**

```ts
export interface AgentInvocationOptions {
  readonly input: unknown;
  readonly invocationId?: string;
  readonly signal?: AbortSignal;
  readonly deadlineMs?: number;
  readonly timeoutMs?: number;
  readonly approval?: AgentApprovalHandler;
  readonly traceId?: string;
  readonly parentSpanId?: string;
  readonly hooks?: AgentRuntimeHooks;
  readonly capture?: AgentCapturePolicy;
  readonly threadId?: string;
  readonly resume?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.types.ts#L85)

### AgentRuntime (interface)

Reusable invocation API bound to one agent catalog.

**Signature**

```ts
export interface AgentRuntime {
  readonly invoke: (
    input: unknown,
    options?: Omit<AgentInvocationOptions, "input">,
  ) => Promise<unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.types.ts#L101)

### AgentRuntimeBaseOptions (interface)

Common authoring and execution dependencies for an agent runtime.

**Signature**

```ts
export interface AgentRuntimeBaseOptions {
  readonly agent: AgentAny;
  readonly tools: import("@relkit/tools").ToolSource;
  readonly bucketBackend?: import("./deepagent-bucket-client.types.js").DeepAgentBucketClient;
  readonly engine: import("@relkit/tools").ToolEngine;
  readonly maxInputBytes?: number;
  readonly maxOutputBytes?: number;
  readonly approval?: AgentApprovalHandler;
  readonly messages?: readonly AgentConversationMessage[];
  readonly steering?: AgentSteeringSource;
  readonly contentSink?: AgentContentSink;
  readonly hooks?: AgentRuntimeHooks;
  readonly capture?: AgentCapturePolicy;
  readonly environment?: Readonly<Record<string, unknown>>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.types.ts#L63)

### AgentRuntimeOptions (type alias)

Long-lived dependencies shared by agent invocations.

**Signature**

```ts
type AgentRuntimeOptions = AgentRuntimeBaseOptions & {
  readonly modelRegistry?: unknown;
};
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.types.ts#L80)

### AgentSteeringSource (interface)

Supplies queued steering messages to a running agent.

**Signature**

```ts
export interface AgentSteeringSource {
  readonly drain: () => MaybePromise<readonly string[]>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/runtime.types.ts#L18)

## `signal-deadline.ts`

Resolves the earliest authored deadline before the signal owner installs its
timer. Invalid timeout/deadline values preserve the existing public diagnostic.

### executionDeadline

Selects the earliest finite invocation deadline.

**Signature**

```ts
declare const executionDeadline: (options: ExecutionSignalOptions, now: number) => number;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal-deadline.ts#L13)

## `signal.ts`

Builds and validates RELKIT signal descriptors used by native agent execution while retaining their payload schema and stable identity.

### "./signal.types.js" (namespace export)

Re-exports all named exports from the "./signal.types.js" module.

**Signature**

```ts
export * from "./signal.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L15)

### ExecutionSignalClock (class)

Replaceable clock and timer boundary for execution deadlines.

**Example**

```ts
Effect.provide(createExecutionSignalEffect(options), ExecutionSignalClockLive);
```

**Signature**

```ts
declare class ExecutionSignalClock
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L20)

### ExecutionSignalClockLive

Live wall clock and timer implementation.

**Example**

```ts
Effect.runSync(Effect.provide(createExecutionSignalEffect(options), ExecutionSignalClockLive));
```

**Signature**

```ts
declare const ExecutionSignalClockLive: Layer.Layer<ExecutionSignalClock, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L28)

### acquireExecutionSignalEffect

Acquires an execution signal whose owner closes it with its Effect scope.

**Example**

```ts
Effect.scoped(
  Effect.gen(function* () {
    const active = yield* acquireExecutionSignalEffect(options);
  }),
);
```

**Signature**

```ts
declare const acquireExecutionSignalEffect: (
  options: ExecutionSignalOptions,
) => Effect.Effect<ExecutionSignalHandle, AgentInvocationFailure, ExecutionSignalClock | Scope>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L113)

### createExecutionSignal

Creates a live signal for existing callers that own and close the handle.

**Throws**

The original invalid deadline error.

**Example**

```ts
const active = createExecutionSignal(options);
try {
  await work(active.signal);
} finally {
  active.close();
}
```

**Signature**

```ts
declare const createExecutionSignal: (options: ExecutionSignalOptions) => ExecutionSignalHandle;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L127)

### createExecutionSignalEffect

Creates a live execution signal with an owned timer and caller listener.

**Example**

```ts
Effect.runSync(Effect.provide(createExecutionSignalEffect(options), testClock));
```

**Signature**

```ts
declare const createExecutionSignalEffect: (
  options: ExecutionSignalOptions,
) => Effect.Effect<ExecutionSignalHandle, AgentInvocationFailure, ExecutionSignalClock>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L66)

### signalFailure

Converts an abort reason for existing synchronous callers.

**Example**

```ts
signalFailure(signal);
```

**Signature**

```ts
declare const signalFailure: (signal: AbortSignal) => AgentRuntimeError;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L57)

### signalFailureEffect

Converts an abort reason to a safe invocation error.

**Example**

```ts
Effect.runSync(signalFailureEffect(signal));
```

**Signature**

```ts
declare const signalFailureEffect: (
  signal: AbortSignal,
) => Effect.Effect<AgentRuntimeError, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L42)

### withSignal

Races work with a caller signal for existing Promise callers.

**Throws**

The original work error or AgentRuntimeError on cancellation.

**Example**

```ts
await withSignal(fetchData(), signal);
```

**Signature**

```ts
declare const withSignal: <T>(work: MaybePromise<T>, signal: AbortSignal) => Promise<T>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L160)

### withSignalEffect

Races Promise work with caller and Effect cancellation.

**Example**

```ts
await Effect.runPromise(withSignalEffect(work, signal));
```

**Signature**

```ts
declare const withSignalEffect: <T>(
  work: MaybePromise<T>,
  signal: AbortSignal,
  linkEffectSignal?: boolean | undefined,
) => Effect.Effect<T, AgentInvocationFailure, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.ts#L143)

## `signal.types.ts`

Builds and validates RELKIT signal descriptors used by native agent execution while retaining their payload schema and stable identity. This companion preserves the native input and output types without starting runtime work.

### ExecutionSignalClockService (interface)

Replaceable deadline timer and current time boundary.

**Signature**

```ts
export interface ExecutionSignalClockService {
  /** Reads the current wall time in milliseconds.
   * @returns Epoch milliseconds.
   * @example clock.now();
   */
  readonly now: () => number;
  /** Schedules a deadline callback.
   * @param callback - Deadline action.
   * @param delayMs - Nonnegative delay.
   * @returns Opaque timer handle.
   * @example clock.setTimeout(onDeadline, 1000);
   */
  readonly setTimeout: (callback: () => void, delayMs: number) => unknown;
  /** Cancels a scheduled callback.
   * @param handle - Opaque timer handle.
   * @returns Nothing.
   * @example clock.clearTimeout(handle);
   */
  readonly clearTimeout: (handle: unknown) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.types.ts#L19)

### ExecutionSignalHandle (interface)

Live execution signal whose owner must call close once finished.

**Signature**

```ts
export interface ExecutionSignalHandle {
  readonly signal: AbortSignal;
  /** Clears the deadline timer and caller signal listener.
   * @returns Nothing; repeated calls are safe.
   * @example handle.close();
   */
  readonly close: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.types.ts#L9)

### ExecutionSignalOptions (type alias)

Options whose limits and caller signal determine an execution deadline.

**Signature**

```ts
type ExecutionSignalOptions = AgentRuntimeOptions & AgentInvocationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/signal.types.ts#L6)

## `agent-approvals.ts`

Owns native pending decisions and cancellation listeners for one test agent.
Settlement removes its listener before completing the same deferred decision.

### createAgentApprovalState

Creates isolated native approval controls.

**Signature**

```ts
declare const createAgentApprovalState: (
  choice: TestAgentApproval | undefined,
) => AgentApprovalState;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-approvals.ts#L14)

## `agent-approvals.types.ts`

Exercises native agent approval continuations through the harness's scoped model and execution owner, retaining resume identity and cleanup. This companion preserves the native input and output types without starting runtime work.

### AgentApprovalOwnedState (interface)

Native callback state retained by one test approval owner.

**Signature**

```ts
export interface AgentApprovalOwnedState {
  readonly pending: Map<string, import("../index.js").PendingApproval>;
  readonly decisions: Map<string, PendingAgentDecision>;
  readonly signals: Map<string, AbortSignal>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-approvals.types.ts#L23)

### AgentApprovalState (interface)

Synchronous controls over owned native approval decisions and cancellation.

**Signature**

```ts
export interface AgentApprovalState extends TestAgentApprovals {
  readonly handler?: AgentApprovalHandler;
  readonly reset: () => void;
  readonly registerSignal: (id: string, signal: AbortSignal) => void;
  readonly releaseSignal: (id: string) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-approvals.types.ts#L15)

### PendingAgentDecision (interface)

Deferred decision authority and its native cancellation listener.

**Signature**

```ts
export interface PendingAgentDecision {
  readonly done: Deferred.Deferred<"approved" | "denied">;
  readonly signal?: AbortSignal;
  readonly abort: () => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-approvals.types.ts#L8)

## `agent-harness.types.ts`

Defines the native test harness execution and lifecycle contract shared by model, tool and approval helpers. This companion preserves the native input and output types without starting runtime work.

### AgentHarnessDependencies (type alias)

Acquired native model, state and observer dependencies for one harness owner.

**Signature**

```ts
type AgentHarnessDependencies = Effect.Success<ReturnType<typeof acquireAgentHarness>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-harness.types.ts#L10)

### AgentHarnessService (interface)

Native state facade and Effect-owned invocation/shutdown workflows.

**Signature**

```ts
export interface AgentHarnessService {
  readonly close: Effect.Effect<void, unknown>;
  readonly value: Omit<TestAgent, "invoke">;
  readonly invoke: (
    input: unknown,
    invocation?: TestAgentInvocationOptions,
  ) => Effect.Effect<unknown, unknown>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-harness.types.ts#L24)

### AgentOwnedState (interface)

Trace ledgers and native work belong to the same agent owner.

**Signature**

```ts
export interface AgentOwnedState {
  closed: boolean;
  invocationSequence: number;
  readonly spans: ReturnType<typeof spanSnapshot>[];
  readonly edges: AgentObservedEdge[];
  readonly active: Set<AbortController>;
  readonly pending: Set<Promise<unknown>>;
  closing?: Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-harness.types.ts#L13)

## `agent-state-invocation.ts`

Runs native invocations under the harness-owned span and cancellation lifetime.

### invokeAgentHarness

**Signature**

```ts
declare const invokeAgentHarness: <Agent extends TestAgentDescriptor>(
  options: TestAgentOptions<Agent>,
  harness: AgentHarnessDependencies,
  input: import("@relkit/schema").InferInput<Agent["input"]>,
  invocation?: TestAgentInvocationOptions,
) => Promise<import("@relkit/schema").InferOutput<Agent["output"]>>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-state-invocation.ts#L13)

## `agent-state-lifecycle.ts`

Stops admission before aborting and joining every native invocation and model owner.

### agentHarnessClose

**Signature**

```ts
declare const agentHarnessClose: (
  context: Context.Context<never>,
  harness: AgentHarnessDependencies,
) => Effect.Effect<void, unknown, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-state-lifecycle.ts#L6)

### resetAgentHarness

**Signature**

```ts
declare const resetAgentHarness: (harness: AgentHarnessDependencies) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-state-lifecycle.ts#L38)

## `agent-state-setup.ts`

Acquires one native test model and its trace, approval and cancellation state.

### acquireAgentHarness

**Signature**

```ts
declare const acquireAgentHarness: (
  options: TestAgentOptions<TestAgentDescriptor>,
) => Effect.Effect<
  {
    failures: TestFailureControls;
    model: RuntimeTestAgentModel;
    state: Ref.Ref<AgentOwnedState>;
    approvals: AgentApprovalState;
    trace: TestAgentTrace;
    hooks: AgentRuntimeHooks;
    spanRuntime: SpanRuntime;
    engine: {
      invoke: (
        request: Parameters<(options: ToolEngineInvocation) => Promise<unknown>>[0],
      ) => Promise<unknown>;
    };
  },
  never,
  Scope
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-state-setup.ts#L11)

## `agent-state.ts`

Builds an isolated native test facade whose work is joined before release.

### createAgentState

Creates a network-free test owner retaining descriptor schema inference.

**Signature**

```ts
declare const createAgentState: <Agent extends TestAgentDescriptor>(
  options: TestAgentOptions<Agent>,
) => Effect.Effect<
  { value: TestAgent<Agent>; close: Effect.Effect<void, unknown, never> },
  never,
  Scope
>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agent-state.ts#L13)

## `agents-model-native.ts`

Implements the scripted native chat-model adapter used by agent tests, preserving tool-call correlation and queued response ordering.

### ScriptedChatModel (class)

Native LangChain model transport; script and cancellation remain owned by TestModelScript.

**Signature**

```ts
declare class ScriptedChatModel { constructor(
    private readonly turn: (
      request: TestAgentModelCall["request"],
      signal?: AbortSignal,
    ) => Promise<TestModelTurn>,
    private readonly provider: string,
    private readonly modelId: string,
  ) }
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model-native.ts#L15)

### \_llmType (method)

**Signature**

```ts
declare const _llmType: () => string;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model-native.ts#L36)

### bindTools (method)

Records native presented tools for script-to-tool name matching.

**Signature**

```ts
declare const bindTools: (tools: BindToolsInput[]) => this;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model-native.ts#L45)

### \_generate (method)

Consumes one owned scripted turn using the native invocation signal.

**Signature**

```ts
declare const _generate: (
  messages: BaseMessage[],
  _options?: this["ParsedCallOptions"],
  _runManager?: CallbackManagerForLLMRun,
) => Promise<ChatResult>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model-native.ts#L57)

## `agents-model-operations.ts`

Applies scripted native turns under the test model owner's cancellation state.
Reset, replacement and detached evidence retain their existing ordering.

### modelScriptReplaceEffect

Replaces scripted decisions after resetting active work.

**Signature**

```ts
declare const modelScriptReplaceEffect: (
  state: Ref.Ref<ModelScriptOwnedState>,
  reset: Effect.Effect<void>,
  turns: readonly TestModelTurn[],
) => Effect.Effect<undefined, TypeError, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model-operations.ts#L35)

### modelScriptResetEffect

Cancels active requests and clears this model's script position/evidence.

**Signature**

```ts
declare const modelScriptResetEffect: (
  state: Ref.Ref<ModelScriptOwnedState>,
) => Effect.Effect<void, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model-operations.ts#L15)

### modelScriptTurnEffect

Executes a turn through the original observed native cancellation boundary.

**Signature**

```ts
declare const modelScriptTurnEffect: (
  state: Ref.Ref<ModelScriptOwnedState>,
  options: TestAgentModelOptions,
  request: TestAgentModelCall["request"],
  signal?: AbortSignal,
) => Effect.Effect<TestModelTurn, unknown, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model-operations.ts#L59)

## `agents-model.ts`

Constructs deterministic native test models from scripted steps and exposes their observed calls for invocation assertions.

### TestModelScript (class)

Stateful scripted turns and cancellation belong to one model owner.

**Signature**

```ts
declare class TestModelScript
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model.ts#L66)

### createTestModel

Creates an isolated scripted native language model without network access.

**See**

- tests/fixtures/checked-examples.ts ownedHelpersExample for checked script ownership.

**Signature**

```ts
declare const createTestModel: (
  options?: TestAgentModelOptions & { readonly script?: readonly TestModelTurn[] },
) => RuntimeTestAgentModel;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model.ts#L28)

### modelScriptLayer

Builds a network-free script service with cooperative native cancellation.

**Signature**

```ts
declare const modelScriptLayer: (
  options?: TestAgentModelOptions,
) => Layer.Layer<TestModelScript, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model.ts#L75)

## `agents-model.types.ts`

Constructs deterministic native test models from scripted steps and exposes their observed calls for invocation assertions. This companion preserves the native input and output types without starting runtime work.

### ModelScriptOwnedState (interface)

Script index, detached evidence and cancellation owners for one model.

**Signature**

```ts
export interface ModelScriptOwnedState {
  turns: readonly TestModelTurn[];
  next: number;
  readonly calls: TestAgentModelCall[];
  readonly active: Set<AbortController>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model.types.ts#L25)

### ModelScriptService (interface)

Effect script state, detached call capture and cancellable native turn decisions.

**Signature**

```ts
export interface ModelScriptService {
  readonly turn: (
    request: TestAgentModelCall["request"],
    signal?: AbortSignal,
  ) => Effect.Effect<TestModelTurn, unknown>;
  readonly script: (turns: readonly TestModelTurn[]) => Effect.Effect<void, unknown>;
  readonly reset: Effect.Effect<void>;
  readonly calls: Effect.Effect<readonly TestAgentModelCall[]>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model.types.ts#L9)

### RuntimeTestAgentModel (interface)

Native LangChain-compatible scripted model with owned release.

**Signature**

```ts
export interface RuntimeTestAgentModel extends TestAgentModel {
  readonly languageModel: BaseChatModel;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-model.types.ts#L20)

## `agents-types.ts`

Preserved compatibility entrypoint for the canonical domain type companion.

### "./agents.types.js" (namespace export)

Re-exports all named exports from the "./agents.types.js" module.

**Signature**

```ts
export * from "./agents.types.js";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-types.ts#L2)

## `agents-utils.ts`

Normalizes scripted native test values and observations for the agent harness without starting a separate execution owner.

### assertAgentTrace

Asserts selected native agent trace fields in their observed order.

**Signature**

```ts
declare const assertAgentTrace: (
  trace: TestAgentTraceSnapshot,
  expected: TestAgentTraceExpectation,
) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-utils.ts#L17)

### captureHooks

Records observed agent edges while forwarding the caller's native hooks.

**Signature**

```ts
declare const captureHooks: (
  hooks: AgentRuntimeHooks | undefined,
  edges: AgentObservedEdge[],
) => AgentRuntimeHooks;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-utils.ts#L83)

### createTrace

Creates isolated trace capture and the existing assertion facade.

**Signature**

```ts
declare const createTrace: (
  spans: ReturnType<typeof spanSnapshot>[],
  edges: AgentObservedEdge[],
) => TestAgentTrace;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents-utils.ts#L56)

## `agents.ts`

Publishes the native agent test harness helpers from the explicit integration while sharing RELKIT testing ownership and clock boundaries.

### TestAgent

**Signature**

```ts
declare const TestAgent: TestAgent<Agent>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L27)

### TestAgentApproval

**Signature**

```ts
declare const TestAgentApproval: TestAgentApproval;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L28)

### TestAgentApprovalMode

**Signature**

```ts
declare const TestAgentApprovalMode: TestAgentApprovalMode;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L29)

### TestAgentApprovals

**Signature**

```ts
declare const TestAgentApprovals: TestAgentApprovals;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L30)

### TestAgentDescriptor

**Signature**

```ts
declare const TestAgentDescriptor: TestAgentDescriptor;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L31)

### TestAgentHarness (class)

Agent decisions, approval ownership and scripted invocation share one service.

**Signature**

```ts
declare class TestAgentHarness
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L46)

### TestAgentInvocationOptions

**Signature**

```ts
declare const TestAgentInvocationOptions: TestAgentInvocationOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L32)

### TestAgentModel

**Signature**

```ts
declare const TestAgentModel: TestAgentModel;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L33)

### TestAgentModelCall

**Signature**

```ts
declare const TestAgentModelCall: TestAgentModelCall;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L34)

### TestAgentModelOptions

**Signature**

```ts
declare const TestAgentModelOptions: TestAgentModelOptions;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L35)

### TestAgentOptions

**Signature**

```ts
declare const TestAgentOptions: TestAgentOptions<Agent>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L36)

### TestAgentTrace

**Signature**

```ts
declare const TestAgentTrace: TestAgentTrace;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L37)

### TestAgentTraceExpectation

**Signature**

```ts
declare const TestAgentTraceExpectation: TestAgentTraceExpectation;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L38)

### TestAgentTraceSnapshot

**Signature**

```ts
declare const TestAgentTraceSnapshot: TestAgentTraceSnapshot;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L39)

### TestModelTurn

**Signature**

```ts
declare const TestModelTurn: TestModelTurn;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L40)

### assertAgentTrace

**Signature**

```ts
declare const assertAgentTrace: (
  trace: TestAgentTraceSnapshot,
  expected: TestAgentTraceExpectation,
) => void;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L42)

### createTestAgent

Creates isolated agent state with native model cancellation and owned approvals.

**Signature**

```ts
declare const createTestAgent: <Agent extends TestAgentDescriptor>(
  options: TestAgentOptions<Agent>,
) => TestAgent<Agent>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L101)

### createTestModel

**Signature**

```ts
declare const createTestModel: (
  options?: TestAgentModelOptions & { readonly script?: readonly TestModelTurn[] },
) => RuntimeTestAgentModel;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L43)

### testAgentLayer

Acquires the network-free harness behind the public synchronous factory.

**Signature**

```ts
declare const testAgentLayer: <Agent extends TestAgentDescriptor>(
  options: TestAgentOptions<Agent>,
) => Layer.Layer<TestAgentHarness, never, never>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.ts#L56)

## `agents.types.ts`

Publishes the native agent test harness helpers from the explicit integration while sharing RELKIT testing ownership and clock boundaries. This companion preserves the native input and output types without starting runtime work.

### TestAgent (interface)

Owned native agent facade preserving schema inference, approvals and trace evidence.

**Signature**

```ts
export interface TestAgent<Agent extends TestAgentDescriptor = TestAgentDescriptor> {
  readonly model: TestAgentModel;
  readonly failures: TestFailureControls;
  readonly approvals: TestAgentApprovals;
  readonly pending: () => readonly PendingApproval[];
  readonly trace: TestAgentTrace;
  readonly script: (turns: readonly TestModelTurn[]) => void;
  readonly invoke: (
    input: InferInput<Agent["input"]>,
    options?: TestAgentInvocationOptions,
  ) => Promise<InferOutput<Agent["output"]>>;
  readonly reset: () => void;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L127)

### TestAgentApproval (type alias)

Fixed, pending or caller-native approval decision authority.

**Signature**

```ts
type TestAgentApproval = TestAgentApprovalMode | AgentApprovalHandler;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L25)

### TestAgentApprovalMode (type alias)

Fixed or pending native approval policy vocabulary.

**Signature**

```ts
type TestAgentApprovalMode = "approved" | "denied" | "pending";
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L22)

### TestAgentApprovals (interface)

Synchronous selection controls over owned pending native decisions.

**Signature**

```ts
export interface TestAgentApprovals {
  readonly pending: () => readonly PendingApproval[];
  readonly approve: (toolCallId?: string) => void;
  readonly deny: (toolCallId?: string) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L117)

### TestAgentDescriptor (type alias)

Native agent descriptor vocabulary retained by public test inference.

**Signature**

```ts
type TestAgentDescriptor = AgentDescriptor<string, unknown, unknown>;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L19)

### TestAgentInvocationOptions (type alias)

Invocation-only native overrides excluding owned model and engine dependencies.

**Signature**

```ts
type TestAgentInvocationOptions = Omit<AgentInvocationOptions, "input" | "approval" | "hooks">;
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L91)

### TestAgentModel (interface)

Public model facade owning script mutation, capture and release.

**Signature**

```ts
export interface TestAgentModel {
  readonly provider: string;
  readonly modelId: string;
  readonly calls: readonly TestAgentModelCall[];
  readonly script: (turns: readonly TestModelTurn[]) => void;
  readonly reset: () => void;
  readonly close: () => Promise<void>;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L60)

### TestAgentModelCall (interface)

Detached native request and scripted turn evidence captured in order.

**Signature**

```ts
export interface TestAgentModelCall {
  readonly index: number;
  readonly request: {
    readonly messages: readonly unknown[];
    readonly tools: readonly unknown[];
  };
  readonly turn: TestModelTurn;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L50)

### TestAgentModelOptions (interface)

Network-free model identity, hanging behavior and explicit logging policy.

**Signature**

```ts
export interface TestAgentModelOptions {
  readonly logger?: NonNullable<
    Parameters<typeof import("@relkit/testing/internal/testing-owner").testingLoggerLayer>[0]
  >;
  readonly provider?: string;
  readonly modelId?: string;
  readonly hang?: boolean;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L40)

### TestAgentOptions (interface)

Native agent, tool engine, model script and capture dependencies.

**Signature**

```ts
export interface TestAgentOptions<Agent extends TestAgentDescriptor = TestAgentDescriptor> {
  readonly logger?: NonNullable<
    Parameters<typeof import("@relkit/testing/internal/testing-owner").testingLoggerLayer>[0]
  >;
  readonly agent: Agent;
  readonly tools: AgentRuntimeOptions["tools"];
  readonly engine: AgentRuntimeOptions["engine"];
  readonly script?: readonly TestModelTurn[];
  readonly model?: TestAgentModelOptions;
  readonly maxInputBytes?: number;
  readonly maxOutputBytes?: number;
  readonly approval?: TestAgentApproval;
  readonly failures?: TestFailureControls;
  readonly hooks?: AgentRuntimeHooks;
  readonly capture?: AgentCapturePolicy;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L73)

### TestAgentTrace (interface)

Owned trace evidence with explicit read, clear and assertion operations.

**Signature**

```ts
export interface TestAgentTrace extends TestAgentTraceSnapshot {
  readonly read: () => TestAgentTraceSnapshot;
  readonly clear: () => void;
  readonly assert: (expected: TestAgentTraceExpectation) => void;
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L103)

### TestAgentTraceExpectation (interface)

Selected span, outcome and tool-edge evidence checked by trace assertions.

**Signature**

```ts
export interface TestAgentTraceExpectation {
  readonly spanKinds?: readonly ReturnType<typeof spanSnapshot>["kind"][];
  readonly names?: readonly string[];
  readonly edges?: readonly AgentObservedEdge[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L110)

### TestAgentTraceSnapshot (interface)

Detached observed span and edge evidence for a test invocation.

**Signature**

```ts
export interface TestAgentTraceSnapshot {
  readonly spans: readonly ReturnType<typeof spanSnapshot>[];
  readonly edges: readonly AgentObservedEdge[];
}
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L97)

### TestModelTurn (type alias)

Scripted native model outcome supporting final values, tool calls and failures.

**Signature**

```ts
type TestModelTurn =
  | {
      readonly type: "tool-call";
      readonly callId: string;
      readonly toolId: string;
      readonly input: JsonValue;
    }
  | { readonly type: "final"; readonly output: JsonValue }
  | { readonly type: "error"; readonly code: string; readonly message: string }
  | { readonly type: "cancelled"; readonly reason?: string };
```

[Source](https://github.com/rel-kit/relkit/blob/main/integrations/packages/langchain/src/testing/agents.types.ts#L28)
