Skip to main content

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

  • Python 3.12 or later.
  • uv for dependency management.
  • Docker (optional, for running via containers).

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 -p or --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

Metadata

Release files for afm-py 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for afm-py 0.1.3
File Size Uploaded Provenance Actions
afm_py-0.1.3.tar.gz 30.3 kB Without provenance Details for afm_py-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for afm-py 0.1.3
File Interpreter ABI Platform Actions
afm_py-0.1.3-py3-none-any.whl Python 3 none any Details for afm_py-0.1.3-py3-none-any.whl

Total release size: 68.6 kB

Release files / afm_py-0.1.3.tar.gz

Download URL afm_py-0.1.3.tar.gz
Size 30.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e28fcf340c0931412dddc4f9199504c71af0aebd49a1c9a7a0869ddf8af16665
BLAKE2b-256 checksum
How to use checksums
13db9989bedc116f2617d21909a7e6076dcae55735902a9171013b0387e48439
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / afm_py-0.1.3-py3-none-any.whl

Download URL afm_py-0.1.3-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a6a45a6d350f2b558fa525d4696a280e302844320af8aad7ca76df8866a48647
BLAKE2b-256 checksum
How to use checksums
14301f19a646bcc87115b5a16a459d6b117d48080c731fc314583bba51d6aac0
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for afm-py 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page