A LangChain-based reference implementation of an interpreter for Agent-Flavored Markdown (AFM) files.
- 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
To run afm as a standalone command-line tool:
pipx install afm-clipip install afm-cli# Set your API Key
export OPENAI_API_KEY="your-api-key-here"
# Run with an AFM file
afm path/to/agent.afm.mdConfiguration 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)
# 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.mduv run pytestlangchain-interpreter/
├── src/afm_cli/
│ ├── 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
├── afm-samples/ # Example AFM definitions
├── Dockerfile # Container build
├── pyproject.toml # Python project configuration
└── uv.lock # Dependency lock file
Apache-2.0