AFM (Agent-Flavored Markdown) interpreter using LangChain
Project description
AFM LangChain Interpreter
A LangChain-based reference implementation of an interpreter for Agent-Flavored Markdown (AFM) files.
Features
- Support for all interface types:
- Console chat (interactive CLI)
- Web chat (HTTP API + optional UI)
- Webhook (WebSub-based event handling)
- Multi-interface agents - run multiple interfaces simultaneously
- MCP support for tools (Model Context Protocol)
- Validation - dry-run mode to validate AFM definitions
Prerequisites
Quick Start
# Set your API Key
export OPENAI_API_KEY="your-api-key-here"
# Run with an AFM file using uv
uv run afm path/to/agent.afm.md
Configuration
Configuration via environment variables or CLI options:
OPENAI_API_KEY,ANTHROPIC_API_KEY, etc. (Required based on provider)- HTTP port can be set via
-por--port(default: 8000)
Running with Docker
# Build the image
docker build -t afm-langchain-interpreter .
# Run with an AFM file mounted and API key
docker run -v $(pwd)/path/to/agent.afm.md:/app/agent.afm.md \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-p 8000:8000 \
afm-langchain-interpreter afm /app/agent.afm.md
Testing
uv run pytest
Project Structure
langchain-interpreter/
├── src/afm/
│ ├── interfaces/ # Interface implementations (console, web, webhook)
│ ├── tools/ # Tool support (MCP server)
│ ├── resources/ # Static assets (web UI)
│ ├── agent.py # Core agent logic
│ ├── cli.py # CLI entry point
│ ├── parser.py # AFM file parsing
│ ├── models.py # Model configuration
│ ├── providers.py # LLM provider handling
│ └── templates.py # Prompt templates
├── tests/ # Unit and integration tests
├── Dockerfile # Container build
├── pyproject.toml # Python project configuration
└── uv.lock # Dependency lock file
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
afm_py-0.1.2.tar.gz
(30.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
afm_py-0.1.2-py3-none-any.whl
(38.3 kB
view details)
File details
Details for the file afm_py-0.1.2.tar.gz.
File metadata
- Download URL: afm_py-0.1.2.tar.gz
- Upload date:
- Size: 30.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4a75de05e1cd8d6d0e886881c0bffe4e1ce0c63a57f9d658e718a3adeacf54a
|
|
| MD5 |
d23adc33190b74830b215373a641159c
|
|
| BLAKE2b-256 |
8c22ca535d9b39d50a1813f92ff4d2a261d022e7597a56c45a88b685829bc54f
|
File details
Details for the file afm_py-0.1.2-py3-none-any.whl.
File metadata
- Download URL: afm_py-0.1.2-py3-none-any.whl
- Upload date:
- Size: 38.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4ee0c2edae5eec10cced2dcd96a760273d783c134f291e575bb81e1ac535aec
|
|
| MD5 |
cc8749aeb04a8f209283750a19346432
|
|
| BLAKE2b-256 |
75d5d0856318c8b5ae5a24ca710d21bad768ddbfdeca92d40df30aa8cb7e764d
|