Agent recipe ยท 05
Long-context research agent
Turn a bounded document pack into a cited research brief with Kimi or Qwen. The key design choice is to preserve document boundaries and ask for evidence-backed claims.
The live catalog currently lists
kimi-k3 and qwen3.8-27b. Model availability and rates can change; check long-context notes and Models before a run.1. The 60-second version
from openai import OpenAI
import os
client = OpenAI(base_url="https://aiwave.live/v1", api_key=os.environ["AIWAVE_API_KEY"])
documents = "[doc-1] Paste a bounded document here.\n[doc-2] Paste a second document here."
prompt = """Create a research brief with:
1. three findings,
2. one uncertainty,
3. citations in the form [doc-N].
Use only the supplied documents.
""" + documents
r = client.chat.completions.create(model="kimi-k3", messages=[{"role":"user","content":prompt}], max_tokens=900)
print(r.choices[0].message.content)For a smaller document pack, swap kimi-k3 for qwen3.8-27b after checking current context and rate information.
2. Cost table
| Model | Illustrative workload | Token estimate |
|---|---|---|
| kimi-k3 | 20,000 input + 1,000 output | about $0.1125 |
| qwen3.8-27b | 20,000 input + 1,000 output | about $0.0161 |
| Source | AIWave pricing, both rates effective 2026-08-27; checked 2026-09-25 | |
3. Extension and errors
- Chunk documents by section and carry stable IDs into the prompt.
- Ask the model to say when evidence is missing.
- Use request recovery for context-length, timeout, 401, and 429 responses.