Agent recipe · 02

A daily news summarizer agent

Turn a small, curated text feed into a dated digest on a schedule. Keep retrieval separate from summarization so the model never pretends it visited a source.

Beginner15 minutesEnglishVerified 2026-09-25
This recipe summarizes text you provide. Add your own approved feed or file fetcher before the model call, then preserve source URLs in the output.

1. The 60-second version

Save the following as summarize.py. The model ID and rate were checked against the live catalog on 2026-09-25.

from openai import OpenAI
import os
client = OpenAI(base_url="https://aiwave.live/v1", api_key=os.environ["AIWAVE_API_KEY"])
articles = """[Source: https://example.com/story]
Paste a short article excerpt here."""
prompt = "Summarize these dated sources in five bullets. Keep the URLs. Do not add facts not present.\n\n" + articles
r = client.chat.completions.create(model="deepseek-v4-flash", messages=[{"role":"user","content":prompt}], max_tokens=500)
print(r.choices[0].message.content)

Run with python summarize.py. Verify that every bullet maps to a supplied source before distributing it.

# crontab -e — run at 08:00 in the server timezone
0 8 * * * /usr/bin/python3 /opt/news-agent/summarize.py >> /var/log/news-agent.log 2>&1

2. One-day cost table

WorkloadFormulaEstimate
30 runs/day; each 2,000 input + 500 output tokens30 × (($0.638×0.002)+($1.914×0.0005))about $0.067/day
Rate sourceAIWave pricing, deepseek-v4-flash, effective 2026-08-27; checked 2026-09-25

This is a token-only estimate. Feed retrieval, retries, cache behavior, and account billing groups can change the result.

3. Extensions and errors

Next steps