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.3.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.3-py3-none-any.whl
(38.3 kB
view details)
File details
Details for the file afm_py-0.1.3.tar.gz.
File metadata
- Download URL: afm_py-0.1.3.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 |
e28fcf340c0931412dddc4f9199504c71af0aebd49a1c9a7a0869ddf8af16665
|
|
| MD5 |
cb6754b7dc9806549fd8431687a8479a
|
|
| BLAKE2b-256 |
13db9989bedc116f2617d21909a7e6076dcae55735902a9171013b0387e48439
|
File details
Details for the file afm_py-0.1.3-py3-none-any.whl.
File metadata
- Download URL: afm_py-0.1.3-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 |
a6a45a6d350f2b558fa525d4696a280e302844320af8aad7ca76df8866a48647
|
|
| MD5 |
c6ddf05304a8e847a8f08d914f789358
|
|
| BLAKE2b-256 |
14301f19a646bcc87115b5a16a459d6b117d48080c731fc314583bba51d6aac0
|