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.
Files changed (2) hide show
  1. package/README.md +75 -59
  2. 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.2.8-blue" alt="Version 0.3.0">
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, runs in-memory, and answers a query.
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 { createArtInstance } from 'art-framework';
74
- import type { ArtInstanceConfig } from 'art-framework';
75
-
76
- async function runSimpleAgent() {
77
- // 1. Define the configuration for the ART instance
78
- const config: ArtInstanceConfig = {
79
- // Use 'memory' for simple tests, or 'indexedDB' for browser persistence
80
- storage: { type: 'memory' },
81
-
82
- // Configure your LLM providers. The key ('openai' here) is a friendly name.
83
- providers: {
84
- openai: {
85
- // The adapter handles communication with the provider
86
- adapter: 'openai', // Use the name of the built-in adapter
87
- // Pass API key securely (use env vars or a secrets manager in production)
88
- apiKey: 'YOUR_OPENAI_API_KEY',
89
- },
90
- // You could add other providers here, e.g., 'anthropic', 'gemini'
91
- },
92
-
93
- // Register any tools you want the agent to use
94
- // tools: [new CalculatorTool()],
95
-
96
- // (Optional) Define a default persona for the agent instance
97
- persona: {
98
- name: 'ART-Bot',
99
- prompts: {
100
- synthesis: 'You are ART-Bot, a helpful and friendly AI assistant. Provide a clear and concise answer to the user\'s query.'
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
- // 2. Create the ART instance
106
- const art = await createArtInstance(config);
107
- console.log('ART instance created successfully!');
108
-
109
- // 3. Start a conversation and process a query
110
- try {
111
- const result = await art.process({
112
- query: 'What is the capital of France?',
113
- // Use a provider and model configured above
114
- threadConfig: {
115
- runtimeProvider: {
116
- provider: 'openai',
117
- model: 'gpt-4o-mini',
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
- runSimpleAgent();
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/README.md):** Auto-generated API documentation.
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.0",
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",