flatagents 0.4.1__py3-none-any.whl

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.
@@ -0,0 +1,515 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$ref": "#/definitions/MachineWrapper",
4
+ "definitions": {
5
+ "MachineWrapper": {
6
+ "type": "object",
7
+ "properties": {
8
+ "spec": {
9
+ "type": "string",
10
+ "const": "flatmachine"
11
+ },
12
+ "spec_version": {
13
+ "type": "string"
14
+ },
15
+ "data": {
16
+ "$ref": "#/definitions/MachineData"
17
+ },
18
+ "metadata": {
19
+ "type": "object"
20
+ }
21
+ },
22
+ "required": [
23
+ "spec",
24
+ "spec_version",
25
+ "data"
26
+ ],
27
+ "additionalProperties": false,
28
+ "description": "URI Scheme for FlatAgents\n\nFormat: flatagents://{execution_id}[/{path}]\n\nPaths: /checkpoint - Machine state for resume /result - Final output after completion\n\nExamples: flatagents://550e8400-e29b-41d4-a716-446655440000/checkpoint flatagents://550e8400-e29b-41d4-a716-446655440000/result\n\nEach machine execution has a unique_id. Parent generates child's ID before launching, enabling parent to know where to read results without any child-to-parent messaging."
29
+ },
30
+ "MachineData": {
31
+ "type": "object",
32
+ "properties": {
33
+ "name": {
34
+ "type": "string"
35
+ },
36
+ "expression_engine": {
37
+ "type": "string",
38
+ "enum": [
39
+ "simple",
40
+ "cel"
41
+ ]
42
+ },
43
+ "context": {
44
+ "type": "object"
45
+ },
46
+ "agents": {
47
+ "type": "object",
48
+ "additionalProperties": {
49
+ "anyOf": [
50
+ {
51
+ "type": "string"
52
+ },
53
+ {
54
+ "$ref": "#/definitions/AgentWrapper"
55
+ }
56
+ ]
57
+ }
58
+ },
59
+ "machines": {
60
+ "type": "object",
61
+ "additionalProperties": {
62
+ "anyOf": [
63
+ {
64
+ "type": "string"
65
+ },
66
+ {
67
+ "$ref": "#/definitions/MachineWrapper"
68
+ }
69
+ ]
70
+ }
71
+ },
72
+ "states": {
73
+ "type": "object",
74
+ "additionalProperties": {
75
+ "$ref": "#/definitions/StateDefinition"
76
+ }
77
+ },
78
+ "settings": {
79
+ "$ref": "#/definitions/MachineSettings"
80
+ },
81
+ "persistence": {
82
+ "$ref": "#/definitions/PersistenceConfig"
83
+ }
84
+ },
85
+ "required": [
86
+ "states"
87
+ ],
88
+ "additionalProperties": false
89
+ },
90
+ "AgentWrapper": {
91
+ "type": "object",
92
+ "properties": {
93
+ "spec": {
94
+ "type": "string",
95
+ "const": "flatagent"
96
+ },
97
+ "spec_version": {
98
+ "type": "string"
99
+ },
100
+ "data": {
101
+ "$ref": "#/definitions/AgentData"
102
+ },
103
+ "metadata": {
104
+ "type": "object"
105
+ }
106
+ },
107
+ "required": [
108
+ "spec",
109
+ "spec_version",
110
+ "data"
111
+ ],
112
+ "additionalProperties": false
113
+ },
114
+ "AgentData": {
115
+ "type": "object",
116
+ "properties": {
117
+ "name": {
118
+ "type": "string"
119
+ },
120
+ "model": {
121
+ "$ref": "#/definitions/ModelConfig"
122
+ },
123
+ "system": {
124
+ "type": "string"
125
+ },
126
+ "user": {
127
+ "type": "string"
128
+ },
129
+ "instruction_suffix": {
130
+ "type": "string"
131
+ },
132
+ "output": {
133
+ "$ref": "#/definitions/OutputSchema"
134
+ },
135
+ "mcp": {
136
+ "$ref": "#/definitions/MCPConfig"
137
+ }
138
+ },
139
+ "required": [
140
+ "model",
141
+ "system",
142
+ "user"
143
+ ],
144
+ "additionalProperties": false
145
+ },
146
+ "ModelConfig": {
147
+ "type": "object",
148
+ "properties": {
149
+ "name": {
150
+ "type": "string"
151
+ },
152
+ "provider": {
153
+ "type": "string"
154
+ },
155
+ "temperature": {
156
+ "type": "number"
157
+ },
158
+ "max_tokens": {
159
+ "type": "number"
160
+ },
161
+ "top_p": {
162
+ "type": "number"
163
+ },
164
+ "frequency_penalty": {
165
+ "type": "number"
166
+ },
167
+ "presence_penalty": {
168
+ "type": "number"
169
+ }
170
+ },
171
+ "required": [
172
+ "name"
173
+ ],
174
+ "additionalProperties": false
175
+ },
176
+ "OutputSchema": {
177
+ "type": "object",
178
+ "additionalProperties": {
179
+ "$ref": "#/definitions/OutputFieldDef"
180
+ }
181
+ },
182
+ "OutputFieldDef": {
183
+ "type": "object",
184
+ "properties": {
185
+ "type": {
186
+ "type": "string",
187
+ "enum": [
188
+ "str",
189
+ "int",
190
+ "float",
191
+ "bool",
192
+ "json",
193
+ "list",
194
+ "object"
195
+ ]
196
+ },
197
+ "description": {
198
+ "type": "string"
199
+ },
200
+ "enum": {
201
+ "type": "array",
202
+ "items": {
203
+ "type": "string"
204
+ }
205
+ },
206
+ "required": {
207
+ "type": "boolean"
208
+ },
209
+ "items": {
210
+ "$ref": "#/definitions/OutputFieldDef"
211
+ },
212
+ "properties": {
213
+ "$ref": "#/definitions/OutputSchema"
214
+ }
215
+ },
216
+ "required": [
217
+ "type"
218
+ ],
219
+ "additionalProperties": false
220
+ },
221
+ "MCPConfig": {
222
+ "type": "object",
223
+ "properties": {
224
+ "servers": {
225
+ "type": "object",
226
+ "additionalProperties": {
227
+ "$ref": "#/definitions/MCPServerDef"
228
+ }
229
+ },
230
+ "tool_filter": {
231
+ "$ref": "#/definitions/ToolFilter"
232
+ },
233
+ "tool_prompt": {
234
+ "type": "string"
235
+ }
236
+ },
237
+ "required": [
238
+ "servers",
239
+ "tool_prompt"
240
+ ],
241
+ "additionalProperties": false
242
+ },
243
+ "MCPServerDef": {
244
+ "type": "object",
245
+ "properties": {
246
+ "command": {
247
+ "type": "string"
248
+ },
249
+ "args": {
250
+ "type": "array",
251
+ "items": {
252
+ "type": "string"
253
+ }
254
+ },
255
+ "env": {
256
+ "type": "object",
257
+ "additionalProperties": {
258
+ "type": "string"
259
+ }
260
+ },
261
+ "server_url": {
262
+ "type": "string"
263
+ },
264
+ "headers": {
265
+ "type": "object",
266
+ "additionalProperties": {
267
+ "type": "string"
268
+ }
269
+ },
270
+ "timeout": {
271
+ "type": "number"
272
+ }
273
+ },
274
+ "additionalProperties": false
275
+ },
276
+ "ToolFilter": {
277
+ "type": "object",
278
+ "properties": {
279
+ "allow": {
280
+ "type": "array",
281
+ "items": {
282
+ "type": "string"
283
+ }
284
+ },
285
+ "deny": {
286
+ "type": "array",
287
+ "items": {
288
+ "type": "string"
289
+ }
290
+ }
291
+ },
292
+ "additionalProperties": false
293
+ },
294
+ "StateDefinition": {
295
+ "type": "object",
296
+ "properties": {
297
+ "type": {
298
+ "type": "string",
299
+ "enum": [
300
+ "initial",
301
+ "final"
302
+ ]
303
+ },
304
+ "agent": {
305
+ "type": "string"
306
+ },
307
+ "machine": {
308
+ "anyOf": [
309
+ {
310
+ "type": "string"
311
+ },
312
+ {
313
+ "type": "array",
314
+ "items": {
315
+ "type": "string"
316
+ }
317
+ },
318
+ {
319
+ "type": "array",
320
+ "items": {
321
+ "$ref": "#/definitions/MachineInput"
322
+ }
323
+ }
324
+ ]
325
+ },
326
+ "action": {
327
+ "type": "string"
328
+ },
329
+ "execution": {
330
+ "$ref": "#/definitions/ExecutionConfig"
331
+ },
332
+ "on_error": {
333
+ "anyOf": [
334
+ {
335
+ "type": "string"
336
+ },
337
+ {
338
+ "type": "object",
339
+ "additionalProperties": {
340
+ "type": "string"
341
+ }
342
+ }
343
+ ]
344
+ },
345
+ "input": {
346
+ "type": "object"
347
+ },
348
+ "output_to_context": {
349
+ "type": "object"
350
+ },
351
+ "output": {
352
+ "type": "object"
353
+ },
354
+ "transitions": {
355
+ "type": "array",
356
+ "items": {
357
+ "$ref": "#/definitions/Transition"
358
+ }
359
+ },
360
+ "tool_loop": {
361
+ "type": "boolean"
362
+ },
363
+ "sampling": {
364
+ "type": "string",
365
+ "enum": [
366
+ "single",
367
+ "multi"
368
+ ]
369
+ },
370
+ "foreach": {
371
+ "type": "string"
372
+ },
373
+ "as": {
374
+ "type": "string"
375
+ },
376
+ "key": {
377
+ "type": "string"
378
+ },
379
+ "mode": {
380
+ "type": "string",
381
+ "enum": [
382
+ "settled",
383
+ "any"
384
+ ]
385
+ },
386
+ "timeout": {
387
+ "type": "number"
388
+ },
389
+ "launch": {
390
+ "anyOf": [
391
+ {
392
+ "type": "string"
393
+ },
394
+ {
395
+ "type": "array",
396
+ "items": {
397
+ "type": "string"
398
+ }
399
+ }
400
+ ]
401
+ },
402
+ "launch_input": {
403
+ "type": "object"
404
+ }
405
+ },
406
+ "additionalProperties": false
407
+ },
408
+ "MachineInput": {
409
+ "type": "object",
410
+ "properties": {
411
+ "name": {
412
+ "type": "string"
413
+ },
414
+ "input": {
415
+ "type": "object"
416
+ }
417
+ },
418
+ "required": [
419
+ "name"
420
+ ],
421
+ "additionalProperties": false,
422
+ "description": "Per-machine input configuration for parallel execution. Use when different machines need different inputs."
423
+ },
424
+ "ExecutionConfig": {
425
+ "type": "object",
426
+ "properties": {
427
+ "type": {
428
+ "type": "string",
429
+ "enum": [
430
+ "default",
431
+ "retry",
432
+ "parallel",
433
+ "mdap_voting"
434
+ ]
435
+ },
436
+ "backoffs": {
437
+ "type": "array",
438
+ "items": {
439
+ "type": "number"
440
+ }
441
+ },
442
+ "jitter": {
443
+ "type": "number"
444
+ },
445
+ "n_samples": {
446
+ "type": "number"
447
+ },
448
+ "k_margin": {
449
+ "type": "number"
450
+ },
451
+ "max_candidates": {
452
+ "type": "number"
453
+ }
454
+ },
455
+ "required": [
456
+ "type"
457
+ ],
458
+ "additionalProperties": false
459
+ },
460
+ "Transition": {
461
+ "type": "object",
462
+ "properties": {
463
+ "condition": {
464
+ "type": "string"
465
+ },
466
+ "to": {
467
+ "type": "string"
468
+ }
469
+ },
470
+ "required": [
471
+ "to"
472
+ ],
473
+ "additionalProperties": false
474
+ },
475
+ "MachineSettings": {
476
+ "type": "object",
477
+ "properties": {
478
+ "hooks": {
479
+ "type": "string"
480
+ },
481
+ "max_steps": {
482
+ "type": "number"
483
+ },
484
+ "parallel_fallback": {
485
+ "type": "string",
486
+ "enum": [
487
+ "sequential",
488
+ "error"
489
+ ]
490
+ }
491
+ }
492
+ },
493
+ "PersistenceConfig": {
494
+ "type": "object",
495
+ "properties": {
496
+ "enabled": {
497
+ "type": "boolean"
498
+ },
499
+ "backend": {
500
+ "type": "string"
501
+ },
502
+ "checkpoint_on": {
503
+ "type": "array",
504
+ "items": {
505
+ "type": "string"
506
+ }
507
+ }
508
+ },
509
+ "required": [
510
+ "enabled",
511
+ "backend"
512
+ ]
513
+ }
514
+ }
515
+ }
@@ -0,0 +1,94 @@
1
+ export const SPEC_VERSION = "0.4.0";
2
+ export interface MachineWrapper {
3
+ spec: "flatmachine";
4
+ spec_version: string;
5
+ data: MachineData;
6
+ metadata?: Record<string, any>;
7
+ }
8
+ export interface MachineData {
9
+ name?: string;
10
+ expression_engine?: "simple" | "cel";
11
+ context?: Record<string, any>;
12
+ agents?: Record<string, string | AgentWrapper>;
13
+ machines?: Record<string, string | MachineWrapper>;
14
+ states: Record<string, StateDefinition>;
15
+ settings?: MachineSettings;
16
+ persistence?: PersistenceConfig;
17
+ }
18
+ export interface MachineSettings {
19
+ hooks?: string;
20
+ max_steps?: number;
21
+ parallel_fallback?: "sequential" | "error";
22
+ [key: string]: any;
23
+ }
24
+ export interface StateDefinition {
25
+ type?: "initial" | "final";
26
+ agent?: string;
27
+ machine?: string | string[] | MachineInput[];
28
+ action?: string;
29
+ execution?: ExecutionConfig;
30
+ on_error?: string | Record<string, string>;
31
+ input?: Record<string, any>;
32
+ output_to_context?: Record<string, any>;
33
+ output?: Record<string, any>;
34
+ transitions?: Transition[];
35
+ tool_loop?: boolean;
36
+ sampling?: "single" | "multi";
37
+ foreach?: string;
38
+ as?: string;
39
+ key?: string;
40
+ mode?: "settled" | "any";
41
+ timeout?: number;
42
+ launch?: string | string[];
43
+ launch_input?: Record<string, any>;
44
+ }
45
+ export interface MachineInput {
46
+ name: string;
47
+ input?: Record<string, any>;
48
+ }
49
+ export interface ExecutionConfig {
50
+ type: "default" | "retry" | "parallel" | "mdap_voting";
51
+ backoffs?: number[];
52
+ jitter?: number;
53
+ n_samples?: number;
54
+ k_margin?: number;
55
+ max_candidates?: number;
56
+ }
57
+ export interface Transition {
58
+ condition?: string;
59
+ to: string;
60
+ }
61
+ import { AgentWrapper, OutputSchema, ModelConfig } from "./flatagent";
62
+ export { AgentWrapper, OutputSchema };
63
+ export type FlatmachineConfig = MachineWrapper;
64
+ export interface LaunchIntent {
65
+ execution_id: string;
66
+ machine: string;
67
+ input: Record<string, any>;
68
+ launched: boolean;
69
+ }
70
+ export interface MachineSnapshot {
71
+ execution_id: string;
72
+ machine_name: string;
73
+ spec_version: string;
74
+ current_state: string;
75
+ context: Record<string, any>;
76
+ step: number;
77
+ created_at: string;
78
+ event?: string;
79
+ output?: Record<string, any>;
80
+ total_api_calls?: number;
81
+ total_cost?: number;
82
+ parent_execution_id?: string;
83
+ pending_launches?: LaunchIntent[];
84
+ }
85
+ export interface PersistenceConfig {
86
+ enabled: boolean;
87
+ backend: "local" | "redis" | "memory" | string;
88
+ checkpoint_on?: string[];
89
+ [key: string]: any;
90
+ }
91
+ export interface MachineReference {
92
+ path?: string;
93
+ inline?: MachineWrapper;
94
+ }