agentsml-impl 0.2.0__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.
Files changed (129) hide show
  1. agentsml_impl/__init__.py +3 -0
  2. agentsml_impl/cli.py +472 -0
  3. agentsml_impl/compiler/__init__.py +1 -0
  4. agentsml_impl/compiler/capabilities.py +330 -0
  5. agentsml_impl/compiler/conditions.py +177 -0
  6. agentsml_impl/compiler/diagnostics.py +112 -0
  7. agentsml_impl/compiler/durations.py +31 -0
  8. agentsml_impl/compiler/expressions.py +123 -0
  9. agentsml_impl/compiler/identifiers.py +60 -0
  10. agentsml_impl/compiler/ir.py +391 -0
  11. agentsml_impl/compiler/limits.py +28 -0
  12. agentsml_impl/compiler/loader.py +83 -0
  13. agentsml_impl/compiler/naming.py +87 -0
  14. agentsml_impl/compiler/planner.py +79 -0
  15. agentsml_impl/compiler/render.py +90 -0
  16. agentsml_impl/compiler/schema_validation.py +121 -0
  17. agentsml_impl/compiler/semantic_validation.py +424 -0
  18. agentsml_impl/protocols/__init__.py +1 -0
  19. agentsml_impl/runtime/__init__.py +1 -0
  20. agentsml_impl/runtime/events.py +59 -0
  21. agentsml_impl/runtime/json_schema.py +138 -0
  22. agentsml_impl/runtime/tools.py +145 -0
  23. agentsml_impl/schemas/agentsml.schema.json +406 -0
  24. agentsml_impl/schemas/v0.1/agentsml.schema.json +628 -0
  25. agentsml_impl/schemas/v0.2/agentsml.schema.json +363 -0
  26. agentsml_impl/schemas/v0.3/agentsml.schema.json +406 -0
  27. agentsml_impl/targets/__init__.py +1 -0
  28. agentsml_impl/targets/a2a/__init__.py +0 -0
  29. agentsml_impl/targets/a2a/adapter.py +94 -0
  30. agentsml_impl/targets/a2a/capabilities.yaml +25 -0
  31. agentsml_impl/targets/ag2/__init__.py +0 -0
  32. agentsml_impl/targets/ag2/adapter.py +655 -0
  33. agentsml_impl/targets/ag2/capabilities.yaml +37 -0
  34. agentsml_impl/targets/ag_ui/__init__.py +0 -0
  35. agentsml_impl/targets/ag_ui/adapter.py +123 -0
  36. agentsml_impl/targets/ag_ui/capabilities.yaml +25 -0
  37. agentsml_impl/targets/agno/__init__.py +0 -0
  38. agentsml_impl/targets/agno/adapter.py +191 -0
  39. agentsml_impl/targets/agno/capabilities.yaml +26 -0
  40. agentsml_impl/targets/ap2/__init__.py +0 -0
  41. agentsml_impl/targets/ap2/adapter.py +84 -0
  42. agentsml_impl/targets/ap2/capabilities.yaml +25 -0
  43. agentsml_impl/targets/base.py +157 -0
  44. agentsml_impl/targets/bedrock_agentcore/__init__.py +0 -0
  45. agentsml_impl/targets/bedrock_agentcore/adapter.py +592 -0
  46. agentsml_impl/targets/bedrock_agentcore/capabilities.yaml +26 -0
  47. agentsml_impl/targets/claude_agent_sdk/__init__.py +0 -0
  48. agentsml_impl/targets/claude_agent_sdk/adapter.py +178 -0
  49. agentsml_impl/targets/claude_agent_sdk/capabilities.yaml +26 -0
  50. agentsml_impl/targets/crewai/__init__.py +0 -0
  51. agentsml_impl/targets/crewai/adapter.py +441 -0
  52. agentsml_impl/targets/crewai/capabilities.yaml +30 -0
  53. agentsml_impl/targets/databricks/__init__.py +0 -0
  54. agentsml_impl/targets/databricks/adapter.py +427 -0
  55. agentsml_impl/targets/databricks/capabilities.yaml +26 -0
  56. agentsml_impl/targets/flowise/__init__.py +0 -0
  57. agentsml_impl/targets/flowise/adapter.py +71 -0
  58. agentsml_impl/targets/flowise/capabilities.yaml +26 -0
  59. agentsml_impl/targets/google_adk/__init__.py +0 -0
  60. agentsml_impl/targets/google_adk/adapter.py +589 -0
  61. agentsml_impl/targets/google_adk/capabilities.yaml +36 -0
  62. agentsml_impl/targets/langchain/__init__.py +1 -0
  63. agentsml_impl/targets/langchain/adapter.py +351 -0
  64. agentsml_impl/targets/langchain/capabilities.yaml +30 -0
  65. agentsml_impl/targets/langflow/__init__.py +0 -0
  66. agentsml_impl/targets/langflow/adapter.py +147 -0
  67. agentsml_impl/targets/langflow/capabilities.yaml +26 -0
  68. agentsml_impl/targets/langgraph/__init__.py +0 -0
  69. agentsml_impl/targets/langgraph/adapter.py +911 -0
  70. agentsml_impl/targets/langgraph/capabilities.yaml +33 -0
  71. agentsml_impl/targets/llamaindex/__init__.py +1 -0
  72. agentsml_impl/targets/llamaindex/adapter.py +406 -0
  73. agentsml_impl/targets/llamaindex/capabilities.yaml +31 -0
  74. agentsml_impl/targets/lyzr/__init__.py +0 -0
  75. agentsml_impl/targets/lyzr/adapter.py +146 -0
  76. agentsml_impl/targets/lyzr/capabilities.yaml +26 -0
  77. agentsml_impl/targets/mastra/__init__.py +0 -0
  78. agentsml_impl/targets/mastra/adapter.py +635 -0
  79. agentsml_impl/targets/mastra/capabilities.yaml +32 -0
  80. agentsml_impl/targets/mcp_server/__init__.py +0 -0
  81. agentsml_impl/targets/mcp_server/adapter.py +141 -0
  82. agentsml_impl/targets/mcp_server/capabilities.yaml +25 -0
  83. agentsml_impl/targets/microsoft_agent_framework/__init__.py +0 -0
  84. agentsml_impl/targets/microsoft_agent_framework/adapter.py +563 -0
  85. agentsml_impl/targets/microsoft_agent_framework/capabilities.yaml +26 -0
  86. agentsml_impl/targets/n8n/__init__.py +0 -0
  87. agentsml_impl/targets/n8n/adapter.py +139 -0
  88. agentsml_impl/targets/n8n/capabilities.yaml +26 -0
  89. agentsml_impl/targets/openai_agents/__init__.py +0 -0
  90. agentsml_impl/targets/openai_agents/adapter.py +175 -0
  91. agentsml_impl/targets/openai_agents/capabilities.yaml +27 -0
  92. agentsml_impl/targets/pydantic_ai/__init__.py +0 -0
  93. agentsml_impl/targets/pydantic_ai/adapter.py +922 -0
  94. agentsml_impl/targets/pydantic_ai/capabilities.yaml +37 -0
  95. agentsml_impl/targets/registry.py +290 -0
  96. agentsml_impl/targets/relevance_ai/__init__.py +0 -0
  97. agentsml_impl/targets/relevance_ai/adapter.py +66 -0
  98. agentsml_impl/targets/relevance_ai/capabilities.yaml +26 -0
  99. agentsml_impl/targets/smolagents/__init__.py +0 -0
  100. agentsml_impl/targets/smolagents/adapter.py +210 -0
  101. agentsml_impl/targets/smolagents/capabilities.yaml +27 -0
  102. agentsml_impl/targets/snowflake_cortex/__init__.py +0 -0
  103. agentsml_impl/targets/snowflake_cortex/adapter.py +167 -0
  104. agentsml_impl/targets/snowflake_cortex/capabilities.yaml +26 -0
  105. agentsml_impl/targets/spring_ai/__init__.py +1 -0
  106. agentsml_impl/targets/spring_ai/adapter.py +626 -0
  107. agentsml_impl/targets/spring_ai/capabilities.yaml +31 -0
  108. agentsml_impl/targets/strands_agents/__init__.py +1 -0
  109. agentsml_impl/targets/strands_agents/adapter.py +309 -0
  110. agentsml_impl/targets/strands_agents/capabilities.yaml +29 -0
  111. agentsml_impl/targets/support_matrix.py +91 -0
  112. agentsml_impl/targets/ucp/__init__.py +0 -0
  113. agentsml_impl/targets/ucp/adapter.py +86 -0
  114. agentsml_impl/targets/ucp/capabilities.yaml +25 -0
  115. agentsml_impl/targets/vercel_ai/__init__.py +1 -0
  116. agentsml_impl/targets/vercel_ai/adapter.py +349 -0
  117. agentsml_impl/targets/vercel_ai/capabilities.yaml +30 -0
  118. agentsml_impl/targets/vertex_agent_engine/__init__.py +0 -0
  119. agentsml_impl/targets/vertex_agent_engine/adapter.py +407 -0
  120. agentsml_impl/targets/vertex_agent_engine/capabilities.yaml +26 -0
  121. agentsml_impl/targets/zapier_agents/__init__.py +0 -0
  122. agentsml_impl/targets/zapier_agents/adapter.py +106 -0
  123. agentsml_impl/targets/zapier_agents/capabilities.yaml +26 -0
  124. agentsml_impl-0.2.0.dist-info/METADATA +109 -0
  125. agentsml_impl-0.2.0.dist-info/RECORD +129 -0
  126. agentsml_impl-0.2.0.dist-info/WHEEL +5 -0
  127. agentsml_impl-0.2.0.dist-info/entry_points.txt +3 -0
  128. agentsml_impl-0.2.0.dist-info/licenses/LICENSE +28 -0
  129. agentsml_impl-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,167 @@
1
+ """Snowflake Cortex target adapter — Level 1 code generation."""
2
+
3
+ from __future__ import annotations
4
+ from pathlib import Path
5
+
6
+ from agentsml_impl.compiler.identifiers import python_identifier_ir
7
+ from agentsml_impl.compiler.ir import AgentSystemIR, ModelIR
8
+ from agentsml_impl.compiler.diagnostics import DiagCode, DiagnosticSet
9
+ from agentsml_impl.compiler.planner import GenerationPlan
10
+ from agentsml_impl.compiler.render import toml_string, write_file
11
+ from agentsml_impl.runtime.tools import generate_tools_module
12
+ from agentsml_impl.targets.base import TargetAdapter, GenerationResult
13
+
14
+
15
+ class Adapter(TargetAdapter):
16
+ @property
17
+ def name(self) -> str:
18
+ return "snowflake-cortex"
19
+
20
+ def analyze(self, ir: AgentSystemIR, diagnostics: DiagnosticSet) -> None:
21
+ from agentsml_impl.compiler.capabilities import analyze_capabilities
22
+ analyze_capabilities(ir, "snowflake_cortex", diagnostics)
23
+
24
+ def generate(self, ir: AgentSystemIR, plan: GenerationPlan,
25
+ out_dir: Path, diagnostics: DiagnosticSet) -> GenerationResult:
26
+ ir = python_identifier_ir(ir)
27
+ out_dir.mkdir(parents=True, exist_ok=True)
28
+ pkg = plan.package_name
29
+ src = out_dir / "src" / pkg
30
+ src.mkdir(parents=True, exist_ok=True)
31
+
32
+ files: list[str] = []
33
+ files += _write_pyproject(ir, plan, out_dir)
34
+ files += _write_tools(ir, src, out_dir, diagnostics)
35
+ files += _write_agent(ir, plan, src, out_dir, diagnostics)
36
+ files += _write_run(plan, src, out_dir)
37
+ files += _write_init(src, out_dir)
38
+ files += _write_readme(ir, plan, out_dir)
39
+
40
+ return GenerationResult(
41
+ target=self.name, out_dir=out_dir, files_written=files, success=True
42
+ )
43
+
44
+
45
+ def _write_pyproject(ir: AgentSystemIR, plan: GenerationPlan, out_dir: Path) -> list[str]:
46
+ c = f'''\
47
+ [build-system]
48
+ requires = ["setuptools>=68"]
49
+ build-backend = "setuptools.build_meta"
50
+
51
+ [project]
52
+ name = "{plan.package_name}"
53
+ version = "{ir.metadata.version or '0.1.0'}"
54
+ description = {toml_string(ir.metadata.description or plan.project_name)}
55
+ requires-python = ">=3.11"
56
+ dependencies = [
57
+ "snowflake-snowpark-python",
58
+ "snowflake-ml-python",
59
+ "python-dotenv"
60
+ ]
61
+
62
+ [tool.setuptools.packages.find]
63
+ where = ["src"]
64
+ '''
65
+ write_file(out_dir, "pyproject.toml", c)
66
+ return ["pyproject.toml"]
67
+
68
+
69
+ def _write_tools(ir: AgentSystemIR, src: Path, out_dir: Path, ds: DiagnosticSet) -> list[str]:
70
+ if not ir.tools:
71
+ return []
72
+ c = generate_tools_module(ir.tools, ds, framework="snowflake_cortex")
73
+ rel = f"src/{src.name}/tools.py"
74
+ write_file(out_dir, rel, c)
75
+ return [rel]
76
+
77
+
78
+ def _write_agent(ir: AgentSystemIR, plan: GenerationPlan, src: Path, out_dir: Path, ds: DiagnosticSet) -> list[str]:
79
+ agent_blocks: list[str] = []
80
+ tools_import = f"from .tools import {', '.join(ir.tools.keys())}" if ir.tools else ""
81
+
82
+ for ak, agent in ir.agents.items():
83
+ m = ir.models.get(agent.model)
84
+ mstr = m.name if m else 'snowflake-arctic'
85
+ inst = agent.instructions.replace('"""', "'''")
86
+
87
+ agent_blocks.append(f'''\
88
+ class {ak.capitalize()}Agent:
89
+ def __init__(self, session):
90
+ self.session = session
91
+ self.model = "{mstr}"
92
+ self.system_prompt = """{inst}"""
93
+
94
+ def complete(self, prompt: str):
95
+ from snowflake.cortex import Complete
96
+ full_prompt = f"{{self.system_prompt}}\\n\\n{{prompt}}"
97
+ return Complete(self.model, full_prompt, session=self.session)
98
+ ''')
99
+
100
+ c = f'''\
101
+ """Snowflake Cortex Agent definitions for {plan.project_name}."""
102
+ from __future__ import annotations
103
+ {tools_import}
104
+
105
+ {chr(10).join(agent_blocks)}
106
+ '''
107
+ rel = f"src/{src.name}/agent.py"
108
+ write_file(out_dir, rel, c)
109
+ return [rel]
110
+
111
+
112
+ def _write_run(plan: GenerationPlan, src: Path, out_dir: Path) -> list[str]:
113
+ c = f'''\
114
+ """Runner for {plan.project_name} (Snowflake Cortex)."""
115
+ from __future__ import annotations
116
+ import sys
117
+ from snowflake.snowpark import Session
118
+ from .agent import *
119
+
120
+ def main():
121
+ q = " ".join(sys.argv[1:]) or "Hello"
122
+
123
+ # Establish Snowflake session (requires credentials in env or config)
124
+ try:
125
+ session = Session.builder.getOrCreate()
126
+ except Exception as e:
127
+ print("Failed to create Snowflake session. Configure SNOWFLAKE_ACCOUNT, SNOWFLAKE_USER, etc.")
128
+ return
129
+
130
+ agent_classes = [v for k, v in globals().items() if k.endswith("Agent") and isinstance(v, type)]
131
+ start_agent_cls = agent_classes[0] if agent_classes else None
132
+
133
+ if not start_agent_cls:
134
+ print("No agents found.")
135
+ return
136
+
137
+ agent = start_agent_cls(session)
138
+ res = agent.complete(q)
139
+ print("Result:", res)
140
+
141
+ if __name__ == "__main__":
142
+ main()
143
+ '''
144
+ rel = f"src/{src.name}/run.py"
145
+ write_file(out_dir, rel, c)
146
+ return [rel]
147
+
148
+ def _write_init(src: Path, out_dir: Path) -> list[str]:
149
+ c = f'"""Package: {src.name}."""\n'
150
+ rel = f"src/{src.name}/__init__.py"
151
+ write_file(out_dir, rel, c)
152
+ return [rel]
153
+
154
+ def _write_readme(ir: AgentSystemIR, plan: GenerationPlan, out_dir: Path) -> list[str]:
155
+ c = f"""\
156
+ # {plan.project_name} — Snowflake Cortex
157
+
158
+ Generated by `agentsml-impl`.
159
+
160
+ ## Quickstart
161
+ ```bash
162
+ pip install -e .
163
+ python -m {plan.package_name}.run
164
+ ```
165
+ """
166
+ write_file(out_dir, "README.md", c)
167
+ return ["README.md"]
@@ -0,0 +1,26 @@
1
+ target: snowflake_cortex
2
+ kind: code
3
+ language: python
4
+ status: implemented
5
+ level: 1
6
+ version_tested: "1.0.0"
7
+ supports:
8
+ agents: native
9
+ tools: adapter
10
+ workflows: lossy
11
+ graph_edges: lossy
12
+ graph_conditions: lossy
13
+ cycles: lossy
14
+ parallel: unsupported
15
+ human_approval: adapter
16
+ mcp: unsupported
17
+ a2a: manual
18
+ ag_ui: unsupported
19
+ structured_output: unsupported
20
+ observability: native
21
+ artifacts:
22
+ - python_project
23
+ - diagnostics
24
+ - readme
25
+ notes: >
26
+ Maps to Snowflake Cortex AI (Python API).
@@ -0,0 +1 @@
1
+ """Target: spring_ai."""