flatagents 0.1.8__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.
- flatagents/__init__.py +93 -0
- flatagents/assets/__init__.py +0 -0
- flatagents/assets/flatagent.d.ts +181 -0
- flatagents/assets/flatagent.schema.json +211 -0
- flatagents/assets/flatagent.slim.d.ts +51 -0
- flatagents/assets/flatmachine.d.ts +176 -0
- flatagents/assets/flatmachine.schema.json +405 -0
- flatagents/assets/flatmachine.slim.d.ts +47 -0
- flatagents/baseagent.py +811 -0
- flatagents/execution.py +471 -0
- flatagents/expressions/__init__.py +60 -0
- flatagents/expressions/cel.py +101 -0
- flatagents/expressions/simple.py +166 -0
- flatagents/flatagent.py +702 -0
- flatagents/flatmachine.py +482 -0
- flatagents/hooks.py +270 -0
- flatagents/validation.py +141 -0
- flatagents-0.1.8.dist-info/METADATA +287 -0
- flatagents-0.1.8.dist-info/RECORD +20 -0
- flatagents-0.1.8.dist-info/WHEEL +4 -0
flatagents/__init__.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
__version__ = "0.1.5"
|
|
2
|
+
|
|
3
|
+
from .baseagent import (
|
|
4
|
+
# Base agent (abstract, for multi-step agents)
|
|
5
|
+
FlatAgent as BaseFlatAgent,
|
|
6
|
+
# LLM Backends
|
|
7
|
+
LLMBackend,
|
|
8
|
+
LiteLLMBackend,
|
|
9
|
+
AISuiteBackend,
|
|
10
|
+
# Extractors
|
|
11
|
+
Extractor,
|
|
12
|
+
FreeExtractor,
|
|
13
|
+
FreeThinkingExtractor,
|
|
14
|
+
StructuredExtractor,
|
|
15
|
+
ToolsExtractor,
|
|
16
|
+
RegexExtractor,
|
|
17
|
+
# MCP Types
|
|
18
|
+
MCPToolProvider,
|
|
19
|
+
ToolCall,
|
|
20
|
+
AgentResponse,
|
|
21
|
+
)
|
|
22
|
+
from .flatagent import FlatAgent
|
|
23
|
+
from .flatmachine import FlatMachine
|
|
24
|
+
from .hooks import (
|
|
25
|
+
MachineHooks,
|
|
26
|
+
LoggingHooks,
|
|
27
|
+
MetricsHooks,
|
|
28
|
+
CompositeHooks,
|
|
29
|
+
)
|
|
30
|
+
from .expressions import get_expression_engine, ExpressionEngine
|
|
31
|
+
from .execution import (
|
|
32
|
+
ExecutionType,
|
|
33
|
+
DefaultExecution,
|
|
34
|
+
ParallelExecution,
|
|
35
|
+
RetryExecution,
|
|
36
|
+
MDAPVotingExecution,
|
|
37
|
+
get_execution_type,
|
|
38
|
+
)
|
|
39
|
+
from .validation import (
|
|
40
|
+
validate_flatagent_config,
|
|
41
|
+
validate_flatmachine_config,
|
|
42
|
+
get_flatagent_schema,
|
|
43
|
+
get_flatmachine_schema,
|
|
44
|
+
get_asset,
|
|
45
|
+
ValidationWarning,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
__all__ = [
|
|
49
|
+
"__version__",
|
|
50
|
+
# Main agent class
|
|
51
|
+
"FlatAgent",
|
|
52
|
+
# Base agent for custom multi-step agents
|
|
53
|
+
"BaseFlatAgent",
|
|
54
|
+
# State machine orchestration
|
|
55
|
+
"FlatMachine",
|
|
56
|
+
# Machine hooks
|
|
57
|
+
"MachineHooks",
|
|
58
|
+
"LoggingHooks",
|
|
59
|
+
"MetricsHooks",
|
|
60
|
+
"CompositeHooks",
|
|
61
|
+
# Expression engines
|
|
62
|
+
"ExpressionEngine",
|
|
63
|
+
"get_expression_engine",
|
|
64
|
+
# Execution types
|
|
65
|
+
"ExecutionType",
|
|
66
|
+
"DefaultExecution",
|
|
67
|
+
"ParallelExecution",
|
|
68
|
+
"RetryExecution",
|
|
69
|
+
"MDAPVotingExecution",
|
|
70
|
+
"get_execution_type",
|
|
71
|
+
# LLM Backends
|
|
72
|
+
"LLMBackend",
|
|
73
|
+
"LiteLLMBackend",
|
|
74
|
+
"AISuiteBackend",
|
|
75
|
+
# Extractors
|
|
76
|
+
"Extractor",
|
|
77
|
+
"FreeExtractor",
|
|
78
|
+
"FreeThinkingExtractor",
|
|
79
|
+
"StructuredExtractor",
|
|
80
|
+
"ToolsExtractor",
|
|
81
|
+
"RegexExtractor",
|
|
82
|
+
# MCP Types
|
|
83
|
+
"MCPToolProvider",
|
|
84
|
+
"ToolCall",
|
|
85
|
+
"AgentResponse",
|
|
86
|
+
# Validation
|
|
87
|
+
"validate_flatagent_config",
|
|
88
|
+
"validate_flatmachine_config",
|
|
89
|
+
"get_flatagent_schema",
|
|
90
|
+
"get_flatmachine_schema",
|
|
91
|
+
"get_asset",
|
|
92
|
+
"ValidationWarning",
|
|
93
|
+
]
|
|
File without changes
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FlatAgents Configuration Schema v0.6.0
|
|
3
|
+
* =============================================
|
|
4
|
+
*
|
|
5
|
+
* An agent is a single LLM call: model + prompts + output schema.
|
|
6
|
+
* Workflows handle composition, branching, and loops.
|
|
7
|
+
*
|
|
8
|
+
* STRUCTURE:
|
|
9
|
+
* ----------
|
|
10
|
+
* spec - Fixed string "flatagents"
|
|
11
|
+
* spec_version - Semver string (e.g., "0.1.0")
|
|
12
|
+
* data - The agent configuration
|
|
13
|
+
* metadata - Extensibility layer (runners ignore unrecognized keys)
|
|
14
|
+
*
|
|
15
|
+
* DATA FIELDS:
|
|
16
|
+
* ------------
|
|
17
|
+
* name - Agent identifier (inferred from filename if omitted)
|
|
18
|
+
* model - LLM configuration
|
|
19
|
+
* system - System prompt (Jinja2 template)
|
|
20
|
+
* user - User prompt template (Jinja2)
|
|
21
|
+
* instruction_suffix - Optional instruction appended after user prompt
|
|
22
|
+
* output - Output schema (what fields we want)
|
|
23
|
+
* mcp - Optional MCP (Model Context Protocol) configuration
|
|
24
|
+
*
|
|
25
|
+
* MCP FIELDS:
|
|
26
|
+
* -----------
|
|
27
|
+
* servers - Map of server name to MCPServerDef
|
|
28
|
+
* tool_filter - Optional allow/deny lists using "server:tool" format
|
|
29
|
+
* tool_prompt - Jinja2 template for tool prompt (uses {{ tools }} variable)
|
|
30
|
+
*
|
|
31
|
+
* MODEL FIELDS:
|
|
32
|
+
* -------------
|
|
33
|
+
* name - Model name (e.g., "gpt-4", "zai-glm-4.6")
|
|
34
|
+
* provider - Provider name (e.g., "openai", "anthropic", "cerebras")
|
|
35
|
+
* temperature - Sampling temperature (0.0 to 2.0)
|
|
36
|
+
* max_tokens - Maximum tokens to generate
|
|
37
|
+
* top_p - Nucleus sampling parameter
|
|
38
|
+
* frequency_penalty - Frequency penalty (-2.0 to 2.0)
|
|
39
|
+
* presence_penalty - Presence penalty (-2.0 to 2.0)
|
|
40
|
+
*
|
|
41
|
+
* OUTPUT FIELD DEFINITION:
|
|
42
|
+
* ------------------------
|
|
43
|
+
* type - Field type: str, int, float, bool, json, list, object
|
|
44
|
+
* description - Description (used for structured output / tool calls)
|
|
45
|
+
* enum - Allowed values (for enum-like fields)
|
|
46
|
+
* required - Whether the field is required (default: true)
|
|
47
|
+
* items - For list type: the type of items
|
|
48
|
+
* properties - For object type: nested properties
|
|
49
|
+
*
|
|
50
|
+
* TEMPLATE SYNTAX:
|
|
51
|
+
* ----------------
|
|
52
|
+
* Prompts use Jinja2 templating. Available variables:
|
|
53
|
+
* - input.* - Values passed to the agent at runtime
|
|
54
|
+
*
|
|
55
|
+
* Example: "Question: {{ input.question }}"
|
|
56
|
+
*
|
|
57
|
+
* EXAMPLE CONFIGURATION:
|
|
58
|
+
* ----------------------
|
|
59
|
+
*
|
|
60
|
+
* spec: flatagents
|
|
61
|
+
* spec_version: "0.6.0"
|
|
62
|
+
*
|
|
63
|
+
* data:
|
|
64
|
+
* name: critic
|
|
65
|
+
*
|
|
66
|
+
* model:
|
|
67
|
+
* provider: cerebras
|
|
68
|
+
* name: zai-glm-4.6
|
|
69
|
+
* temperature: 0.5
|
|
70
|
+
*
|
|
71
|
+
* system: |
|
|
72
|
+
* Act as a ruthless critic. Analyze drafts for errors.
|
|
73
|
+
* Rate severity as: High, Medium, or Low.
|
|
74
|
+
*
|
|
75
|
+
* user: |
|
|
76
|
+
* Question: {{ input.question }}
|
|
77
|
+
* Draft: {{ input.draft }}
|
|
78
|
+
*
|
|
79
|
+
* output:
|
|
80
|
+
* critique:
|
|
81
|
+
* type: str
|
|
82
|
+
* description: "Specific errors found in the draft"
|
|
83
|
+
* severity:
|
|
84
|
+
* type: str
|
|
85
|
+
* description: "Error severity"
|
|
86
|
+
* enum: ["High", "Medium", "Low"]
|
|
87
|
+
*
|
|
88
|
+
* metadata:
|
|
89
|
+
* description: "Critiques draft answers"
|
|
90
|
+
* tags: ["reflection", "qa"]
|
|
91
|
+
*
|
|
92
|
+
* MCPCONFIG:
|
|
93
|
+
* ----------
|
|
94
|
+
* MCP (Model Context Protocol) configuration.
|
|
95
|
+
* Defines MCP servers and tool filtering rules.
|
|
96
|
+
* servers - MCP server definitions, keyed by server name
|
|
97
|
+
* tool_filter - Optional tool filtering rules
|
|
98
|
+
* tool_prompt - Jinja2 template for tool prompt injection.
|
|
99
|
+
* Available variables: tools (list of discovered tools)
|
|
100
|
+
* Example: "{% for tool in tools %}{{ tool.name }}: {{ tool.description }}{% endfor %}"
|
|
101
|
+
*
|
|
102
|
+
* MCPSERVERDEF:
|
|
103
|
+
* -------------
|
|
104
|
+
* MCP server definition.
|
|
105
|
+
* Supports stdio transport (command) or HTTP transport (server_url).
|
|
106
|
+
* Stdio transport:
|
|
107
|
+
* command - Command to start the MCP server (e.g., "npx", "python")
|
|
108
|
+
* args - Arguments for the command
|
|
109
|
+
* env - Environment variables for the server process
|
|
110
|
+
* HTTP transport:
|
|
111
|
+
* server_url - Base URL of the MCP server (e.g., "http://localhost:8000")
|
|
112
|
+
* headers - HTTP headers (e.g., for authentication)
|
|
113
|
+
* timeout - Request timeout in seconds
|
|
114
|
+
*
|
|
115
|
+
* TOOLFILTER:
|
|
116
|
+
* -----------
|
|
117
|
+
* Tool filtering rules using "server:tool" format.
|
|
118
|
+
* Supports wildcards: "server:*" matches all tools from a server.
|
|
119
|
+
* allow - Tools to allow (if specified, only these are included)
|
|
120
|
+
* deny - Tools to deny (takes precedence over allow)
|
|
121
|
+
*/
|
|
122
|
+
|
|
123
|
+
export interface AgentWrapper {
|
|
124
|
+
spec: "flatagent";
|
|
125
|
+
spec_version: string;
|
|
126
|
+
data: AgentData;
|
|
127
|
+
metadata?: Record<string, any>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export interface AgentData {
|
|
131
|
+
name?: string;
|
|
132
|
+
model: ModelConfig;
|
|
133
|
+
system: string;
|
|
134
|
+
user: string;
|
|
135
|
+
instruction_suffix?: string;
|
|
136
|
+
output?: OutputSchema;
|
|
137
|
+
mcp?: MCPConfig;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface MCPConfig {
|
|
141
|
+
servers: Record<string, MCPServerDef>;
|
|
142
|
+
tool_filter?: ToolFilter;
|
|
143
|
+
tool_prompt: string;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface MCPServerDef {
|
|
147
|
+
command?: string;
|
|
148
|
+
args?: string[];
|
|
149
|
+
env?: Record<string, string>;
|
|
150
|
+
server_url?: string;
|
|
151
|
+
headers?: Record<string, string>;
|
|
152
|
+
timeout?: number;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface ToolFilter {
|
|
156
|
+
allow?: string[];
|
|
157
|
+
deny?: string[];
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface ModelConfig {
|
|
161
|
+
name: string;
|
|
162
|
+
provider?: string;
|
|
163
|
+
temperature?: number;
|
|
164
|
+
max_tokens?: number;
|
|
165
|
+
top_p?: number;
|
|
166
|
+
frequency_penalty?: number;
|
|
167
|
+
presence_penalty?: number;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export type OutputSchema = Record<string, OutputFieldDef>;
|
|
171
|
+
|
|
172
|
+
export interface OutputFieldDef {
|
|
173
|
+
type: "str" | "int" | "float" | "bool" | "json" | "list" | "object";
|
|
174
|
+
description?: string;
|
|
175
|
+
enum?: string[];
|
|
176
|
+
required?: boolean;
|
|
177
|
+
items?: OutputFieldDef;
|
|
178
|
+
properties?: OutputSchema;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export type FlatagentsConfig = AgentWrapper;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
"$ref": "#/definitions/AgentWrapper",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"AgentWrapper": {
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"spec": {
|
|
9
|
+
"type": "string",
|
|
10
|
+
"const": "flatagent"
|
|
11
|
+
},
|
|
12
|
+
"spec_version": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"data": {
|
|
16
|
+
"$ref": "#/definitions/AgentData"
|
|
17
|
+
},
|
|
18
|
+
"metadata": {
|
|
19
|
+
"type": "object"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"required": [
|
|
23
|
+
"spec",
|
|
24
|
+
"spec_version",
|
|
25
|
+
"data"
|
|
26
|
+
],
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"description": "FlatAgents Configuration Schema v0.6.0 =============================================\n\nAn agent is a single LLM call: model + prompts + output schema. Workflows handle composition, branching, and loops.\n\nSTRUCTURE:\n---------- spec - Fixed string \"flatagents\" spec_version - Semver string (e.g., \"0.1.0\") data - The agent configuration metadata - Extensibility layer (runners ignore unrecognized keys)\n\nDATA FIELDS:\n------------ name - Agent identifier (inferred from filename if omitted) model - LLM configuration system - System prompt (Jinja2 template) user - User prompt template (Jinja2) instruction_suffix - Optional instruction appended after user prompt output - Output schema (what fields we want) mcp - Optional MCP (Model Context Protocol) configuration\n\nMCP FIELDS:\n----------- servers - Map of server name to MCPServerDef tool_filter - Optional allow/deny lists using \"server:tool\" format tool_prompt - Jinja2 template for tool prompt (uses {{ tools }} variable)\n\nMODEL FIELDS:\n------------- name - Model name (e.g., \"gpt-4\", \"zai-glm-4.6\") provider - Provider name (e.g., \"openai\", \"anthropic\", \"cerebras\") temperature - Sampling temperature (0.0 to 2.0) max_tokens - Maximum tokens to generate top_p - Nucleus sampling parameter frequency_penalty - Frequency penalty (-2.0 to 2.0) presence_penalty - Presence penalty (-2.0 to 2.0)\n\nOUTPUT FIELD DEFINITION:\n------------------------ type - Field type: str, int, float, bool, json, list, object description - Description (used for structured output / tool calls) enum - Allowed values (for enum-like fields) required - Whether the field is required (default: true) items - For list type: the type of items properties - For object type: nested properties\n\nTEMPLATE SYNTAX:\n---------------- Prompts use Jinja2 templating. Available variables: - input.* - Values passed to the agent at runtime\n\nExample: \"Question: {{ input.question }}\"\n\nEXAMPLE CONFIGURATION:\n----------------------\n\n spec: flatagents spec_version: \"0.6.0\"\n\n data: name: critic\n\n model: provider: cerebras name: zai-glm-4.6 temperature: 0.5\n\n system: | Act as a ruthless critic. Analyze drafts for errors. Rate severity as: High, Medium, or Low.\n\n user: | Question: {{ input.question }} Draft: {{ input.draft }}\n\n output: critique: type: str description: \"Specific errors found in the draft\" severity: type: str description: \"Error severity\" enum: [\"High\", \"Medium\", \"Low\"]\n\n metadata: description: \"Critiques draft answers\" tags: [\"reflection\", \"qa\"]\n\nMCPCONFIG:\n---------- MCP (Model Context Protocol) configuration. Defines MCP servers and tool filtering rules. servers - MCP server definitions, keyed by server name tool_filter - Optional tool filtering rules tool_prompt - Jinja2 template for tool prompt injection. Available variables: tools (list of discovered tools) Example: \"{% for tool in tools %}{{ tool.name }}: {{ tool.description }}{% endfor %}\"\n\nMCPSERVERDEF:\n------------- MCP server definition. Supports stdio transport (command) or HTTP transport (server_url). Stdio transport: command - Command to start the MCP server (e.g., \"npx\", \"python\") args - Arguments for the command env - Environment variables for the server process HTTP transport: server_url - Base URL of the MCP server (e.g., \"http://localhost:8000\") headers - HTTP headers (e.g., for authentication) timeout - Request timeout in seconds\n\nTOOLFILTER:\n----------- Tool filtering rules using \"server:tool\" format. Supports wildcards: \"server:*\" matches all tools from a server. allow - Tools to allow (if specified, only these are included) deny - Tools to deny (takes precedence over allow)"
|
|
29
|
+
},
|
|
30
|
+
"AgentData": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"properties": {
|
|
33
|
+
"name": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"model": {
|
|
37
|
+
"$ref": "#/definitions/ModelConfig"
|
|
38
|
+
},
|
|
39
|
+
"system": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
"user": {
|
|
43
|
+
"type": "string"
|
|
44
|
+
},
|
|
45
|
+
"instruction_suffix": {
|
|
46
|
+
"type": "string"
|
|
47
|
+
},
|
|
48
|
+
"output": {
|
|
49
|
+
"$ref": "#/definitions/OutputSchema"
|
|
50
|
+
},
|
|
51
|
+
"mcp": {
|
|
52
|
+
"$ref": "#/definitions/MCPConfig"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"required": [
|
|
56
|
+
"model",
|
|
57
|
+
"system",
|
|
58
|
+
"user"
|
|
59
|
+
],
|
|
60
|
+
"additionalProperties": false
|
|
61
|
+
},
|
|
62
|
+
"ModelConfig": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"properties": {
|
|
65
|
+
"name": {
|
|
66
|
+
"type": "string"
|
|
67
|
+
},
|
|
68
|
+
"provider": {
|
|
69
|
+
"type": "string"
|
|
70
|
+
},
|
|
71
|
+
"temperature": {
|
|
72
|
+
"type": "number"
|
|
73
|
+
},
|
|
74
|
+
"max_tokens": {
|
|
75
|
+
"type": "number"
|
|
76
|
+
},
|
|
77
|
+
"top_p": {
|
|
78
|
+
"type": "number"
|
|
79
|
+
},
|
|
80
|
+
"frequency_penalty": {
|
|
81
|
+
"type": "number"
|
|
82
|
+
},
|
|
83
|
+
"presence_penalty": {
|
|
84
|
+
"type": "number"
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
"required": [
|
|
88
|
+
"name"
|
|
89
|
+
],
|
|
90
|
+
"additionalProperties": false
|
|
91
|
+
},
|
|
92
|
+
"OutputSchema": {
|
|
93
|
+
"type": "object",
|
|
94
|
+
"additionalProperties": {
|
|
95
|
+
"$ref": "#/definitions/OutputFieldDef"
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
"OutputFieldDef": {
|
|
99
|
+
"type": "object",
|
|
100
|
+
"properties": {
|
|
101
|
+
"type": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"enum": [
|
|
104
|
+
"str",
|
|
105
|
+
"int",
|
|
106
|
+
"float",
|
|
107
|
+
"bool",
|
|
108
|
+
"json",
|
|
109
|
+
"list",
|
|
110
|
+
"object"
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
"description": {
|
|
114
|
+
"type": "string"
|
|
115
|
+
},
|
|
116
|
+
"enum": {
|
|
117
|
+
"type": "array",
|
|
118
|
+
"items": {
|
|
119
|
+
"type": "string"
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"required": {
|
|
123
|
+
"type": "boolean"
|
|
124
|
+
},
|
|
125
|
+
"items": {
|
|
126
|
+
"$ref": "#/definitions/OutputFieldDef"
|
|
127
|
+
},
|
|
128
|
+
"properties": {
|
|
129
|
+
"$ref": "#/definitions/OutputSchema"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"required": [
|
|
133
|
+
"type"
|
|
134
|
+
],
|
|
135
|
+
"additionalProperties": false
|
|
136
|
+
},
|
|
137
|
+
"MCPConfig": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"properties": {
|
|
140
|
+
"servers": {
|
|
141
|
+
"type": "object",
|
|
142
|
+
"additionalProperties": {
|
|
143
|
+
"$ref": "#/definitions/MCPServerDef"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"tool_filter": {
|
|
147
|
+
"$ref": "#/definitions/ToolFilter"
|
|
148
|
+
},
|
|
149
|
+
"tool_prompt": {
|
|
150
|
+
"type": "string"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"required": [
|
|
154
|
+
"servers",
|
|
155
|
+
"tool_prompt"
|
|
156
|
+
],
|
|
157
|
+
"additionalProperties": false
|
|
158
|
+
},
|
|
159
|
+
"MCPServerDef": {
|
|
160
|
+
"type": "object",
|
|
161
|
+
"properties": {
|
|
162
|
+
"command": {
|
|
163
|
+
"type": "string"
|
|
164
|
+
},
|
|
165
|
+
"args": {
|
|
166
|
+
"type": "array",
|
|
167
|
+
"items": {
|
|
168
|
+
"type": "string"
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
"env": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"additionalProperties": {
|
|
174
|
+
"type": "string"
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
"server_url": {
|
|
178
|
+
"type": "string"
|
|
179
|
+
},
|
|
180
|
+
"headers": {
|
|
181
|
+
"type": "object",
|
|
182
|
+
"additionalProperties": {
|
|
183
|
+
"type": "string"
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
"timeout": {
|
|
187
|
+
"type": "number"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"additionalProperties": false
|
|
191
|
+
},
|
|
192
|
+
"ToolFilter": {
|
|
193
|
+
"type": "object",
|
|
194
|
+
"properties": {
|
|
195
|
+
"allow": {
|
|
196
|
+
"type": "array",
|
|
197
|
+
"items": {
|
|
198
|
+
"type": "string"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"deny": {
|
|
202
|
+
"type": "array",
|
|
203
|
+
"items": {
|
|
204
|
+
"type": "string"
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"additionalProperties": false
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface AgentWrapper {
|
|
2
|
+
spec: "flatagent";
|
|
3
|
+
spec_version: string;
|
|
4
|
+
data: AgentData;
|
|
5
|
+
metadata?: Record<string, any>;
|
|
6
|
+
}
|
|
7
|
+
export interface AgentData {
|
|
8
|
+
name?: string;
|
|
9
|
+
model: ModelConfig;
|
|
10
|
+
system: string;
|
|
11
|
+
user: string;
|
|
12
|
+
instruction_suffix?: string;
|
|
13
|
+
output?: OutputSchema;
|
|
14
|
+
mcp?: MCPConfig;
|
|
15
|
+
}
|
|
16
|
+
export interface MCPConfig {
|
|
17
|
+
servers: Record<string, MCPServerDef>;
|
|
18
|
+
tool_filter?: ToolFilter;
|
|
19
|
+
tool_prompt: string;
|
|
20
|
+
}
|
|
21
|
+
export interface MCPServerDef {
|
|
22
|
+
command?: string;
|
|
23
|
+
args?: string[];
|
|
24
|
+
env?: Record<string, string>;
|
|
25
|
+
server_url?: string;
|
|
26
|
+
headers?: Record<string, string>;
|
|
27
|
+
timeout?: number;
|
|
28
|
+
}
|
|
29
|
+
export interface ToolFilter {
|
|
30
|
+
allow?: string[];
|
|
31
|
+
deny?: string[];
|
|
32
|
+
}
|
|
33
|
+
export interface ModelConfig {
|
|
34
|
+
name: string;
|
|
35
|
+
provider?: string;
|
|
36
|
+
temperature?: number;
|
|
37
|
+
max_tokens?: number;
|
|
38
|
+
top_p?: number;
|
|
39
|
+
frequency_penalty?: number;
|
|
40
|
+
presence_penalty?: number;
|
|
41
|
+
}
|
|
42
|
+
export type OutputSchema = Record<string, OutputFieldDef>;
|
|
43
|
+
export interface OutputFieldDef {
|
|
44
|
+
type: "str" | "int" | "float" | "bool" | "json" | "list" | "object";
|
|
45
|
+
description?: string;
|
|
46
|
+
enum?: string[];
|
|
47
|
+
required?: boolean;
|
|
48
|
+
items?: OutputFieldDef;
|
|
49
|
+
properties?: OutputSchema;
|
|
50
|
+
}
|
|
51
|
+
export type FlatagentsConfig = AgentWrapper;
|