agentic-api 1.0.1 → 1.0.2
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 +63 -72
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,58 +1,49 @@
|
|
|
1
1
|
# @agentic-api
|
|
2
2
|
|
|
3
|
-
API
|
|
4
|
-
> **Note personnelle** :
|
|
5
|
-
Ce projet n'a pas l'intention d'être meilleur que Vercel ou LangChain. Il est simplement moins générique, et optimisé pour un petit nombre de problèmes.
|
|
6
|
-
Il se concentre sur des fonctionnalités spécifiques qui impliquait trop de dépendances avec les autres frameworks.
|
|
7
|
-
|
|
8
|
-
## 🚀 Fonctionnalités clés
|
|
9
|
-
- Orchestration d'agents en séquences selon un graphe prédéfini
|
|
10
|
-
- Escalade automatique vers des modèles plus performants
|
|
11
|
-
- Transfert intelligent entre agents spécialisés avec seuil de confiance
|
|
12
|
-
- Gestion de la mémoire (session et long terme)
|
|
13
|
-
- Extraction de texte depuis les PDFs
|
|
14
|
-
- Outil de réflexion (thinking) pour le raisonnement complexe
|
|
15
|
-
- Feedback en temps réel sur l'état des agents
|
|
16
|
-
|
|
17
|
-
### Avantages clés de @agentic-api
|
|
18
|
-
1. **Simplicité d'utilisation**
|
|
19
|
-
- Configuration minimale requise
|
|
20
|
-
- Un minimum de dépendances
|
|
3
|
+
Super simple API for intelligent agent orchestration with automatic sequences and escalations.
|
|
21
4
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- Transferts d'agents rapides et (relativement) fiables
|
|
5
|
+
> **Personal Note**:
|
|
6
|
+
> This project is not meant to be better than Vercel or LangChain. It's simply less generic and optimized for a specific set of problems.
|
|
7
|
+
> It focuses on specific features that required too many dependencies with other frameworks.
|
|
26
8
|
|
|
27
|
-
|
|
28
|
-
- Support principalement d'OpenAI
|
|
29
|
-
- Système extensible
|
|
30
|
-
- Personnalisation facile des agents
|
|
9
|
+
## 🚀 Key Features
|
|
31
10
|
|
|
11
|
+
- Agent orchestration in predefined sequences
|
|
12
|
+
- Automatic model escalation
|
|
13
|
+
- Smart transfer between specialized agents with confidence threshold
|
|
14
|
+
- Memory management (session and long-term)
|
|
15
|
+
- PDF text extraction
|
|
16
|
+
- Thinking tool for complex reasoning
|
|
17
|
+
- Real-time agent status feedback
|
|
32
18
|
|
|
33
|
-
###
|
|
34
|
-
- Applications nécessitant une orchestration d'agents spécialisés
|
|
35
|
-
- Projets nécessitant une extraction de contenu fiable
|
|
19
|
+
### Key Advantages
|
|
36
20
|
|
|
37
|
-
|
|
21
|
+
1. **Simplicity**
|
|
22
|
+
- Minimal configuration
|
|
23
|
+
- Few dependencies
|
|
38
24
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
25
|
+
2. **Performance**
|
|
26
|
+
- Production-ready
|
|
27
|
+
- Efficient memory management
|
|
28
|
+
- Fast and (relatively) reliable agent transfers
|
|
29
|
+
|
|
30
|
+
3. **Flexibility**
|
|
31
|
+
- Primarily OpenAI support
|
|
32
|
+
- Extensible system
|
|
33
|
+
- Easy agent customization
|
|
42
34
|
|
|
43
|
-
|
|
35
|
+
### Recommended Use Cases
|
|
44
36
|
|
|
45
|
-
|
|
37
|
+
- Applications requiring specialized agent orchestration
|
|
38
|
+
- Projects needing reliable content extraction
|
|
39
|
+
|
|
40
|
+
## 📦 Installation
|
|
46
41
|
|
|
47
42
|
```bash
|
|
48
|
-
|
|
49
|
-
sudo apt install python3.*-venv
|
|
50
|
-
python3 -m venv .venv
|
|
51
|
-
source .venv/bin/activate
|
|
52
|
-
pip install -r bin/requirements.txt
|
|
43
|
+
npm install @agentic-api
|
|
53
44
|
```
|
|
54
45
|
|
|
55
|
-
## 💡
|
|
46
|
+
## 💡 Quick Start
|
|
56
47
|
|
|
57
48
|
```typescript
|
|
58
49
|
import OpenAI from "openai";
|
|
@@ -64,7 +55,7 @@ const openai = new OpenAI({
|
|
|
64
55
|
apiKey: process.env.OPENAI_API_KEY,
|
|
65
56
|
});
|
|
66
57
|
|
|
67
|
-
//
|
|
58
|
+
// Create session context
|
|
68
59
|
const session: AgenticContext = {
|
|
69
60
|
memory: {
|
|
70
61
|
messages: [],
|
|
@@ -77,60 +68,60 @@ const session: AgenticContext = {
|
|
|
77
68
|
}
|
|
78
69
|
};
|
|
79
70
|
|
|
80
|
-
//
|
|
71
|
+
// Execute agent with memory enrichment
|
|
81
72
|
const stream = await executeAgentSet(agents, session, {
|
|
82
|
-
query: "
|
|
73
|
+
query: "Hello, what can you do?",
|
|
83
74
|
initialAgent: "greeter",
|
|
84
75
|
verbose: true,
|
|
85
76
|
enrichWithMemory: async (role) => {
|
|
86
|
-
//
|
|
77
|
+
// Memory enrichment logic
|
|
87
78
|
return "";
|
|
88
79
|
}
|
|
89
80
|
});
|
|
90
81
|
```
|
|
91
82
|
|
|
92
|
-
## 🤖
|
|
83
|
+
## 🤖 Custom Agent Creation
|
|
93
84
|
|
|
94
85
|
```typescript
|
|
95
86
|
import { AgentConfig } from '@agentic-api/types';
|
|
96
87
|
import { modelConfig } from '@agentic-api/execute';
|
|
97
88
|
|
|
98
|
-
//
|
|
89
|
+
// Example specialized agent with thinking tool
|
|
99
90
|
const haiku: AgentConfig = {
|
|
100
91
|
name: "haiku",
|
|
101
|
-
publicDescription: "Agent
|
|
102
|
-
instructions: "
|
|
92
|
+
publicDescription: "Agent that writes haikus.",
|
|
93
|
+
instructions: "Ask the user for a subject, then respond with a haiku.",
|
|
103
94
|
model: modelConfig("LOW"),
|
|
104
95
|
tools: [],
|
|
105
|
-
maxSteps: 3 //
|
|
96
|
+
maxSteps: 3 // Limit thinking steps
|
|
106
97
|
};
|
|
107
98
|
|
|
108
|
-
//
|
|
99
|
+
// Welcome agent with transfer
|
|
109
100
|
const welcome: AgentConfig = {
|
|
110
101
|
name: "welcome",
|
|
111
|
-
publicDescription: "Agent
|
|
112
|
-
instructions: "
|
|
102
|
+
publicDescription: "Agent that welcomes users.",
|
|
103
|
+
instructions: "Welcome the user and suggest options.",
|
|
113
104
|
model: modelConfig("LOW"),
|
|
114
105
|
tools: [],
|
|
115
106
|
downstreamAgents: [haiku]
|
|
116
107
|
};
|
|
117
108
|
|
|
118
|
-
//
|
|
109
|
+
// Inject transfer and thinking tools
|
|
119
110
|
import { injectTransferTools } from '@agentic-api/utils';
|
|
120
111
|
const myAgents = injectTransferTools([welcome, haiku]);
|
|
121
112
|
```
|
|
122
113
|
|
|
123
|
-
## 🧠
|
|
114
|
+
## 🧠 Memory Management
|
|
124
115
|
|
|
125
116
|
```typescript
|
|
126
117
|
import { MemoriesLite } from '@memories-lite';
|
|
127
118
|
|
|
128
119
|
const memory = new MemoriesLite({
|
|
129
|
-
//
|
|
120
|
+
// Memory configuration
|
|
130
121
|
});
|
|
131
122
|
|
|
132
123
|
async function chatWithMemories(message: string, userId = "default_user") {
|
|
133
|
-
//
|
|
124
|
+
// Semantic memory search
|
|
134
125
|
const relevantMemories = await memory.retrieve(message, userId, {
|
|
135
126
|
limit: 5,
|
|
136
127
|
filters: { type: "conversation" }
|
|
@@ -145,39 +136,39 @@ ${relevantMemories.results.map(entry => `- ${entry.memory}`).join("\n")}`;
|
|
|
145
136
|
{ role: "user", content: message },
|
|
146
137
|
];
|
|
147
138
|
|
|
148
|
-
// Capture
|
|
139
|
+
// Capture new conversation
|
|
149
140
|
await memory.capture(messages, userId, {
|
|
150
141
|
metadata: { type: "conversation" }
|
|
151
142
|
});
|
|
152
143
|
}
|
|
153
144
|
```
|
|
154
145
|
|
|
155
|
-
## ⚙️
|
|
146
|
+
## ⚙️ Model Levels
|
|
156
147
|
|
|
157
|
-
- **LOW**: gpt-4.1-nano (
|
|
158
|
-
- **MEDIUM**: gpt-4.1-mini (
|
|
159
|
-
- **HIGH**: gpt-4.1 (
|
|
160
|
-
- **SEARCH**: gpt-4o-mini-search-preview (
|
|
148
|
+
- **LOW**: gpt-4.1-nano (simple tasks)
|
|
149
|
+
- **MEDIUM**: gpt-4.1-mini (balanced performance/cost)
|
|
150
|
+
- **HIGH**: gpt-4.1 (advanced reasoning)
|
|
151
|
+
- **SEARCH**: gpt-4o-mini-search-preview (web search with localization)
|
|
161
152
|
|
|
162
|
-
## 🔄
|
|
153
|
+
## 🔄 Agent Transfer
|
|
163
154
|
|
|
164
|
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
168
|
-
-
|
|
155
|
+
Agent transfer is automatically managed with:
|
|
156
|
+
- Confidence threshold (0.7) for transfer
|
|
157
|
+
- Transfer justification
|
|
158
|
+
- Conversation context preservation
|
|
159
|
+
- Automatic system instruction updates
|
|
169
160
|
|
|
170
|
-
## 🧪
|
|
161
|
+
## 🧪 Testing
|
|
171
162
|
|
|
172
163
|
```bash
|
|
173
164
|
npm test
|
|
174
165
|
```
|
|
175
166
|
|
|
176
|
-
## 📄
|
|
167
|
+
## 📄 License
|
|
177
168
|
|
|
178
169
|
MIT License
|
|
179
170
|
|
|
180
|
-
Copyright (c) 2024
|
|
171
|
+
Copyright (c) 2024 Pilet-Renaud SA
|
|
181
172
|
|
|
182
173
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
183
174
|
of this software and associated documentation files (the "Software"), to deal
|
package/package.json
CHANGED