Skip to main content

AFM CLI

PyPI version Python version License

A command-line interface for running Agent-Flavored Markdown (AFM) agents.

This package provides everything you need to run AFM agents, including:

  • afm-core: Parser, validation, and interface implementations
  • afm-langchain: LangChain-based execution backend with support for OpenAI and Anthropic

Installation

pip install afm-cli

Quick Start

1. Set your API key

export OPENAI_API_KEY="your-api-key-here"
# or
export ANTHROPIC_API_KEY="your-api-key-here"

2. Create an AFM file

Create a file named agent.afm.md:

---
name: Friendly Assistant
interfaces:
  - type: consolechat
model:
  provider: openai
  name: gpt-4o

---
# Role
You are a helpful and friendly AI assistant.

# Instructions
- Be concise but thorough in your responses
- If you don't know something, say so honestly
- Always be polite and professional

3. Run the agent

afm run agent.afm.md

This will start an interactive console chat with your agent.

Usage

afm run <file>

Run an AFM agent file and start its configured interfaces.

# Run with default settings
afm run agent.afm.md

# Run on a specific port (for web interfaces)
afm run agent.afm.md --port 8080

afm validate <file>

Validate an AFM file without running it.

afm validate agent.afm.md

afm framework list

List available execution backends.

afm framework list

Configuration

Environment Variables

  • OPENAI_API_KEY - Required for OpenAI models
  • ANTHROPIC_API_KEY - Required for Anthropic models

CLI Options

  • -p, --port PORT - Port for web interfaces (default: 8085)
  • --help - Show help message

Features

Interface Types

AFM agents can expose multiple interfaces simultaneously:

  • consolechat: Interactive terminal-based chat (default)
  • webchat: HTTP API with built-in web UI
  • webhook: Webhook endpoint for event-driven agents

MCP Tool Support

Agents can use external tools via Model Context Protocol (MCP).

For more examples and detailed documentation, see AFM Examples.

Docker

You can also run agents using Docker:

# Build the image
docker build -t afm-langchain-interpreter .

# Run with an AFM file mounted
docker run -v $(pwd)/agent.afm.md:/app/agent.afm.md \
  -e OPENAI_API_KEY=$OPENAI_API_KEY \
  -p 8085:8085 \
  afm-langchain-interpreter afm /app/agent.afm.md

Documentation

For more detailed documentation, see the project README.

License

Apache-2.0

Metadata

Release files for afm-cli 0.4.0

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-cli 0.4.0
File Size Uploaded
afm_cli-0.4.0.tar.gz 2.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for afm-cli 0.4.0
File Interpreter ABI Platform
afm_cli-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.8 kB

Release files / afm_cli-0.4.0.tar.gz

Download URL afm_cli-0.4.0.tar.gz
Size 2.5 kB
Tags Source
SHA-256 checksum
How to use checksums
9f90e9cb07e5d5dc27ee28b7b5bf11679e9934be2bbaeea950123f380a91daa0
BLAKE2b-256 checksum
How to use checksums
2464b7402cabe96b20ce793ec47e0ce43841231615de0e229d1270c262e471ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / afm_cli-0.4.0-py3-none-any.whl

Download URL afm_cli-0.4.0-py3-none-any.whl
Size 3.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0716f2ee1cd99ff019c823c7391943cef6753b5c5d046a881de3c03217749677
BLAKE2b-256 checksum
How to use checksums
5fa7ff16bb29f6e89de904ca95dc5a643082182cd12f418ba84cff02af7c48b8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.0

2 release files

0.2.10

2 release files

0.2.9

2 release files

0.2.7

2 release files

0.2.6

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

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