Competitive monitoring: parallel extraction from three sources with contradiction flags
Official cookbook recipe
- Industry
- Marketing & support · Competitive monitoring
- Source
- Official open-multi-agent cookbook
- Stage
- Runnable example
This is an official open-multi-agent cookbook example, maintained by YuanASI. Three monitoring agents read Twitter, Reddit and news sources at the same time, each extracting structured claims with a date, link and confidence score; an aggregator agent then merges duplicates, flags claims whose dates or numbers disagree as contradictions, and outputs a competitive intelligence report.
Scenario
Typical scenario: a marketing or brand team tracks competitor activity across several channels every day: official accounts on social media, community discussions, industry news. The same event is often reported differently in all three places — a launch date off by a day, a performance gain given as 60% in one and 55% in another — and community posts mix in unconfirmed speculation. The manual approach is to copy each item into a spreadsheet and compare, which stops scaling once the channels multiply.
This example hands each channel to its own extraction agent running in parallel, normalizes everything into one structured format, and lets an aggregator agent cross-check: merge identical claims, compute average confidence, record the earliest report date, and flag conflicts at three levels, minor / moderate / critical. The fixtures plant two contradictions for it to find: Competitor X's launch date (Twitter says 04-15, Reddit 04-14, news 04-16), and the size of the query performance gain (Twitter says 60%, news 55%).
How it works
| Roles | Task DAG | Tools | Model | Deployment |
|---|---|---|---|---|
| twitter-monitor | Stage 1, in parallel with the other two monitoring agents (Promise.all) | None declared | claude-sonnet-4-6 / anthropic (no provider set, default used) | Local script, single run via npx tsx |
| reddit-monitor | Stage 1, parallel | None declared | claude-sonnet-4-6 / anthropic (no provider set, default used) | Same |
| news-monitor | Stage 1, parallel | None declared | claude-sonnet-4-6 / anthropic (no provider set, default used) | Same |
| aggregator | Stage 2, runs once all three monitoring agents have succeeded | None declared | claude-sonnet-4-6 / anthropic (no provider set, default used) | Same |
The models in the table are the example repository's defaults; the actual choice is made per scenario at the design stage.
The script constructs the four agents directly and calls agent.run(); parallelism comes from Promise.all, with no task DAG orchestration involved. Each agent's tool registry holds the built-in tools, but the config sets no toolPreset or allowedTools. OMA's tool grants deny by default (src/tool/grants.ts: with no positive grant, the built-in tools are cleared), so the whole flow only makes model calls.
The three monitoring agents share one zod schema (claim, date, source_url, confidence 0–1), with maxTurns 1, maxTokens 800, temperature 0.2; the aggregator uses a separate schema (verified_claims, contradictions, summary) with maxTokens 1200, temperature 0.3. The framework handles outputSchema like this: it extracts JSON from the reply and validates it; on failure it sends the error back to the model and tries once more, and if the second attempt also fails the run is marked failed (src/agent/agent.ts validateStructuredOutput).
The fixtures are three JSON files checked into the repository, 10 claims each. A comment at the end of the script shows how to plug in real sources: replace the three fixture loaders with your own data adapters and keep the extraction and aggregation stages as they are.
Result
Runnable output and how to verify it:
It needs an API key. The script header lists ANTHROPIC_API_KEY and Node.js 20 or later as prerequisites; run it with npx tsx packages/core/examples/cookbook/competitive-monitoring.ts.
The parallelism is observable. Each monitoring agent prints [RUN] / [DONE] with its own duration and output token count, followed by the parallel wall-clock time, the sum of the three sequential durations, and the speedup; at the end of the report it asserts that parallel time is under 70% of the sequential sum and prints PASS or FAIL, exiting with code 1 on FAIL. If any monitoring agent or the aggregator fails, or structured output is missing, the script also exits with code 1.
The final output is a COMPETITIVE INTELLIGENCE REPORT in four sections: Summary, Verified Claims (sources, average confidence with a high / medium / low label, earliest report date, merge notes), Contradictions (topic, severity, both versions and their sources), and Timing Analysis, followed by a total of output tokens.
The example uses fictional data: the monitored companies in the three fixtures are placeholders such as Competitor X and Company Y, and the links are illustrative addresses. The output is model-generated text, used to demonstrate and verify the workflow.
Sources
How this relates to YuanASI
The material on this page is a cookbook example from the official open-multi-agent repository, maintained by YuanASI.
If you run a real competitor or public-opinion monitoring process and want data from several channels extracted in parallel into one format, cross-checked for contradictory claims, and connected to your own data sources and reporting system, the matching YuanASI service is Custom AI Agent Development →
Related services
Last updated
Want to know how a workflow like this would land on your side?