File size: 2,280 Bytes
47ee19d
 
 
 
 
 
d26d91b
47ee19d
 
 
 
32f259e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d26d91b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
title: Agentic Multiwriter
emoji: 🧠
colorFrom: indigo
colorTo: pink
sdk: gradio
sdk_version: 6.1.0
app_file: app.py
pinned: false
---

# Agentic Multiwriter

A multi-agent **research & writing** system built with **LangGraph**, **LangChain**, and local/remote LLMs.

Pipeline:

1. **Researcher** – web search on a topic
2. **Aggregator** – cleans & deduplicates snippets
3. **Writer** – drafts content based on research
4. **Critic** – improves clarity & completeness
5. **Formatter** – outputs a final, mode-specific format (blog / research_summary / linkedin_post)

Supports:

- Local LLM via **Ollama** (e.g. `llama3`)
- Optional OpenAI models (if configured)
- REST API with FastAPI
- CLI entrypoint

---

## Quickstart

````bash
# From repo root
python -m venv .venv
source .venv/bin/activate

pip install -e .

# Run CLI
PYTHONPATH=src python -m agentic_multiwriter.cli.main \
  --topic "Future of AI agents in healthcare" \
  --mode blog

# Run API
PYTHONPATH=src uvicorn agentic_multiwriter.api.server:app --reload
Example request:

bash
Copy code
curl -X POST "http://127.0.0.1:8000/generate" \
  -H "Content-Type: application/json" \
  -d '{"topic": "Future of AI agents in healthcare", "mode": "blog"}'
Configuration
Environment variables:

AMW_LLM_PROVIDER – "ollama" or "openai" (default: "ollama")

AMW_LLM_MODEL – e.g. "llama3" (default) or "gpt-4o-mini"

AMW_TEMPERATURE – float, default 0.4

OPENAI_API_KEY – required if using openai provider

You can also see example configs in examples/sample_config_local.yaml and examples/sample_config_hybrid.yaml.

Development
Run tests:

bash
Copy code
PYTHONPATH=src pytest -q
License
MIT (or whatever you prefer).

bash
Copy code

---

## `docker-compose.yml`

```yaml
version: "3.9"

services:
  api:
    build: .
    container_name: agentic-multiwriter-api
    environment:
      - AMW_LLM_PROVIDER=${AMW_LLM_PROVIDER:-ollama}
      - AMW_LLM_MODEL=${AMW_LLM_MODEL:-llama3}
      - AMW_TEMPERATURE=${AMW_TEMPERATURE:-0.4}
      - OPENAI_API_KEY=${OPENAI_API_KEY:-}
    ports:
      - "8000:8000"
    command: ["uvicorn", "agentic_multiwriter.api.server:app", "--host", "0.0.0.0", "--port", "8000"]
    working_dir: /app
    volumes:
      - ./src:/app/src
      - ./examples:/app/examples
````