A workflow demonstrating how the Markdown Agent can generate and format content in Markdown syntax.

Quick Start

1

Install Package

First, install the PraisonAI Agents package:

pip install praisonaiagents
2

Set API Key

Set your OpenAI API key as an environment variable:

export OPENAI_API_KEY=your_api_key_here
3

Create Script

Create a new file markdown_generator.py:

from praisonaiagents import Agent

# Create Markdown Agent
markdown_agent = Agent(
    name="MarkdownWriter",
    role="Markdown Content Specialist",
    goal="Generate well-formatted content in Markdown syntax",
    instructions="You are a Markdown Agent, output in markdown format",
    llm="gpt-4o-mini",
    self_reflect=False
)

# Generate content
response = markdown_agent.start(
    "Write a blog post about artificial intelligence"
)

# Save to file
with open('blog_post.md', 'w') as f:
    f.write(response)

Understanding Markdown Generation

The Markdown Agent specializes in creating properly formatted Markdown content:

  1. Content Generation: Creates original content based on prompts
  2. Markdown Formatting: Applies proper Markdown syntax
  3. Structure Validation: Ensures correct formatting
  4. Document Organization: Creates well-structured documents

Features

Content Creation

Generates original, well-structured content.

Markdown Syntax

Proper implementation of Markdown formatting.

Document Structure

Organized document hierarchy and sections.

Format Validation

Ensures correct Markdown syntax usage.

Example Usage

# Example: Generate a technical documentation
agent = Agent(
    instructions="You are a Markdown Agent, output in markdown format"
)

# Generate API documentation
response = agent.start("""
    Create technical documentation for a REST API with:
    - Introduction
    - Authentication
    - Endpoints
    - Examples
""")

# Save documentation
with open('api_docs.md', 'w') as f:
    f.write(response)

Next Steps

Was this page helpful?