Skip to main content

AIWriter is an AI Agent for writers.

Project description

Agentic AI Writer

The agentic writer will take in a prompt, a list of URLs (context), and a list of writing criteria (e.g. conciseness, accuracy).

It will first parse all the context URLs to markdown, and include them with the input prompt. It will generate a draft and score it according to the criteria.

This loop will repeat until the draft achieves a sufficiently high score in all criteria or until the max number of iterations is reached.

Get started

# 1. set ANTHROPIC_API_KEY
export ANTHROPIC_API_KEY="sk-ant-..." # the default model is anthropic's
# if using an openai model, use OPENAI_API_KEY, if using another provider, use "<PROVIDER_NAME>_API_KEY"

# 2. running agent loop
aiwriter editor "write an article on software engineering management extracting the absolute best insights from these articles. be concise."

# (optional) running simple essay writer
aiwriter write "write a short poem"

# (optional) add context URLs to be parsed and included in the prompt
echo "
blog.com/post1
blog.com/post2
blog.com/post3" > context.txt

# (optional) add criteria to favor in the agent's writing
echo "clarity,conciseness,relevance,engagement,accuracy" > criteria.txt  # this is the default criteria

# (optional) change the LLM model
export AIWRITER_MODEL="anthropic/claude-3-7-sonnet-latest"  # this is the default model

API

Environment Variables

Required:

  • ANTHROPIC_API_KEY or another model provider API Key if default AIWRITER_MODEL is changed

Optional:

  • AIWRITER_MODEL determines the model to be used
  • AIWRITER_CONTEXT_FILE filename for input context urls file to be used in the first prompt
  • AIWRITER_CONTEXT_FULL_FILE filename for output markdown context from parsing context urls
  • AIWRITER_CONTEXT_DIR directory where input and output context files
  • AIWRITER_CRITERIA filename for criteria file with comma-separated list of criteria to use when scoring
  • AIWRITER_DRAFTS_DIR directory for agent outputs

cli/non-agent use only:

  • AIWRITER_ESSAY_FILE filename for outputs from ranker and writer functions
  • AIWRITER_SCORES filename for output scores file

Modules

# AI Writer Agent
aiwriter editor "<prompt>"
aiwriter writer "<prompt>"
aiwriter ranker "<essay>"
aiwriter context_builder "<prompt>"

How it works

Data Model

  • Input
    • URLs
    • Prompt (i.e. topic)
    • Criteria
  • Output
    • Content (i.e. scored drafts)

Data Flow

flowchart TD
    A([URLs]) --> B(Context Builder)
    AA([Topic]) --> B(Context Builder)
    B --> C([Prompt])
    B --> J(Thinker)
    C --> D(Writer)
    D --> E([Draft])
    E --> F(Ranker)
    F --> FF([Scored Draft])
    H([Criteria]) --> F
    FF --> G{Editor}
    I([Past Runs]) --> G
    G --> B
    G --> J
    J --> G

    style B fill:#fd0795,color:black,font-weight:bold
    style D fill:#00b5d7,color:black,font-weight:bold
    style F fill:#ff9000,color:black,font-weight:bold
    style G fill:#ffb901,color:black,font-weight:bold
    style J fill:#2a9d8f,color:black,font-weight:bold

Modules

  • Context Builder
    • prompt builder
    • url parser
      • html-to-markdown
      • audio-to-text (podcasts) <- future
      • youtube-to-text <- future
  • Writer
  • Ranker
  • Thinker
  • Editor (Agent Loop)

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

aiwriter-0.1.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

aiwriter-0.1.1-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file aiwriter-0.1.1.tar.gz.

File metadata

  • Download URL: aiwriter-0.1.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.8

File hashes

Hashes for aiwriter-0.1.1.tar.gz
Algorithm Hash digest
SHA256 1db7736997a29b1f5dab22dfb49017691fc1fdbd9571fcec38c3e9aba5a38506
MD5 28d4df4f406a42a2926500af577c2521
BLAKE2b-256 7d56a1511c73f68e7e2ba4707833d9b135b73b5a258cd0e94bab8b1de7003fb1

See more details on using hashes here.

File details

Details for the file aiwriter-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: aiwriter-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.7.8

File hashes

Hashes for aiwriter-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 faececd6ff868e0bb52841c7746023ff4a15040e54aac1e2558ccd249b2552d8
MD5 663fa9ba0541975f0b21b4f0c85cedf2
BLAKE2b-256 8303e67f708609ea5dba4f746c662aebfe7137c28bb76562b4ae35c71b7600c1

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