art-framework 0.3.0 → 0.3.1
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.
- package/README.md +75 -59
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ✨ ART: Agentic Runtime Framework <img src="https://img.shields.io/badge/Version-v0.
|
|
1
|
+
# ✨ ART: Agentic Runtime Framework <img src="https://img.shields.io/badge/Version-v0.3.1-blue" alt="Version 0.3.1">
|
|
2
2
|
|
|
3
3
|
**ART is a powerful, modular, and browser-first TypeScript framework for building sophisticated LLM-powered agents capable of complex reasoning, planning, and tool usage.**
|
|
4
4
|
|
|
@@ -67,69 +67,85 @@ yarn add art-framework
|
|
|
67
67
|
|
|
68
68
|
## Quick Start
|
|
69
69
|
|
|
70
|
-
This example demonstrates setting up a simple agent that uses OpenAI
|
|
70
|
+
This example demonstrates setting up a simple agent that uses OpenAI and runs in-memory. For a complete example with all configurations, see the [Comprehensive Developer Guide](./docs/README.md).
|
|
71
71
|
|
|
72
72
|
```typescript
|
|
73
|
-
import {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
73
|
+
import {
|
|
74
|
+
createArtInstance,
|
|
75
|
+
ArtInstanceConfig,
|
|
76
|
+
ThreadConfig,
|
|
77
|
+
CalculatorTool,
|
|
78
|
+
OpenAIAdapter,
|
|
79
|
+
GeminiAdapter
|
|
80
|
+
} from 'art-framework';
|
|
81
|
+
|
|
82
|
+
// --- 1. Configure the ART Instance ---
|
|
83
|
+
// Note: No API keys or secrets are present here.
|
|
84
|
+
|
|
85
|
+
const artConfig: ArtInstanceConfig = {
|
|
86
|
+
storage: {
|
|
87
|
+
type: 'indexedDB',
|
|
88
|
+
dbName: 'MyCorrectChatDB'
|
|
89
|
+
},
|
|
90
|
+
providers: {
|
|
91
|
+
availableProviders: [
|
|
92
|
+
{ name: 'openai', adapter: OpenAIAdapter },
|
|
93
|
+
{ name: 'gemini', adapter: GeminiAdapter }
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
tools: [new CalculatorTool()],
|
|
97
|
+
persona: {
|
|
98
|
+
name: 'ConfigExpert',
|
|
99
|
+
prompts: {
|
|
100
|
+
synthesis: 'You explain configurations clearly.'
|
|
102
101
|
}
|
|
102
|
+
},
|
|
103
|
+
logger: { level: 'info' }
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
// --- 2. Main Application Logic ---
|
|
108
|
+
|
|
109
|
+
async function initializeAndRun() {
|
|
110
|
+
// Create the ART instance with the high-level configuration.
|
|
111
|
+
const art = await createArtInstance(artConfig);
|
|
112
|
+
console.log('ART Instance Initialized.');
|
|
113
|
+
|
|
114
|
+
// --- 3. Set Up a New Conversation Thread ---
|
|
115
|
+
const threadId = 'user-123-session-1';
|
|
116
|
+
|
|
117
|
+
// Create the thread-specific configuration.
|
|
118
|
+
// THIS is where you specify the provider, model, and API key.
|
|
119
|
+
const threadConfig: ThreadConfig = {
|
|
120
|
+
providerConfig: {
|
|
121
|
+
providerName: 'openai', // Must match a name from availableProviders
|
|
122
|
+
modelId: 'gpt-4o',
|
|
123
|
+
adapterOptions: {
|
|
124
|
+
apiKey: 'sk-your-real-openai-api-key', // Securely provide your API key here
|
|
125
|
+
temperature: 0.7
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
// Other thread settings
|
|
129
|
+
enabledTools: ['CalculatorTool'],
|
|
130
|
+
historyLimit: 20
|
|
103
131
|
};
|
|
104
132
|
|
|
105
|
-
//
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
// (Optional) A unique ID for the conversation thread
|
|
121
|
-
threadId: 'quickstart-thread-1',
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
// 4. Log the result
|
|
125
|
-
console.log('Agent Response:', result.responseText);
|
|
126
|
-
// console.log("Full Result:", result); // You can inspect the full object for more details
|
|
127
|
-
} catch (error) {
|
|
128
|
-
console.error('Agent processing failed:', error);
|
|
129
|
-
}
|
|
133
|
+
// Save this configuration for the new thread.
|
|
134
|
+
// This step is crucial and must be done before the first `process` call.
|
|
135
|
+
await art.stateManager.setThreadConfig(threadId, threadConfig);
|
|
136
|
+
console.log(`ThreadConfig set for threadId: ${threadId}`);
|
|
137
|
+
|
|
138
|
+
// Now the ART instance is ready to process requests for this thread.
|
|
139
|
+
console.log('Sending first message...');
|
|
140
|
+
const response = await art.process({
|
|
141
|
+
query: 'What is 2 + 2?',
|
|
142
|
+
threadId: threadId
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
console.log('Final response:', response.response.content);
|
|
130
146
|
}
|
|
131
147
|
|
|
132
|
-
|
|
148
|
+
initializeAndRun().catch(console.error);
|
|
133
149
|
```
|
|
134
150
|
|
|
135
151
|
*(Note: Replace `'YOUR_OPENAI_API_KEY'` with your actual key. In a real application, load this from a secure source like environment variables or a secrets manager.)*
|
|
@@ -137,8 +153,8 @@ runSimpleAgent();
|
|
|
137
153
|
## Documentation
|
|
138
154
|
|
|
139
155
|
* **[Comprehensive Developer Guide](docs/README.md):** The primary guide covering concepts, architecture, and API usage. **(Start Here!)**
|
|
140
|
-
* **[How-To Guides](docs/how-to):** Practical guides for specific tasks, such as [Customizing the Agent's Persona](docs/how-to/customizing-agent-persona.md).
|
|
141
|
-
* **[API Reference](docs/components
|
|
156
|
+
* **[How-To Guides](./docs/how-to):** Practical guides for specific tasks, such as [Customizing the Agent's Persona](./docs/how-to/customizing-agent-persona.md).
|
|
157
|
+
* **[API Reference](./docs/components):** Auto-generated API documentation.
|
|
142
158
|
* **[Examples](./examples):** Find practical examples, including a full React chatbot implementation.
|
|
143
159
|
|
|
144
160
|
## Contributing
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "art-framework",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Agent Runtine (ART) Framework - A browser-first JavaScript/TypeScript framework for building LLM-powered Agentic AI applications that supports MCP and A2A protocols natively",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|