Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/langchain/src/langgraph-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import type { BaseChatModel } from '@langchain/core/language_models/chat_models'
import type { BaseMessage } from '@langchain/core/messages';
import { HumanMessage, SystemMessage, AIMessage } from '@langchain/core/messages';
import type { Embeddings } from '@langchain/core/embeddings';
import { AgentToolProtocolServer } from '@mondaydotcomorg/atp-server';

/**
* Approval request that needs human decision
Expand All @@ -44,8 +45,10 @@ export interface ApprovalResponse {
* Options for creating the LangGraph ATP client
*/
export interface LangGraphATPClientOptions {
/** Base URL of ATP server */
serverUrl: string;
/** ATP server instance */
server?: AgentToolProtocolServer;
/** Base URL of ATP server used for http server (not inProcess) */
serverUrl?: string;
/** Custom headers for authentication (e.g., { Authorization: 'Bearer token' }) */
headers?: Record<string, string>;
/** LangChain LLM for atp.llm.call() sampling */
Expand Down Expand Up @@ -121,6 +124,7 @@ export class LangGraphATPClient {

constructor(options: LangGraphATPClientOptions) {
const {
server,
serverUrl,
headers,
llm,
Expand All @@ -132,7 +136,8 @@ export class LangGraphATPClient {
} = options;

this.client = new AgentToolProtocolClient({
baseUrl: serverUrl,
server,
baseUrl: serverUrl,
headers,
hooks,
serviceProviders: tools ? { tools } : undefined,
Expand Down
11 changes: 5 additions & 6 deletions packages/langchain/src/langgraph-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ import { ExecutionStatus, type ExecutionConfig } from '@mondaydotcomorg/atp-prot
/**
* Options for creating ATP tools with LangGraph integration
*/
export interface CreateATPToolsOptions extends Omit<LangGraphATPClientOptions, 'serverUrl'> {
/** ATP server URL */
serverUrl: string;
export interface CreateATPToolsOptions extends LangGraphATPClientOptions {
/**
* Default execution config for all ATP code executions
*/
Expand Down Expand Up @@ -83,11 +81,12 @@ export interface ATPToolsResult {
* ```
*/
export async function createATPTools(options: CreateATPToolsOptions): Promise<ATPToolsResult> {
const { serverUrl, defaultExecutionConfig, ...clientOptions } = options;
const { serverUrl, server, defaultExecutionConfig, ...clientOptions } = options;

const client = new LangGraphATPClient({
serverUrl,
...clientOptions,
server,
serverUrl,
...clientOptions,
});

await client.connect();
Expand Down
2 changes: 1 addition & 1 deletion packages/langchain/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**/*.test.ts"],
"references": [{ "path": "../protocol" }, { "path": "../client" }, { "path": "../runtime" }]
"references": [{ "path": "../protocol" }, { "path": "../client" }, { "path": "../runtime" }, { "path": "../server" }]
}
Loading