Skip to content

feat: add Task API and Monitor API tools#8071

Merged
Mustafa-Esoofally merged 32 commits into
mainfrom
feat/exa-task-monitor-api
Jun 2, 2026
Merged

feat: add Task API and Monitor API tools#8071
Mustafa-Esoofally merged 32 commits into
mainfrom
feat/exa-task-monitor-api

Conversation

@Mustafa-Esoofally

@Mustafa-Esoofally Mustafa-Esoofally commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Extends ParallelTools with Task API (deep research) and Monitor API (continuous web tracking):

Task API — deep research with structured output, citations, and confidence scores

  • run_task: synchronous research (blocks until complete)
  • create_task: async task creation for long-running research
  • get_task_result: retrieve completed task results
  • get_task_status: check task progress

Monitor API — continuous web tracking with scheduled runs

  • create_monitor: create event-stream monitor for query changes
  • list_monitors: list all monitors with filters
  • get_monitor_events: retrieve detected changes
  • cancel_monitor: permanently stop a monitor

Toolkit-level config (user sets, LLM doesn't decide):

  • default_processor: Task API quality tier
  • default_monitor_processor: Monitor API processor (lite/base)
  • default_monitor_frequency: How often monitors run (1h/1d/1w/30d)
  • default_timeout: Task result timeout
  • default_output_schema: Structured output schema

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • Formatted and validated: ./scripts/format.sh and ./scripts/validate.sh pass
  • Follows toolkit patterns: enable_* flags, json.dumps() returns, proper error handling
  • Search/Extract tools unchanged from main
  • Cookbooks added: 4 cookbooks demonstrating different use cases
  • Tested locally with real API key

Add 12 new methods to ParallelTools for deep research and continuous
web tracking:

Task API (deep research with citations):
- run_task: synchronous deep research
- create_task: async task creation
- get_task_result: retrieve completed results
- get_task_status: check task progress

Monitor API (continuous web tracking):
- create_monitor: event-stream based tracking
- create_snapshot_monitor: task-output change detection
- list_monitors: list all monitors
- get_monitor: get monitor details
- update_monitor: modify frequency/status
- cancel_monitor: stop a monitor
- trigger_monitor: force immediate run
- get_monitor_events: retrieve detected events

Requires parallel-web SDK v0.6.0+.
@Mustafa-Esoofally Mustafa-Esoofally requested a review from a team as a code owner May 22, 2026 23:25
Add 4 cookbooks based on actual use cases from industry research:
- parallel_competitive_intel.py: AI code editor market comparison
- parallel_due_diligence.py: startup investment research with citations
- parallel_sales_leads.py: funding announcement monitoring and lead enrichment
- parallel_research_thesis.py: thesis validation with supporting/contradicting monitors

Also switch from logger.* to log_* utilities per codebase convention.
Add POST /webhooks/{agent_id} endpoint that receives webhooks from
external services (Parallel Monitor, GitHub, Stripe, etc.) and invokes
the specified agent with the payload as context.

- New router: libs/agno/agno/os/routers/webhooks/
- Opt-in via enable_webhooks=True on AgentOS
- Agent runs in background, returns run_id immediately
- Cookbook: parallel_webhook_monitor.py shows full pattern

Flow: Parallel detects event → POSTs to webhook → AgentOS invokes agent
→ agent calls get_monitor_events() for details → processes events
- Remove webhook support from ParallelTools (use polling with get_monitor_events instead)
- Fix SDK 0.6.0 compatibility: .monitors instead of .data, .next_cursor instead of .has_more
- Fix processor options: "base" default instead of invalid "standard"
- Fix frequency options: "1h", "1d", "1w", "30d" per Parallel docs
- Update class docstring to match codebase patterns
- Consolidate cookbooks from 9 to 3 high-value examples
- Remove webhook router from AgentOS (revert app.py changes)
- Delete unused webhook schema and router files
- Update all tool docstrings to match Gmail pattern
- Rename cookbooks for clarity:
  - parallel_tools.py -> parallel_search.py
  - parallel_task_api.py -> parallel_task.py
  - parallel_monitor_api.py -> parallel_monitor.py
- parallel_news_search.py — search latest AI news
- parallel_company_research.py — deep research with citations
- parallel_funding_tracker.py — monitor funding announcements
…rams

LLM cannot decide cost/quality tradeoffs - these are user decisions.
Tools now only expose what LLM can infer from context:
- run_task(input) / create_task(input)
- create_monitor(query)
- get_task_result(run_id) / get_task_status(run_id)

Toolkit params:
- default_processor: Task API processor tier
- default_monitor_processor: Monitor API processor (lite/base)
- default_monitor_frequency: How often monitors run
- default_timeout: Task result timeout
- default_output_schema: JSON schema for structured output
- Use 'Example N:' style comments
- Remove 'API' language
- Remove 'Uncomment to test' blocks
- Show toolkit config variations as separate agents
- Follow exa_tools.py / tavily_tools.py structure
SDK expects {"type": "json", "json_schema": {...}} not raw JSON schema
…Monitor

- Search and Extract tools unchanged from main branch
- Added Task API: run_task, create_task, get_task_result, get_task_status
- Added Monitor API: create_monitor, list_monitors, get_monitor_events, cancel_monitor
- New toolkit params for Task/Monitor config
@Mustafa-Esoofally Mustafa-Esoofally changed the title feat(parallel): add Task API and Monitor API tools feat: add Task API and Monitor API tools Jun 1, 2026
- Task API: run_task, create_task, get_task_result, get_task_status
- Monitor API: create_monitor, list_monitors, cancel_monitor, get_monitor_events
- Error handling tests included

events = []
for event in response.events:
event_data: Dict[str, Any] = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrong, some does not exist on the parallel sdk

event_data["event_type"] = getattr(event, "type", None)        # wrong: field is `event_type`
event_data["created_at"] = str(getattr(event, "created_at", ""))  # wrong: field is `event_date`
if hasattr(event, "content"):                                     # wrong: content lives under `event.output`
if hasattr(event, "citations"):                                   # wrong: citations live under `event.output.basis`
Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed

Comment thread libs/agno/agno/tools/parallel.py Outdated
Comment thread libs/agno/agno/tools/parallel.py Outdated
- Search API: AI-optimized web search that returns relevant excerpts tailored for LLMs
- Extract API: Extract content from specific URLs in clean markdown format, handling JavaScript-heavy pages and PDFs
- Task API: Deep research with structured output and citations (enable_task=True)
- Monitor API: Track topics over time and get notified of changes (enable_monitor=True)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Parallel SDK exposes monitor.update (change frequency/webhook/metadata) and monitor.retrieve (get one monitor by ID)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

tools=[
ParallelTools(
enable_task=True,
default_output_schema={

@kausmeows kausmeows Jun 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as per their docs output schema can be given in different ways-
we need cookbook showing all.
docs- https://docs.parallel.ai/task-api/task-quickstart#output-schema-types
Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added a cookbook

Comment thread libs/agno/agno/tools/parallel.py Outdated
# Task API — Deep research with structured output and citations
# -------------------------------------------------------------------------

def run_task(self, input: str) -> str:

@kausmeows kausmeows Jun 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think we need another look at this- https://docs.parallel.ai/task-api/task-quickstart#polling-vs-webhooks-vs-sse

looks light its async but we have implemented it in a blocking way. read the docs more, we probably need to use that polling or something.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed. let's kep seprate tools so agent can control the task and also run parallel ones

enable_task=True,
default_output_schema={
"type": "json",
"json_schema": {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also something to check-
if the output schema is this then that means the agent's input should be a structured input right? can you check if this structured input is rightly getting injected to the agent?

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Skipped structured input for now. Not sure how it would at toolkit level

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this does not show what the main purpose is here-
can we add better cookbooks to showcase this. can refer to parallel docs for reference on how they have shown.

Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added more good cookbooks

- Fix get_monitor_events to use correct SDK field names:
  - event.event_type (not event.type)
  - event.event_date (not event.created_at)
  - event.output.content (not event.content)
  - event.output.basis (not event.citations)
- Fix parallel_search to use excerpts (plural) not excerpt (singular)
- Extract _format_task_output helper to avoid code duplication
- Add get_monitor tool (monitor.retrieve)
- Add update_monitor tool (monitor.update)
- Update cookbook to show all 3 output schema types (auto, json, string)
- Update tests to match corrected SDK field names
Mustafa-Esoofally and others added 4 commits June 1, 2026 16:00
- parallel_task_options.py: All output schema types (auto, json, string),
  processor tiers (lite, base, pro), timeout configuration
- parallel_monitor_options.py: Frequency options (1h to 30d), processor
  tiers (lite, base), output schemas, combined configurations
…schema types

Shows the three output schema formats:
1. Auto schema: {"type": "auto"}
2. JSON schema: {"type": "json", "json_schema": {...}}
3. String schema: plain string description

Removes separate option cookbooks in favor of one focused example.
Task API:
- Remove run_task() blocking method
- Keep create_task(), get_task_status(), get_task_result() for agent control
- Rename input param to query to avoid shadowing builtin

Cookbooks:
- Move to cookbook/91_tools/parallel/ folder
- Add 6 focused use-case cookbooks:
  - output_schemas.py: All 4 output schema types
  - company_enrichment.py: CRM data enrichment
  - market_research.py: Industry analysis reports
  - investment_monitor.py: Track funding & M&A
  - competitor_tracker.py: Competitive intelligence
  - news_search.py: Fast web search
- Add README with API overview and quick start

Fixes:
- Auto schema requires 'pro' processor (not 'base')

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Comment thread libs/agno/agno/tools/parallel.py Outdated
kausmeows and others added 2 commits June 2, 2026 11:07
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous 300s default silently failed for pro/ultra tier tasks, which
Parallel documents as taking 3-25 minutes. Also pass the same value as the
httpx-level timeout so the client does not give up before the server's
api_timeout deadline (httpx default is 600s).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# =============================================================================
# RUN
# =============================================================================
if __name__ == "__main__":

@kausmeows kausmeows Jun 2, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://docs.parallel.ai/monitor-api/monitor-quickstart#monitor-api-quickstart

we have not implemented the monitor api correctly, this definitely needs a webhook otherwise there is no point. We should have that capability that you can pass a webhook url too and that webhook will recieve the events from parallel, thats the main usecase otherwise rn its not really doing anything.

i pushed an update in cookbook cookbook/91_tools/parallel/competitor_tracker.py to show how we get the events via agent in polling like fashion.

kausmeows and others added 2 commits June 2, 2026 11:21
The original cookbook only demonstrated create_monitor, leaving the
consumer side as a "now what?". Without webhooks, polling is the only
consumption path, so the example now has two phases: create monitors on
first run, then re-run with `check` to list monitors and pull events.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Mustafa-Esoofally Mustafa-Esoofally merged commit d2008ed into main Jun 2, 2026
5 checks passed
@Mustafa-Esoofally Mustafa-Esoofally deleted the feat/exa-task-monitor-api branch June 2, 2026 14:54
Mustafa-Esoofally added a commit to agno-agi/docs that referenced this pull request Jun 2, 2026
## Summary

Updates ParallelTools documentation to cover the Task API and Monitor
API tools added in agno-agi/agno#8071.

**Changes:**
- Expanded `tools/toolkits/search/parallel.mdx` from ~80 lines to ~225
lines
- Added Task API section with processor tiers (lite/base/pro/ultra) and
output schema types
- Added Monitor API section with frequency options and two-phase usage
pattern
- Updated MCP endpoint from deprecated `search-mcp.parallel.ai` to
`search.parallel.ai`
- Made API key optional (keyless access is rate-limited)
- Updated all example pages with current code patterns

## Files Changed

| File | Description |
|------|-------------|
| `tools/toolkits/search/parallel.mdx` | Main toolkit documentation |
| `tools/mcp/usage/parallel.mdx` | MCP server usage |
| `examples/tools/parallel-tools.mdx` | Toolkit examples |
| `examples/tools/mcp/parallel.mdx` | MCP example |

## Related

- agno-agi/agno#8071 (feat: add Task API and Monitor API tools)
- agno-agi/agno#8202 (cookbook: update Parallel MCP to use free
endpoint)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants