@ agnt- sdk/ 配置
共享配置加载器 @agnt-sdk 软件包家庭.
所有 SDK 软件包都从同一处读取 agnt.config.js (或 agnt.config.ts)档案. 此软件包提供了类型定义和从目录树上走出的文件发现逻辑 process.cwd() 直到它找到配置文件——ESLint和TypeScript等工具使用的同一种常规.
安装
npm install @agnt-sdk/config
你通常不需要直接安装这个——这是对等的依赖性 @agnt-sdk/client 财务报告和审定财务报表 @agnt-sdk/studio。 。 。 .
配置文件
创建 agnt.config.js 在您的项目根部 :
// agnt.config.js
export default {
// Required by @agnt-sdk/client
privateKey: `-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhk...
-----END PRIVATE KEY-----`,
kid: 'your-key-id', // Key ID from the Agnt dashboard → Certificates
// Required by all packages
apiUrl: 'https://api.agnt.ai',
// Required by @agnt-sdk/studio
serviceKey: '', // Optional: for private/unlisted prompts
outputDir: './agnt/prompts', // Where pulled manifests are saved
apiMode: false, // true = always fetch from API; false = use local files
};
使用量
import { loadConfig } from '@agnt-sdk/config';
import type { AgntConfig } from '@agnt-sdk/config';
const config: AgntConfig = await loadConfig();
覆盖搜索路径
const config = await loadConfig('/path/to/project');
直接通过配置( 不需要文件)
所有 SDK 软件包接受可选 config 绕过文件发现的参数——在没有配置文件的无服务器环境中有用:
const client = await AgntClient.create({
config: {
privateKey: process.env.AGNT_PRIVATE_KEY,
kid: process.env.AGNT_KID,
apiUrl: 'https://api.agnt.ai',
}
});
AgntConfig 类型参考
interface AgntConfig {
/** RSA private key PEM — used by @agnt-sdk/client for RS256 JWT signing */
privateKey?: string;
/** Key ID registered on the Agnt platform — included in JWT header */
kid?: string;
/** Agnt API base URL, e.g. 'https://api.agnt.ai' */
apiUrl: string;
/** Service key for accessing private/unlisted prompts (@agnt-sdk/studio) */
serviceKey: string;
/** Directory where pulled manifest files are saved (@agnt-sdk/studio) */
outputDir: string;
/** true = fetch manifests from API on every execution (@agnt-sdk/studio) */
apiMode: boolean;
/** Max messages in agent loop before throwing — prevents infinite loops */
maxMessages?: number;
}
许可证
麻省理工学院