UNPKG

@xynehq/jaf

Version:

Juspay Agent Framework - A purely functional agent framework with immutable state and composable tools

38 lines 2.5 kB
/** * Pure functional A2A agent creation utilities * No classes, only pure functions and immutable data */ import { z } from 'zod'; import type { A2AAgent, A2AAgentTool, ToolContext, A2AToolResult, AgentState, StreamEvent } from './types.js'; import { type RunState, type Message, type Agent, type Tool, type RunConfig } from '../core/types.js'; export declare const createA2AAgent: (config: { readonly name: string; readonly description: string; readonly instruction: string; readonly tools: readonly A2AAgentTool[]; readonly supportedContentTypes?: readonly string[]; }) => A2AAgent; export declare const createA2ATool: <T>(config: { readonly name: string; readonly description: string; readonly parameters: z.ZodType<T>; readonly execute: (args: T, context?: ToolContext) => Promise<any | A2AToolResult>; }) => A2AAgentTool; export declare const getProcessingMessage: (agentName: string) => string; export declare const createInitialAgentState: (sessionId: string) => AgentState; export declare const addMessageToState: (state: AgentState, message: any) => AgentState; export declare const updateStateFromRunResult: (state: AgentState, outcome: any) => AgentState; export declare const createUserMessage: (text: string) => Message; export declare const transformA2AAgentToJAF: (a2aAgent: A2AAgent) => Agent<any, string>; export declare const transformA2AToolToJAF: (a2aTool: A2AAgentTool) => Tool<any, any>; export declare const createRunConfigForA2AAgent: (a2aAgent: A2AAgent, modelProvider: any) => RunConfig<any>; export declare const transformToRunState: (state: AgentState, agentName: string, context?: any) => RunState<any>; export declare const processAgentQuery: (agent: A2AAgent, query: string, state: AgentState, modelProvider: any) => AsyncGenerator<StreamEvent, void, unknown>; export declare const extractTextFromA2AMessage: (message: any) => string; export declare const createA2ATextMessage: (text: string, contextId: string, taskId?: string) => any; export declare const createA2ADataMessage: (data: Record<string, any>, contextId: string, taskId?: string) => any; export declare const createA2ATask: (message: any, contextId?: string) => any; export declare const updateA2ATaskStatus: (task: any, state: any, message?: any) => any; export declare const addArtifactToA2ATask: (task: any, parts: readonly any[], name: string) => any; export declare const completeA2ATask: (task: any, result?: any) => any; //# sourceMappingURL=agent.d.ts.map