chatcortex 0.3.0__tar.gz → 0.4.0__tar.gz
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.
- chatcortex-0.4.0/PKG-INFO +354 -0
- chatcortex-0.4.0/README.md +321 -0
- chatcortex-0.4.0/chatcortex/__init__.py +33 -0
- chatcortex-0.4.0/chatcortex/budget_sweep_experiment.py +311 -0
- chatcortex-0.4.0/chatcortex/demo_phase3.py +442 -0
- chatcortex-0.4.0/chatcortex/synthesis/pareto_partial_beam_synthesizer.py +142 -0
- chatcortex-0.4.0/chatcortex/synthesis/pareto_partial_beam_synthesizer_v2.py +195 -0
- chatcortex-0.4.0/chatcortex/synthesis/pareto_partial_beam_synthesizer_v3.py +199 -0
- chatcortex-0.4.0/chatcortex/synthesis/progressive_pareto_beam_synthesizer.py +141 -0
- chatcortex-0.4.0/chatcortex/synthesis/system_score_beam_synthesizer.py +118 -0
- chatcortex-0.4.0/chatcortex.egg-info/PKG-INFO +354 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex.egg-info/SOURCES.txt +5 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/pyproject.toml +26 -9
- chatcortex-0.3.0/PKG-INFO +0 -230
- chatcortex-0.3.0/README.md +0 -199
- chatcortex-0.3.0/chatcortex/__init__.py +0 -7
- chatcortex-0.3.0/chatcortex/budget_sweep_experiment.py +0 -142
- chatcortex-0.3.0/chatcortex/demo_phase3.py +0 -215
- chatcortex-0.3.0/chatcortex.egg-info/PKG-INFO +0 -230
- {chatcortex-0.3.0 → chatcortex-0.4.0}/LICENSE +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/demo_phase1.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/demo_phase2.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/evaluation/approximation_metrics.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/evaluation/harness.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/execution/executor.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/graph/agent_graph.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/optimization/architecture_candidate.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/optimization/pareto.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/registry/capability_registry.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/registry/metadata.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/synthesis/base.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/synthesis/beam_synthesizer.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/synthesis/budget.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/synthesis/exhaustive_synthesizer.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/synthesis/heuristic_synthesizer.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/synthesis/random_synthesizer.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/synthesis/task_specification.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex/telemetry/logger.py +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex.egg-info/dependency_links.txt +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex.egg-info/requires.txt +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/chatcortex.egg-info/top_level.txt +0 -0
- {chatcortex-0.3.0 → chatcortex-0.4.0}/setup.cfg +0 -0
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: chatcortex
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Framework for multi-objective synthesis and optimization of AI agent architectures under bounded evaluation budgets
|
|
5
|
+
Author: Siddharth Saraswat
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/siddharth1012/chatCortex
|
|
8
|
+
Project-URL: Repository, https://github.com/siddharth1012/chatCortex
|
|
9
|
+
Project-URL: Issues, https://github.com/siddharth1012/chatCortex/issues
|
|
10
|
+
Keywords: automl,multi-objective-optimization,agent-architecture,llm-agents,pareto-optimization,architecture-search,beam-search,ai-systems
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
21
|
+
Requires-Python: >=3.9
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
Requires-Dist: networkx>=2.8
|
|
25
|
+
Requires-Dist: numpy>=1.23
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
28
|
+
Requires-Dist: black>=23.0; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
30
|
+
Provides-Extra: viz
|
|
31
|
+
Requires-Dist: matplotlib>=3.7; extra == "viz"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# ChatCortex
|
|
35
|
+
|
|
36
|
+
**ChatCortex** is a framework for **automated synthesis and optimization
|
|
37
|
+
of AI agent architectures**.
|
|
38
|
+
|
|
39
|
+
Instead of manually wiring LLM pipelines such as:
|
|
40
|
+
|
|
41
|
+
retrieval → LLM → verifier → tool
|
|
42
|
+
|
|
43
|
+
ChatCortex treats agent design as a **multi-objective architecture
|
|
44
|
+
search problem** and automatically discovers architectures that
|
|
45
|
+
optimize:
|
|
46
|
+
|
|
47
|
+
- **Cost**
|
|
48
|
+
- **Latency**
|
|
49
|
+
- **Reliability**
|
|
50
|
+
|
|
51
|
+
The project can be viewed as **AutoML for AI Agents**.
|
|
52
|
+
|
|
53
|
+
------------------------------------------------------------------------
|
|
54
|
+
|
|
55
|
+
# Vision
|
|
56
|
+
|
|
57
|
+
Modern AI agents are typically constructed through manual orchestration
|
|
58
|
+
of:
|
|
59
|
+
|
|
60
|
+
- Large Language Models
|
|
61
|
+
- Retrieval systems
|
|
62
|
+
- Tools and APIs
|
|
63
|
+
- Verification modules
|
|
64
|
+
- Memory systems
|
|
65
|
+
|
|
66
|
+
This approach is often:
|
|
67
|
+
|
|
68
|
+
- brittle
|
|
69
|
+
- expensive
|
|
70
|
+
- difficult to optimize
|
|
71
|
+
- difficult to reproduce
|
|
72
|
+
|
|
73
|
+
ChatCortex introduces a **formal synthesis framework** where agent
|
|
74
|
+
architectures are **automatically generated from task specifications**
|
|
75
|
+
and evaluated under system constraints.
|
|
76
|
+
|
|
77
|
+
Long-term goal:
|
|
78
|
+
|
|
79
|
+
> Automated synthesis of reliable AI agents from high-level intent.
|
|
80
|
+
|
|
81
|
+
------------------------------------------------------------------------
|
|
82
|
+
|
|
83
|
+
# Key Idea
|
|
84
|
+
|
|
85
|
+
Instead of designing agent pipelines manually:
|
|
86
|
+
|
|
87
|
+
Engineer → Manual Pipeline Design
|
|
88
|
+
|
|
89
|
+
ChatCortex enables:
|
|
90
|
+
|
|
91
|
+
Task Specification → Architecture Search → Pareto-Optimal Architectures
|
|
92
|
+
|
|
93
|
+
Architectures are evaluated across multiple objectives:
|
|
94
|
+
|
|
95
|
+
- **minimize cost**
|
|
96
|
+
- **minimize latency**
|
|
97
|
+
- **maximize reliability**
|
|
98
|
+
|
|
99
|
+
------------------------------------------------------------------------
|
|
100
|
+
|
|
101
|
+
# Architecture Overview
|
|
102
|
+
|
|
103
|
+
ChatCortex is organized as a layered architecture synthesis system.
|
|
104
|
+
|
|
105
|
+
TaskSpecification\
|
|
106
|
+
↓\
|
|
107
|
+
CapabilityRegistry\
|
|
108
|
+
↓\
|
|
109
|
+
Synthesis Engine\
|
|
110
|
+
↓\
|
|
111
|
+
AgentGraph (DAG)\
|
|
112
|
+
↓\
|
|
113
|
+
Execution Engine\
|
|
114
|
+
↓\
|
|
115
|
+
Telemetry\
|
|
116
|
+
↓\
|
|
117
|
+
Evaluation Harness\
|
|
118
|
+
↓\
|
|
119
|
+
Pareto Optimization
|
|
120
|
+
|
|
121
|
+
Each layer isolates a specific concern in automated agent architecture
|
|
122
|
+
synthesis.
|
|
123
|
+
|
|
124
|
+
------------------------------------------------------------------------
|
|
125
|
+
|
|
126
|
+
# Core Components
|
|
127
|
+
|
|
128
|
+
## ComponentMetadata
|
|
129
|
+
|
|
130
|
+
Formal representation of agent components such as:
|
|
131
|
+
|
|
132
|
+
- language models
|
|
133
|
+
- retrieval systems
|
|
134
|
+
- tools
|
|
135
|
+
- verification modules
|
|
136
|
+
- memory modules
|
|
137
|
+
|
|
138
|
+
Each component defines:
|
|
139
|
+
|
|
140
|
+
- capabilities
|
|
141
|
+
- cost per call
|
|
142
|
+
- latency
|
|
143
|
+
- reliability score
|
|
144
|
+
- privacy level
|
|
145
|
+
|
|
146
|
+
Components are immutable and purely declarative.
|
|
147
|
+
|
|
148
|
+
------------------------------------------------------------------------
|
|
149
|
+
|
|
150
|
+
## CapabilityRegistry
|
|
151
|
+
|
|
152
|
+
Central registry responsible for:
|
|
153
|
+
|
|
154
|
+
- component registration
|
|
155
|
+
- capability filtering
|
|
156
|
+
- privacy constraint enforcement
|
|
157
|
+
|
|
158
|
+
The registry **does not perform optimization** --- it only provides
|
|
159
|
+
valid components for synthesis.
|
|
160
|
+
|
|
161
|
+
------------------------------------------------------------------------
|
|
162
|
+
|
|
163
|
+
## TaskSpecification
|
|
164
|
+
|
|
165
|
+
Defines the architecture synthesis problem.
|
|
166
|
+
|
|
167
|
+
Example:
|
|
168
|
+
|
|
169
|
+
``` python
|
|
170
|
+
from chatcortex import TaskSpecification
|
|
171
|
+
|
|
172
|
+
task = TaskSpecification(
|
|
173
|
+
required_capabilities=[
|
|
174
|
+
"retrieval",
|
|
175
|
+
"generation",
|
|
176
|
+
"verification"
|
|
177
|
+
],
|
|
178
|
+
max_cost=0.01,
|
|
179
|
+
max_latency=2000
|
|
180
|
+
)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
------------------------------------------------------------------------
|
|
184
|
+
|
|
185
|
+
## Synthesizers
|
|
186
|
+
|
|
187
|
+
ChatCortex includes multiple architecture synthesis strategies.
|
|
188
|
+
|
|
189
|
+
- **HeuristicSynthesizer** --- Greedy deterministic architecture
|
|
190
|
+
construction.
|
|
191
|
+
- **RandomSynthesizer** --- Random baseline for stochastic
|
|
192
|
+
exploration.
|
|
193
|
+
- **BeamSynthesizer** --- Budget-aware approximate architecture
|
|
194
|
+
search.
|
|
195
|
+
- **ExhaustiveSynthesizer** --- Computes the exact Pareto frontier.
|
|
196
|
+
- **ProgressiveParetoBeamSynthesizer (v0.4.0)** --- Depth-aware beam
|
|
197
|
+
widening improving Pareto recovery.
|
|
198
|
+
|
|
199
|
+
------------------------------------------------------------------------
|
|
200
|
+
|
|
201
|
+
# AgentGraph
|
|
202
|
+
|
|
203
|
+
Agent architectures are represented as **Directed Acyclic Graphs
|
|
204
|
+
(DAGs)**.
|
|
205
|
+
|
|
206
|
+
Aggregated metrics:
|
|
207
|
+
|
|
208
|
+
- total cost (additive)
|
|
209
|
+
- total latency (sequential assumption)
|
|
210
|
+
- reliability (multiplicative model)
|
|
211
|
+
|
|
212
|
+
------------------------------------------------------------------------
|
|
213
|
+
|
|
214
|
+
# Execution Engine
|
|
215
|
+
|
|
216
|
+
Two execution modes:
|
|
217
|
+
|
|
218
|
+
### Deterministic Mode
|
|
219
|
+
|
|
220
|
+
Used for structural validation and reproducible testing.
|
|
221
|
+
|
|
222
|
+
### Probabilistic Mode
|
|
223
|
+
|
|
224
|
+
Simulates real-world reliability using component success probabilities.
|
|
225
|
+
|
|
226
|
+
------------------------------------------------------------------------
|
|
227
|
+
|
|
228
|
+
# Evaluation Harness
|
|
229
|
+
|
|
230
|
+
Supports:
|
|
231
|
+
|
|
232
|
+
- multiple tasks
|
|
233
|
+
- multiple synthesizers
|
|
234
|
+
- stochastic trials
|
|
235
|
+
- reproducible experiments
|
|
236
|
+
|
|
237
|
+
Outputs:
|
|
238
|
+
|
|
239
|
+
- average cost
|
|
240
|
+
- average latency
|
|
241
|
+
- success rate
|
|
242
|
+
|
|
243
|
+
------------------------------------------------------------------------
|
|
244
|
+
|
|
245
|
+
# Multi-Objective Evaluation Metrics
|
|
246
|
+
|
|
247
|
+
- **Pareto Coverage**
|
|
248
|
+
- **Hypervolume Loss**
|
|
249
|
+
- **Average Regret (cost, latency, reliability)**
|
|
250
|
+
|
|
251
|
+
------------------------------------------------------------------------
|
|
252
|
+
|
|
253
|
+
# Example
|
|
254
|
+
|
|
255
|
+
``` python
|
|
256
|
+
from chatcortex import TaskSpecification, BeamSynthesizer
|
|
257
|
+
|
|
258
|
+
task = TaskSpecification(
|
|
259
|
+
required_capabilities=[
|
|
260
|
+
"retrieval",
|
|
261
|
+
"generation",
|
|
262
|
+
"verification"
|
|
263
|
+
]
|
|
264
|
+
)
|
|
265
|
+
|
|
266
|
+
synth = BeamSynthesizer(beam_width=5)
|
|
267
|
+
|
|
268
|
+
architectures = synth.synthesize(task)
|
|
269
|
+
|
|
270
|
+
for arch in architectures:
|
|
271
|
+
print(arch.total_cost(), arch.total_latency())
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
------------------------------------------------------------------------
|
|
275
|
+
|
|
276
|
+
# Installation
|
|
277
|
+
|
|
278
|
+
``` bash
|
|
279
|
+
pip install chatcortex
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
------------------------------------------------------------------------
|
|
283
|
+
|
|
284
|
+
# Research Context
|
|
285
|
+
|
|
286
|
+
ChatCortex is a **controlled experimental platform for studying
|
|
287
|
+
automated AI agent architecture synthesis**.
|
|
288
|
+
|
|
289
|
+
Research areas:
|
|
290
|
+
|
|
291
|
+
- multi-objective optimization
|
|
292
|
+
- architecture search
|
|
293
|
+
- AI agent systems
|
|
294
|
+
- reliability-cost tradeoffs
|
|
295
|
+
- AutoML-style agent design
|
|
296
|
+
|
|
297
|
+
------------------------------------------------------------------------
|
|
298
|
+
|
|
299
|
+
# Experimental Validation
|
|
300
|
+
|
|
301
|
+
Tested on dense architecture spaces:
|
|
302
|
+
|
|
303
|
+
- 5-stage synthesis pipelines
|
|
304
|
+
- up to 95-point Pareto frontiers
|
|
305
|
+
- budget sweeps from 20 → 180 evaluations
|
|
306
|
+
- beam width sweeps from 3 → 15
|
|
307
|
+
|
|
308
|
+
Progressive Pareto Beam Widening demonstrates improved Pareto recovery
|
|
309
|
+
compared to static beam strategies.
|
|
310
|
+
|
|
311
|
+
------------------------------------------------------------------------
|
|
312
|
+
|
|
313
|
+
# Roadmap
|
|
314
|
+
|
|
315
|
+
### Phase 1 --- Foundations
|
|
316
|
+
|
|
317
|
+
- component modeling
|
|
318
|
+
- capability registry
|
|
319
|
+
- task specification
|
|
320
|
+
- agent graph representation
|
|
321
|
+
|
|
322
|
+
### Phase 2 --- Exact Optimization
|
|
323
|
+
|
|
324
|
+
- exhaustive architecture search
|
|
325
|
+
- exact Pareto frontier computation
|
|
326
|
+
|
|
327
|
+
### Phase 3 --- Budget-Aware Search (Complete)
|
|
328
|
+
|
|
329
|
+
- beam search synthesis
|
|
330
|
+
- Pareto-aware pruning
|
|
331
|
+
- progressive beam widening
|
|
332
|
+
|
|
333
|
+
### Future Directions
|
|
334
|
+
|
|
335
|
+
- graph-structured agent synthesis
|
|
336
|
+
- real model / tool integrations
|
|
337
|
+
- enterprise optimization layers
|
|
338
|
+
|
|
339
|
+
------------------------------------------------------------------------
|
|
340
|
+
|
|
341
|
+
# Status
|
|
342
|
+
|
|
343
|
+
ChatCortex is currently a **research framework under active
|
|
344
|
+
development**.
|
|
345
|
+
|
|
346
|
+
------------------------------------------------------------------------
|
|
347
|
+
|
|
348
|
+
# License
|
|
349
|
+
|
|
350
|
+
MIT License
|
|
351
|
+
|
|
352
|
+
------------------------------------------------------------------------
|
|
353
|
+
|
|
354
|
+
Developed by **Siddharth Saraswat**
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
# ChatCortex
|
|
2
|
+
|
|
3
|
+
**ChatCortex** is a framework for **automated synthesis and optimization
|
|
4
|
+
of AI agent architectures**.
|
|
5
|
+
|
|
6
|
+
Instead of manually wiring LLM pipelines such as:
|
|
7
|
+
|
|
8
|
+
retrieval → LLM → verifier → tool
|
|
9
|
+
|
|
10
|
+
ChatCortex treats agent design as a **multi-objective architecture
|
|
11
|
+
search problem** and automatically discovers architectures that
|
|
12
|
+
optimize:
|
|
13
|
+
|
|
14
|
+
- **Cost**
|
|
15
|
+
- **Latency**
|
|
16
|
+
- **Reliability**
|
|
17
|
+
|
|
18
|
+
The project can be viewed as **AutoML for AI Agents**.
|
|
19
|
+
|
|
20
|
+
------------------------------------------------------------------------
|
|
21
|
+
|
|
22
|
+
# Vision
|
|
23
|
+
|
|
24
|
+
Modern AI agents are typically constructed through manual orchestration
|
|
25
|
+
of:
|
|
26
|
+
|
|
27
|
+
- Large Language Models
|
|
28
|
+
- Retrieval systems
|
|
29
|
+
- Tools and APIs
|
|
30
|
+
- Verification modules
|
|
31
|
+
- Memory systems
|
|
32
|
+
|
|
33
|
+
This approach is often:
|
|
34
|
+
|
|
35
|
+
- brittle
|
|
36
|
+
- expensive
|
|
37
|
+
- difficult to optimize
|
|
38
|
+
- difficult to reproduce
|
|
39
|
+
|
|
40
|
+
ChatCortex introduces a **formal synthesis framework** where agent
|
|
41
|
+
architectures are **automatically generated from task specifications**
|
|
42
|
+
and evaluated under system constraints.
|
|
43
|
+
|
|
44
|
+
Long-term goal:
|
|
45
|
+
|
|
46
|
+
> Automated synthesis of reliable AI agents from high-level intent.
|
|
47
|
+
|
|
48
|
+
------------------------------------------------------------------------
|
|
49
|
+
|
|
50
|
+
# Key Idea
|
|
51
|
+
|
|
52
|
+
Instead of designing agent pipelines manually:
|
|
53
|
+
|
|
54
|
+
Engineer → Manual Pipeline Design
|
|
55
|
+
|
|
56
|
+
ChatCortex enables:
|
|
57
|
+
|
|
58
|
+
Task Specification → Architecture Search → Pareto-Optimal Architectures
|
|
59
|
+
|
|
60
|
+
Architectures are evaluated across multiple objectives:
|
|
61
|
+
|
|
62
|
+
- **minimize cost**
|
|
63
|
+
- **minimize latency**
|
|
64
|
+
- **maximize reliability**
|
|
65
|
+
|
|
66
|
+
------------------------------------------------------------------------
|
|
67
|
+
|
|
68
|
+
# Architecture Overview
|
|
69
|
+
|
|
70
|
+
ChatCortex is organized as a layered architecture synthesis system.
|
|
71
|
+
|
|
72
|
+
TaskSpecification\
|
|
73
|
+
↓\
|
|
74
|
+
CapabilityRegistry\
|
|
75
|
+
↓\
|
|
76
|
+
Synthesis Engine\
|
|
77
|
+
↓\
|
|
78
|
+
AgentGraph (DAG)\
|
|
79
|
+
↓\
|
|
80
|
+
Execution Engine\
|
|
81
|
+
↓\
|
|
82
|
+
Telemetry\
|
|
83
|
+
↓\
|
|
84
|
+
Evaluation Harness\
|
|
85
|
+
↓\
|
|
86
|
+
Pareto Optimization
|
|
87
|
+
|
|
88
|
+
Each layer isolates a specific concern in automated agent architecture
|
|
89
|
+
synthesis.
|
|
90
|
+
|
|
91
|
+
------------------------------------------------------------------------
|
|
92
|
+
|
|
93
|
+
# Core Components
|
|
94
|
+
|
|
95
|
+
## ComponentMetadata
|
|
96
|
+
|
|
97
|
+
Formal representation of agent components such as:
|
|
98
|
+
|
|
99
|
+
- language models
|
|
100
|
+
- retrieval systems
|
|
101
|
+
- tools
|
|
102
|
+
- verification modules
|
|
103
|
+
- memory modules
|
|
104
|
+
|
|
105
|
+
Each component defines:
|
|
106
|
+
|
|
107
|
+
- capabilities
|
|
108
|
+
- cost per call
|
|
109
|
+
- latency
|
|
110
|
+
- reliability score
|
|
111
|
+
- privacy level
|
|
112
|
+
|
|
113
|
+
Components are immutable and purely declarative.
|
|
114
|
+
|
|
115
|
+
------------------------------------------------------------------------
|
|
116
|
+
|
|
117
|
+
## CapabilityRegistry
|
|
118
|
+
|
|
119
|
+
Central registry responsible for:
|
|
120
|
+
|
|
121
|
+
- component registration
|
|
122
|
+
- capability filtering
|
|
123
|
+
- privacy constraint enforcement
|
|
124
|
+
|
|
125
|
+
The registry **does not perform optimization** --- it only provides
|
|
126
|
+
valid components for synthesis.
|
|
127
|
+
|
|
128
|
+
------------------------------------------------------------------------
|
|
129
|
+
|
|
130
|
+
## TaskSpecification
|
|
131
|
+
|
|
132
|
+
Defines the architecture synthesis problem.
|
|
133
|
+
|
|
134
|
+
Example:
|
|
135
|
+
|
|
136
|
+
``` python
|
|
137
|
+
from chatcortex import TaskSpecification
|
|
138
|
+
|
|
139
|
+
task = TaskSpecification(
|
|
140
|
+
required_capabilities=[
|
|
141
|
+
"retrieval",
|
|
142
|
+
"generation",
|
|
143
|
+
"verification"
|
|
144
|
+
],
|
|
145
|
+
max_cost=0.01,
|
|
146
|
+
max_latency=2000
|
|
147
|
+
)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
------------------------------------------------------------------------
|
|
151
|
+
|
|
152
|
+
## Synthesizers
|
|
153
|
+
|
|
154
|
+
ChatCortex includes multiple architecture synthesis strategies.
|
|
155
|
+
|
|
156
|
+
- **HeuristicSynthesizer** --- Greedy deterministic architecture
|
|
157
|
+
construction.
|
|
158
|
+
- **RandomSynthesizer** --- Random baseline for stochastic
|
|
159
|
+
exploration.
|
|
160
|
+
- **BeamSynthesizer** --- Budget-aware approximate architecture
|
|
161
|
+
search.
|
|
162
|
+
- **ExhaustiveSynthesizer** --- Computes the exact Pareto frontier.
|
|
163
|
+
- **ProgressiveParetoBeamSynthesizer (v0.4.0)** --- Depth-aware beam
|
|
164
|
+
widening improving Pareto recovery.
|
|
165
|
+
|
|
166
|
+
------------------------------------------------------------------------
|
|
167
|
+
|
|
168
|
+
# AgentGraph
|
|
169
|
+
|
|
170
|
+
Agent architectures are represented as **Directed Acyclic Graphs
|
|
171
|
+
(DAGs)**.
|
|
172
|
+
|
|
173
|
+
Aggregated metrics:
|
|
174
|
+
|
|
175
|
+
- total cost (additive)
|
|
176
|
+
- total latency (sequential assumption)
|
|
177
|
+
- reliability (multiplicative model)
|
|
178
|
+
|
|
179
|
+
------------------------------------------------------------------------
|
|
180
|
+
|
|
181
|
+
# Execution Engine
|
|
182
|
+
|
|
183
|
+
Two execution modes:
|
|
184
|
+
|
|
185
|
+
### Deterministic Mode
|
|
186
|
+
|
|
187
|
+
Used for structural validation and reproducible testing.
|
|
188
|
+
|
|
189
|
+
### Probabilistic Mode
|
|
190
|
+
|
|
191
|
+
Simulates real-world reliability using component success probabilities.
|
|
192
|
+
|
|
193
|
+
------------------------------------------------------------------------
|
|
194
|
+
|
|
195
|
+
# Evaluation Harness
|
|
196
|
+
|
|
197
|
+
Supports:
|
|
198
|
+
|
|
199
|
+
- multiple tasks
|
|
200
|
+
- multiple synthesizers
|
|
201
|
+
- stochastic trials
|
|
202
|
+
- reproducible experiments
|
|
203
|
+
|
|
204
|
+
Outputs:
|
|
205
|
+
|
|
206
|
+
- average cost
|
|
207
|
+
- average latency
|
|
208
|
+
- success rate
|
|
209
|
+
|
|
210
|
+
------------------------------------------------------------------------
|
|
211
|
+
|
|
212
|
+
# Multi-Objective Evaluation Metrics
|
|
213
|
+
|
|
214
|
+
- **Pareto Coverage**
|
|
215
|
+
- **Hypervolume Loss**
|
|
216
|
+
- **Average Regret (cost, latency, reliability)**
|
|
217
|
+
|
|
218
|
+
------------------------------------------------------------------------
|
|
219
|
+
|
|
220
|
+
# Example
|
|
221
|
+
|
|
222
|
+
``` python
|
|
223
|
+
from chatcortex import TaskSpecification, BeamSynthesizer
|
|
224
|
+
|
|
225
|
+
task = TaskSpecification(
|
|
226
|
+
required_capabilities=[
|
|
227
|
+
"retrieval",
|
|
228
|
+
"generation",
|
|
229
|
+
"verification"
|
|
230
|
+
]
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
synth = BeamSynthesizer(beam_width=5)
|
|
234
|
+
|
|
235
|
+
architectures = synth.synthesize(task)
|
|
236
|
+
|
|
237
|
+
for arch in architectures:
|
|
238
|
+
print(arch.total_cost(), arch.total_latency())
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
------------------------------------------------------------------------
|
|
242
|
+
|
|
243
|
+
# Installation
|
|
244
|
+
|
|
245
|
+
``` bash
|
|
246
|
+
pip install chatcortex
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
------------------------------------------------------------------------
|
|
250
|
+
|
|
251
|
+
# Research Context
|
|
252
|
+
|
|
253
|
+
ChatCortex is a **controlled experimental platform for studying
|
|
254
|
+
automated AI agent architecture synthesis**.
|
|
255
|
+
|
|
256
|
+
Research areas:
|
|
257
|
+
|
|
258
|
+
- multi-objective optimization
|
|
259
|
+
- architecture search
|
|
260
|
+
- AI agent systems
|
|
261
|
+
- reliability-cost tradeoffs
|
|
262
|
+
- AutoML-style agent design
|
|
263
|
+
|
|
264
|
+
------------------------------------------------------------------------
|
|
265
|
+
|
|
266
|
+
# Experimental Validation
|
|
267
|
+
|
|
268
|
+
Tested on dense architecture spaces:
|
|
269
|
+
|
|
270
|
+
- 5-stage synthesis pipelines
|
|
271
|
+
- up to 95-point Pareto frontiers
|
|
272
|
+
- budget sweeps from 20 → 180 evaluations
|
|
273
|
+
- beam width sweeps from 3 → 15
|
|
274
|
+
|
|
275
|
+
Progressive Pareto Beam Widening demonstrates improved Pareto recovery
|
|
276
|
+
compared to static beam strategies.
|
|
277
|
+
|
|
278
|
+
------------------------------------------------------------------------
|
|
279
|
+
|
|
280
|
+
# Roadmap
|
|
281
|
+
|
|
282
|
+
### Phase 1 --- Foundations
|
|
283
|
+
|
|
284
|
+
- component modeling
|
|
285
|
+
- capability registry
|
|
286
|
+
- task specification
|
|
287
|
+
- agent graph representation
|
|
288
|
+
|
|
289
|
+
### Phase 2 --- Exact Optimization
|
|
290
|
+
|
|
291
|
+
- exhaustive architecture search
|
|
292
|
+
- exact Pareto frontier computation
|
|
293
|
+
|
|
294
|
+
### Phase 3 --- Budget-Aware Search (Complete)
|
|
295
|
+
|
|
296
|
+
- beam search synthesis
|
|
297
|
+
- Pareto-aware pruning
|
|
298
|
+
- progressive beam widening
|
|
299
|
+
|
|
300
|
+
### Future Directions
|
|
301
|
+
|
|
302
|
+
- graph-structured agent synthesis
|
|
303
|
+
- real model / tool integrations
|
|
304
|
+
- enterprise optimization layers
|
|
305
|
+
|
|
306
|
+
------------------------------------------------------------------------
|
|
307
|
+
|
|
308
|
+
# Status
|
|
309
|
+
|
|
310
|
+
ChatCortex is currently a **research framework under active
|
|
311
|
+
development**.
|
|
312
|
+
|
|
313
|
+
------------------------------------------------------------------------
|
|
314
|
+
|
|
315
|
+
# License
|
|
316
|
+
|
|
317
|
+
MIT License
|
|
318
|
+
|
|
319
|
+
------------------------------------------------------------------------
|
|
320
|
+
|
|
321
|
+
Developed by **Siddharth Saraswat**
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""
|
|
2
|
+
ChatCortex
|
|
3
|
+
|
|
4
|
+
Framework for automated synthesis and optimization of AI agent
|
|
5
|
+
architectures under multi-objective constraints.
|
|
6
|
+
|
|
7
|
+
Core capabilities include:
|
|
8
|
+
|
|
9
|
+
- Task specification
|
|
10
|
+
- Agent architecture synthesis
|
|
11
|
+
- Multi-objective optimization
|
|
12
|
+
- Pareto frontier analysis
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from .synthesis.task_specification import TaskSpecification
|
|
16
|
+
|
|
17
|
+
from .synthesis.heuristic_synthesizer import HeuristicSynthesizer
|
|
18
|
+
from .synthesis.random_synthesizer import RandomSynthesizer
|
|
19
|
+
from .synthesis.beam_synthesizer import BeamSynthesizer
|
|
20
|
+
from .synthesis.exhaustive_synthesizer import ExhaustiveSynthesizer
|
|
21
|
+
|
|
22
|
+
from .graph.agent_graph import AgentGraph
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"TaskSpecification",
|
|
26
|
+
"HeuristicSynthesizer",
|
|
27
|
+
"RandomSynthesizer",
|
|
28
|
+
"BeamSynthesizer",
|
|
29
|
+
"ExhaustiveSynthesizer",
|
|
30
|
+
"AgentGraph",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
__version__ = "0.4.0"
|