Skip to main content
Glama
agent.ts5.88 kB
import { RpcProvider } from 'starknet'; import { BaseChatModel } from '@langchain/core/language_models/chat_models'; import { z as Zod } from 'zod'; export type Modify<T, R> = Omit<T, keyof R> & R; export interface StarknetTool<P = unknown> { name: string; plugins: string; description: string; schema?: Zod.AnyZodObject; response_format?: string; execute: (agent: any, params: P, plugins_manager?: any) => Promise<unknown>; } export interface ModelConfig { provider: string; model_name: string; description?: string; temperature: number; max_tokens: number; } /** * Agent profile configuration containing descriptive information */ export interface AgentProfile { name: string; group: string; description: string; contexts: string[]; } /** * Prompt configuration for various agent tasks */ export interface AgentPrompts { id: string; } export interface AgentPromptsInitialized<T> { task_memory_manager_prompt: T; task_executor_prompt: T; task_manager_prompt: T; task_verifier_prompt: T; // Add resolved prompts or other runtime data as needed } /** * Graph execution configuration */ export interface GraphConfig { max_steps: number; max_iterations: number; max_retries: number; execution_timeout_ms: number; max_token_usage: number; model: ModelConfig; } /** * Initialized graph configuration with runtime data */ export type GraphConfigInitialized = Modify< GraphConfig, { model: BaseChatModel; } >; /** * * Memory Strategy enum */ export enum MemoryStrategy { // Will be implemented later HOLISTIC = 'holistic', // Perfect for interactive agent or autonomus agent with a short-life CATEGORIZED = 'categorized', // Perfect for long-life autonomous agent } /** * Memory thresholds configuration */ export interface MemoryThresholds { insert_semantic_threshold: number; insert_episodic_threshold: number; retrieve_memory_threshold: number; hitl_threshold: number; } /** * Memory size limits configuration */ export interface MemorySizeLimits { short_term_memory_size: number; max_insert_episodic_size: number; max_insert_semantic_size: number; max_retrieve_memory_size: number; limit_before_summarization: number; } /** * Memory timeout configuration */ export interface MemoryTimeouts { retrieve_memory_timeout_ms: number; insert_memory_timeout_ms: number; } /** * Memory configuration for the agent */ export interface MemoryConfig { ltm_enabled: boolean; size_limits: MemorySizeLimits; thresholds: MemoryThresholds; timeouts: MemoryTimeouts; strategy: MemoryStrategy; } /** * RAG (Retrieval-Augmented Generation) configuration */ export interface RAGConfig { enabled?: boolean; top_k?: number; } export interface McpServerConfig { command?: string; args?: string[]; env?: Record<string, string>; } export enum Id { NoId = 'NoId', Id = 'Id', } /** * Agent configuration namespace providing clean separation between input and runtime types */ export namespace AgentConfig { /** * Base configuration properties shared across all agent config types */ interface Base { profile: AgentProfile; mcp_servers: Record<string, any>; memory: MemoryConfig; rag: RAGConfig; } /** * Input configuration for creating agents */ export interface Input extends Base { prompts_id?: string; graph: GraphConfig; } /** * Input configuration with optional parameters for updates */ export interface InputWithOptionalParam extends Partial<Input> { id: string; user_id?: string; } /** * Input configuration with ID for existing agents */ export interface OutputWithId extends Input { id: string; prompts_id: string; user_id: string; } export interface OutputWithoutUserId extends Omit<OutputWithId, 'user_id'> { user_id?: string; } /** * Output configuration with optional parameters for updates */ export interface OutputWithOptionalParam extends Partial<OutputWithId> { user_id: string; id: string; } /** * Runtime configuration with initialized/resolved data~ */ export interface Runtime extends Base { id: string; user_id: string; prompts: AgentPromptsInitialized<string>; graph: GraphConfigInitialized; } /** * Helper type for ID handling */ export type WithOptionalId<HasId extends Id = Id.NoId> = HasId extends Id.Id ? OutputWithId : Input; } export interface StarknetConfig { provider: RpcProvider; accountPublicKey: string; accountPrivateKey: string; } export interface DatabaseCredentials { host: string; port: number; user: string; password: string; database: string; } // TODO REMOVE WHEN REMOVED PLUGINS /** * @interface SnakAgentInterface * @description Interface for the Starknet agent * @property {() => { accountPublicKey: string; accountPrivateKey: string; }} getAccountCredentials - Function to get the account credentials * @property {() => DatabaseCredentials} getDatabaseCredentials - Function to get the database credentials * @property {() => RpcProvider} getProvider - Function to get the provider * @property {() => AgentConfigInput} getAgentConfig - Function to get the agent configuration * @property {(database_name: string) => Promise<void>} connectDatabase - Function to connect to a database * @property {(database_name: string) => Promise<PostgresAdaptater | undefined>} createDatabase - Function to create a database * @property {(name: string) => PostgresAdaptater | undefined} getDatabaseByName - Function to get a database by name */ export interface SnakAgentInterface { getAccountCredentials: () => { accountPublicKey: string; accountPrivateKey: string; }; getDatabaseCredentials: () => DatabaseCredentials; getProvider: () => RpcProvider; getAgentConfig: () => AgentConfig.Input; }

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KasarLabs/snak'

If you have feedback or need assistance with the MCP directory API, please join our Discord server