agentic-flow 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,9 +3,24 @@ import Anthropic from '@anthropic-ai/sdk';
|
|
|
3
3
|
import { logger } from '../utils/logger.js';
|
|
4
4
|
import { withRetry } from '../utils/retry.js';
|
|
5
5
|
import { execSync } from 'child_process';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// Lazy initialize Anthropic client to allow runtime API key validation
|
|
7
|
+
let anthropic = null;
|
|
8
|
+
function getAnthropicClient() {
|
|
9
|
+
if (!anthropic) {
|
|
10
|
+
const apiKey = process.env.ANTHROPIC_API_KEY;
|
|
11
|
+
// Validate API key format
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
throw new Error('ANTHROPIC_API_KEY is required but not set');
|
|
14
|
+
}
|
|
15
|
+
if (!apiKey.startsWith('sk-ant-')) {
|
|
16
|
+
throw new Error(`Invalid ANTHROPIC_API_KEY format. Expected format: sk-ant-...\n` +
|
|
17
|
+
`Got: ${apiKey.substring(0, 10)}...\n\n` +
|
|
18
|
+
`Please check your API key at: https://console.anthropic.com/settings/keys`);
|
|
19
|
+
}
|
|
20
|
+
anthropic = new Anthropic({ apiKey });
|
|
21
|
+
}
|
|
22
|
+
return anthropic;
|
|
23
|
+
}
|
|
9
24
|
// Define claude-flow tools as native Anthropic tool definitions
|
|
10
25
|
const claudeFlowTools = [
|
|
11
26
|
{
|
|
@@ -179,7 +194,8 @@ export async function directApiAgent(agent, input, onStream) {
|
|
|
179
194
|
// Agentic loop: keep calling API until no more tool uses
|
|
180
195
|
while (toolUseCount < maxToolUses) {
|
|
181
196
|
logger.debug('API call iteration', { toolUseCount, messagesLength: messages.length });
|
|
182
|
-
const
|
|
197
|
+
const client = getAnthropicClient();
|
|
198
|
+
const response = await client.messages.create({
|
|
183
199
|
model: 'claude-sonnet-4-5-20250929',
|
|
184
200
|
max_tokens: 8192,
|
|
185
201
|
system: agent.systemPrompt || 'You are a helpful AI assistant.',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-flow",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Production-ready AI agent orchestration platform with 66 specialized agents, 111 MCP tools, and autonomous multi-agent swarms. Built by @ruvnet with Claude Agent SDK, neural networks, memory persistence, GitHub integration, and distributed consensus protocols.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|