Skip to main content

AFM CLI metapackage: installs afm-core and afm-langchain

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

afm_cli-0.3.0.tar.gz (2.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

afm_cli-0.3.0-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file afm_cli-0.3.0.tar.gz.

File metadata

  • Download URL: afm_cli-0.3.0.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.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}

File hashes

Hashes for afm_cli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e06e52cf28384c4720289a594a840232ccb2a52dc84928840d9c4081aed7e3d5
MD5 526c8fa757b303f30929cd3fd2643273
BLAKE2b-256 0f96eb2a9ca8bffa85f82a77ae1e28ade77ed662cb7787b4b6242b283fd7495d

See more details on using hashes here.

File details

Details for the file afm_cli-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: afm_cli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.6 {"installer":{"name":"uv","version":"0.10.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}

File hashes

Hashes for afm_cli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c9d52e9199124c8d7e5b3ba3902796dcd50209f7a0dc4fc70dea63709e4a814
MD5 a199fb5ab03ccd743456f5a9378b518d
BLAKE2b-256 425cafa09cf6ba4f19dbcc3706b0cdf1d3c2fbeee36a04ffd29547f01f13a6a5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page