Set your OpenAI API key as an environment variable:
Copy
export OPENAI_API_KEY=your_api_key_here
3
Create Script
Create a new file markdown_generator.py:
Copy
from praisonaiagents import Agent# Create Markdown Agentmarkdown_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 contentresponse = markdown_agent.start( "Write a blog post about artificial intelligence")# Save to filewith open('blog_post.md', 'w') as f: f.write(response)
# Example: Generate a technical documentationagent = Agent( instructions="You are a Markdown Agent, output in markdown format")# Generate API documentationresponse = agent.start(""" Create technical documentation for a REST API with: - Introduction - Authentication - Endpoints - Examples""")# Save documentationwith open('api_docs.md', 'w') as f: f.write(response)