afm-cli 0.2.0__tar.gz → 0.2.1.dev1__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.
@@ -0,0 +1,13 @@
1
+ Metadata-Version: 2.4
2
+ Name: afm-cli
3
+ Version: 0.2.1.dev1
4
+ Summary: AFM CLI metapackage: installs afm-core and afm-langchain
5
+ License-Expression: Apache-2.0
6
+ Classifier: Development Status :: 3 - Alpha
7
+ Classifier: Programming Language :: Python :: 3.11
8
+ Requires-Dist: afm-core
9
+ Requires-Dist: afm-langchain
10
+ Requires-Python: >=3.11
11
+ Project-URL: Repository, https://github.com/wso2/reference-implementations-afm
12
+ Description-Content-Type: text/markdown
13
+
File without changes
@@ -0,0 +1,30 @@
1
+ [project]
2
+ name = "afm-cli"
3
+ version = "0.2.1.dev1"
4
+ description = "AFM CLI metapackage: installs afm-core and afm-langchain"
5
+ readme = "README.md"
6
+ classifiers = [
7
+ "Development Status :: 3 - Alpha",
8
+ "Programming Language :: Python :: 3.11",
9
+ ]
10
+ license = "Apache-2.0"
11
+ requires-python = ">=3.11"
12
+ urls = { Repository = "https://github.com/wso2/reference-implementations-afm" }
13
+ dependencies = [
14
+ "afm-core",
15
+ "afm-langchain",
16
+ ]
17
+
18
+ [project.scripts]
19
+ afm = "afm.cli:cli"
20
+
21
+ [build-system]
22
+ requires = ["uv_build>=0.9.28,<0.10.0"]
23
+ build-backend = "uv_build"
24
+
25
+ [tool.uv.build-backend]
26
+ module-name = "afm_cli"
27
+
28
+ [tool.uv.sources]
29
+ afm-core = { workspace = true }
30
+ afm-langchain = { workspace = true }
@@ -0,0 +1,4 @@
1
+ # Copyright (c) 2025
2
+ # Licensed under the Apache License, Version 2.0
3
+
4
+ """AFM CLI metapackage — installs afm-core and afm-langchain."""
afm_cli-0.2.0/PKG-INFO DELETED
@@ -1,119 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: afm-cli
3
- Version: 0.2.0
4
- Summary: AFM (Agent-Flavored Markdown) interpreter using LangChain
5
- License-Expression: Apache-2.0
6
- Classifier: Development Status :: 3 - Alpha
7
- Classifier: Programming Language :: Python :: 3.11
8
- Requires-Dist: langchain>=1.2.8
9
- Requires-Dist: pyyaml>=6.0
10
- Requires-Dist: pydantic>=2.0
11
- Requires-Dist: langchain-openai>=1.1.7
12
- Requires-Dist: langchain-anthropic>=1.3.1
13
- Requires-Dist: jsonschema>=4.26.0
14
- Requires-Dist: fastapi>=0.128.1
15
- Requires-Dist: httpx>=0.28.1
16
- Requires-Dist: uvicorn>=0.40.0
17
- Requires-Dist: mcp>=1.26.0
18
- Requires-Dist: langchain-mcp-adapters>=0.2.1
19
- Requires-Dist: click>=8.0.0
20
- Requires-Dist: textual>=2.1.0
21
- Requires-Python: >=3.11
22
- Project-URL: Repository, https://github.com/RadCod3/reference-implementations-afm
23
- Description-Content-Type: text/markdown
24
-
25
- # AFM LangChain Interpreter
26
-
27
- A LangChain-based reference implementation of an interpreter for [Agent-Flavored Markdown (AFM)](https://github.com/wso2/agent-flavored-markdown) files.
28
-
29
- ## Features
30
-
31
- - **Support for all interface types:**
32
- - Console chat (interactive CLI)
33
- - Web chat (HTTP API + optional UI)
34
- - Webhook (WebSub-based event handling)
35
- - **Multi-interface agents** - run multiple interfaces simultaneously
36
- - **MCP support** for tools (Model Context Protocol)
37
- - **Validation** - dry-run mode to validate AFM definitions
38
-
39
- ## Prerequisites
40
-
41
- - [Python](https://www.python.org/) 3.12 or later.
42
- - [uv](https://docs.astral.sh/uv/) for dependency management.
43
-
44
- ## Installation
45
-
46
- ### Using pipx (Recommended)
47
-
48
- To run `afm` as a standalone command-line tool:
49
-
50
- ```bash
51
- pipx install afm-cli
52
- ```
53
-
54
- ### Using pip
55
-
56
- ```bash
57
- pip install afm-cli
58
- ```
59
-
60
- ## Quick Start
61
-
62
- ```bash
63
- # Set your API Key
64
- export OPENAI_API_KEY="your-api-key-here"
65
-
66
- # Run with an AFM file
67
- afm path/to/agent.afm.md
68
- ```
69
-
70
- ## Configuration
71
-
72
- Configuration via environment variables or CLI options:
73
-
74
- - `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc. (Required based on provider)
75
- - HTTP port can be set via `-p` or `--port` (default: 8000)
76
-
77
- ## Running with Docker
78
-
79
- ```bash
80
- # Build the image
81
- docker build -t afm-langchain-interpreter .
82
-
83
- # Run with an AFM file mounted and API key
84
- docker run -v $(pwd)/path/to/agent.afm.md:/app/agent.afm.md \
85
- -e OPENAI_API_KEY=$OPENAI_API_KEY \
86
- -p 8000:8000 \
87
- afm-langchain-interpreter afm /app/agent.afm.md
88
- ```
89
-
90
- ## Testing
91
-
92
- ```bash
93
- uv run pytest
94
- ```
95
-
96
- ## Project Structure
97
-
98
- ```
99
- langchain-interpreter/
100
- ├── src/afm_cli/
101
- │ ├── interfaces/ # Interface implementations (console, web, webhook)
102
- │ ├── tools/ # Tool support (MCP server)
103
- │ ├── resources/ # Static assets (web UI)
104
- │ ├── agent.py # Core agent logic
105
- │ ├── cli.py # CLI entry point
106
- │ ├── parser.py # AFM file parsing
107
- │ ├── models.py # Model configuration
108
- │ ├── providers.py # LLM provider handling
109
- │ └── templates.py # Prompt templates
110
- ├── tests/ # Unit and integration tests
111
- ├── afm-samples/ # Example AFM definitions
112
- ├── Dockerfile # Container build
113
- ├── pyproject.toml # Python project configuration
114
- └── uv.lock # Dependency lock file
115
- ```
116
-
117
- ## License
118
-
119
- Apache-2.0
afm_cli-0.2.0/README.md DELETED
@@ -1,95 +0,0 @@
1
- # AFM LangChain Interpreter
2
-
3
- A LangChain-based reference implementation of an interpreter for [Agent-Flavored Markdown (AFM)](https://github.com/wso2/agent-flavored-markdown) files.
4
-
5
- ## Features
6
-
7
- - **Support for all interface types:**
8
- - Console chat (interactive CLI)
9
- - Web chat (HTTP API + optional UI)
10
- - Webhook (WebSub-based event handling)
11
- - **Multi-interface agents** - run multiple interfaces simultaneously
12
- - **MCP support** for tools (Model Context Protocol)
13
- - **Validation** - dry-run mode to validate AFM definitions
14
-
15
- ## Prerequisites
16
-
17
- - [Python](https://www.python.org/) 3.12 or later.
18
- - [uv](https://docs.astral.sh/uv/) for dependency management.
19
-
20
- ## Installation
21
-
22
- ### Using pipx (Recommended)
23
-
24
- To run `afm` as a standalone command-line tool:
25
-
26
- ```bash
27
- pipx install afm-cli
28
- ```
29
-
30
- ### Using pip
31
-
32
- ```bash
33
- pip install afm-cli
34
- ```
35
-
36
- ## Quick Start
37
-
38
- ```bash
39
- # Set your API Key
40
- export OPENAI_API_KEY="your-api-key-here"
41
-
42
- # Run with an AFM file
43
- afm path/to/agent.afm.md
44
- ```
45
-
46
- ## Configuration
47
-
48
- Configuration via environment variables or CLI options:
49
-
50
- - `OPENAI_API_KEY`, `ANTHROPIC_API_KEY`, etc. (Required based on provider)
51
- - HTTP port can be set via `-p` or `--port` (default: 8000)
52
-
53
- ## Running with Docker
54
-
55
- ```bash
56
- # Build the image
57
- docker build -t afm-langchain-interpreter .
58
-
59
- # Run with an AFM file mounted and API key
60
- docker run -v $(pwd)/path/to/agent.afm.md:/app/agent.afm.md \
61
- -e OPENAI_API_KEY=$OPENAI_API_KEY \
62
- -p 8000:8000 \
63
- afm-langchain-interpreter afm /app/agent.afm.md
64
- ```
65
-
66
- ## Testing
67
-
68
- ```bash
69
- uv run pytest
70
- ```
71
-
72
- ## Project Structure
73
-
74
- ```
75
- langchain-interpreter/
76
- ├── src/afm_cli/
77
- │ ├── interfaces/ # Interface implementations (console, web, webhook)
78
- │ ├── tools/ # Tool support (MCP server)
79
- │ ├── resources/ # Static assets (web UI)
80
- │ ├── agent.py # Core agent logic
81
- │ ├── cli.py # CLI entry point
82
- │ ├── parser.py # AFM file parsing
83
- │ ├── models.py # Model configuration
84
- │ ├── providers.py # LLM provider handling
85
- │ └── templates.py # Prompt templates
86
- ├── tests/ # Unit and integration tests
87
- ├── afm-samples/ # Example AFM definitions
88
- ├── Dockerfile # Container build
89
- ├── pyproject.toml # Python project configuration
90
- └── uv.lock # Dependency lock file
91
- ```
92
-
93
- ## License
94
-
95
- Apache-2.0
@@ -1,49 +0,0 @@
1
- [project]
2
- name = "afm-cli"
3
- version = "0.2.0"
4
- description = "AFM (Agent-Flavored Markdown) interpreter using LangChain"
5
- readme = "README.md"
6
- classifiers = [
7
- "Development Status :: 3 - Alpha",
8
- "Programming Language :: Python :: 3.11",
9
- ]
10
- license = "Apache-2.0"
11
- requires-python = ">=3.11"
12
- urls = { Repository = "https://github.com/RadCod3/reference-implementations-afm" }
13
- dependencies = [
14
- "langchain>=1.2.8",
15
- "pyyaml>=6.0",
16
- "pydantic>=2.0",
17
- "langchain-openai>=1.1.7",
18
- "langchain-anthropic>=1.3.1",
19
- "jsonschema>=4.26.0",
20
- "fastapi>=0.128.1",
21
- "httpx>=0.28.1",
22
- "uvicorn>=0.40.0",
23
- "mcp>=1.26.0",
24
- "langchain-mcp-adapters>=0.2.1",
25
- "click>=8.0.0",
26
- "textual>=2.1.0",
27
- ]
28
-
29
- [project.scripts]
30
- afm = "afm_cli.cli:main"
31
-
32
- [build-system]
33
- requires = ["uv_build>=0.9.28,<0.10.0"]
34
- build-backend = "uv_build"
35
-
36
- [tool.pytest.ini_options]
37
- testpaths = ["tests"]
38
- pythonpath = ["src"]
39
- asyncio_mode = "auto"
40
- asyncio_default_fixture_loop_scope = "function"
41
-
42
- [dependency-groups]
43
- dev = [
44
- "ruff>=0.15.0",
45
- "pytest>=8.0",
46
- "pytest-cov>=7.0.0",
47
- "pytest-asyncio>=1.3.0",
48
- "textual-dev>=1.7.0",
49
- ]
@@ -1,223 +0,0 @@
1
- # Copyright (c) 2025
2
- # Licensed under the Apache License, Version 2.0
3
-
4
- """LangChain AFM Interpreter.
5
-
6
- A Python implementation of the AFM (Agent-Flavored Markdown) specification v0.3.0.
7
-
8
- This package provides:
9
-
10
- - **Parser**: Parse AFM files into structured Python objects
11
- - **Agent**: Execute agents using LangChain
12
- - **Interfaces**: Console chat, web chat, and webhook handlers
13
-
14
- Example usage::
15
-
16
- from afm_cli import parse_afm_file, Agent
17
- from afm_cli.interfaces import run_console_chat
18
-
19
- afm = parse_afm_file("my_agent.afm.md")
20
- agent = Agent(afm)
21
- run_console_chat(agent)
22
- """
23
-
24
- from .agent import Agent
25
- from .exceptions import (
26
- AFMError,
27
- AFMParseError,
28
- AFMValidationError,
29
- AgentConfigError,
30
- AgentError,
31
- InputValidationError,
32
- InterfaceNotFoundError,
33
- JSONAccessError,
34
- MCPAuthenticationError,
35
- MCPConnectionError,
36
- MCPError,
37
- MCPToolError,
38
- OutputValidationError,
39
- ProviderError,
40
- TemplateCompilationError,
41
- TemplateError,
42
- TemplateEvaluationError,
43
- VariableResolutionError,
44
- )
45
- from .interfaces import (
46
- WebSubSubscriber,
47
- ChatApp,
48
- async_run_console_chat,
49
- create_webchat_app,
50
- create_webhook_app,
51
- get_console_interface,
52
- get_http_path,
53
- get_interface_by_type,
54
- get_interfaces,
55
- get_primary_interface,
56
- get_webchat_interface,
57
- get_webhook_interface,
58
- has_interface_type,
59
- run_console_chat,
60
- run_webchat_server,
61
- run_webhook_server,
62
- verify_webhook_signature,
63
- )
64
- from .models import (
65
- AFMRecord,
66
- AgentMetadata,
67
- ClientAuthentication,
68
- CompiledTemplate,
69
- ConsoleChatInterface,
70
- Exposure,
71
- HeaderVariable,
72
- HTTPExposure,
73
- HttpTransport,
74
- Interface,
75
- InterfaceType,
76
- JSONSchema,
77
- LiteralSegment,
78
- MCPServer,
79
- Model,
80
- PayloadVariable,
81
- Provider,
82
- Signature,
83
- StdioTransport,
84
- Subscription,
85
- TemplateSegment,
86
- ToolFilter,
87
- Tools,
88
- Transport,
89
- TransportType,
90
- WebChatInterface,
91
- WebhookInterface,
92
- get_filtered_tools,
93
- )
94
- from .parser import parse_afm, parse_afm_file, validate_and_extract_interfaces
95
- from .providers import (
96
- create_model_provider,
97
- get_supported_providers,
98
- )
99
- from .schema_validator import (
100
- build_output_schema_instruction,
101
- coerce_output_to_schema,
102
- extract_json_from_response,
103
- json_schema_to_dict,
104
- validate_input,
105
- validate_output,
106
- )
107
- from .templates import access_json_field, compile_template, evaluate_template
108
- from .tools import (
109
- MCPClient,
110
- MCPManager,
111
- filter_tools,
112
- )
113
- from .variables import (
114
- contains_http_variable,
115
- resolve_variables,
116
- validate_http_variables,
117
- )
118
- from .cli import create_unified_app, main
119
-
120
- __version__ = "0.1.0"
121
-
122
- __all__ = [
123
- # Version
124
- "__version__",
125
- # Parser Functions
126
- "parse_afm",
127
- "parse_afm_file",
128
- "validate_and_extract_interfaces",
129
- # Variables
130
- "resolve_variables",
131
- "contains_http_variable",
132
- "validate_http_variables",
133
- # Templates
134
- "compile_template",
135
- "evaluate_template",
136
- "access_json_field",
137
- # Models
138
- "AFMRecord",
139
- "AgentMetadata",
140
- "Provider",
141
- "Model",
142
- "ClientAuthentication",
143
- "HttpTransport",
144
- "StdioTransport",
145
- "Transport",
146
- "TransportType",
147
- "ToolFilter",
148
- "MCPServer",
149
- "Tools",
150
- "JSONSchema",
151
- "Signature",
152
- "HTTPExposure",
153
- "Exposure",
154
- "Subscription",
155
- "InterfaceType",
156
- "ConsoleChatInterface",
157
- "WebChatInterface",
158
- "WebhookInterface",
159
- "Interface",
160
- "CompiledTemplate",
161
- "LiteralSegment",
162
- "PayloadVariable",
163
- "HeaderVariable",
164
- "TemplateSegment",
165
- "get_filtered_tools",
166
- # Exceptions
167
- "AFMError",
168
- "AFMParseError",
169
- "AFMValidationError",
170
- "VariableResolutionError",
171
- "TemplateError",
172
- "TemplateCompilationError",
173
- "TemplateEvaluationError",
174
- "JSONAccessError",
175
- # Agent Class
176
- "Agent",
177
- # Provider Factory
178
- "create_model_provider",
179
- "get_supported_providers",
180
- # Schema Validation
181
- "validate_input",
182
- "validate_output",
183
- "coerce_output_to_schema",
184
- "extract_json_from_response",
185
- "json_schema_to_dict",
186
- "build_output_schema_instruction",
187
- "AgentError",
188
- "AgentConfigError",
189
- "ProviderError",
190
- "InputValidationError",
191
- "OutputValidationError",
192
- "InterfaceNotFoundError",
193
- # MCP Exceptions
194
- "MCPError",
195
- "MCPConnectionError",
196
- "MCPToolError",
197
- "MCPAuthenticationError",
198
- # MCP Classes
199
- "MCPClient",
200
- "MCPManager",
201
- "filter_tools",
202
- # Interface Functions
203
- "get_interfaces",
204
- "get_interface_by_type",
205
- "get_console_interface",
206
- "get_webchat_interface",
207
- "get_webhook_interface",
208
- "get_primary_interface",
209
- "has_interface_type",
210
- "get_http_path",
211
- "ChatApp",
212
- "run_console_chat",
213
- "async_run_console_chat",
214
- "create_webchat_app",
215
- "run_webchat_server",
216
- "create_webhook_app",
217
- "run_webhook_server",
218
- "WebSubSubscriber",
219
- "verify_webhook_signature",
220
- # CLI
221
- "main",
222
- "create_unified_app",
223
- ]