agentql-integrations icon indicating copy to clipboard operation
agentql-integrations copied to clipboard

Add Human Pages integration for human fallback

Open human-pages-ai opened this issue 7 months ago • 2 comments

Summary

  • Adds a humanpages integration package that combines AgentQL with Human Pages for automatic human fallback when extraction fails
  • HumanFallbackAgent class: tries AgentQL first, delegates to a real human if extraction fails
  • HumanPagesClient class: full REST API wrapper with sync and async methods
  • 21 unit tests, example script, Jupyter notebook in docs/

Package structure

humanpages/
├── agentql_humanpages/     # Package source
│   ├── agent.py            # HumanFallbackAgent (sync + async)
│   ├── client.py           # HumanPagesClient REST wrapper
│   ├── const.py            # Endpoints and defaults
│   └── messages.py         # Error messages
├── tests/unit_tests/       # 21 tests (all pass, no network)
├── examples/               # Scraper example with README
├── docs/                   # Jupyter notebook
├── pyproject.toml          # Poetry config
└── Makefile                # Standard targets

Links

human-pages-ai avatar Apr 21 '26 10:04 human-pages-ai

[!WARNING]

Rate limit exceeded

@human-pages-ai has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 49 minutes and 57 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 49 minutes and 57 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5ee0a448-cb59-4699-90d6-03c539052fa4

📥 Commits

Reviewing files that changed from the base of the PR and between cfe98e949756887c3afe141742dbb34dbef71e43 and a471f8372239a271b2f825f50974abe726210e06.

📒 Files selected for processing (2)
  • humanpages/Makefile
  • humanpages/agentql_humanpages/agent.py
📝 Walkthrough

Walkthrough

This pull request adds the agentql-humanpages integration package. It implements HumanFallbackAgent (sync and async) that attempts AgentQL extraction and falls back to Human Pages jobs when AgentQL fails or returns empty results. It introduces HumanPagesClient for REST interactions, configuration constants and error messages, packaging and build files, examples, documentation, and unit/integration tests and CI/Makefile targets.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant HumanFallbackAgent
    participant AgentQL_API as "AgentQL API"
    participant HumanPagesClient
    participant HumanPages_API as "Human Pages API"

    Client->>HumanFallbackAgent: extract(url, query/prompt)
    HumanFallbackAgent->>HumanFallbackAgent: validate query/prompt

    HumanFallbackAgent->>AgentQL_API: POST /v1/query-data (url, query/prompt, mode)
    alt AgentQL returns data
        AgentQL_API-->>HumanFallbackAgent: 200 + data
        HumanFallbackAgent-->>Client: {"source":"agentql","data":...}
    else AgentQL error or empty data
        AgentQL_API-->>HumanFallbackAgent: error or empty
        HumanFallbackAgent->>HumanPagesClient: search_humans(skill="web task", available=True)
        HumanPagesClient->>HumanPages_API: GET /api/humans/search
        HumanPages_API-->>HumanPagesClient: humans list
        HumanPagesClient-->>HumanFallbackAgent: humans list

        HumanFallbackAgent->>HumanPagesClient: create_job(humanId, title, description, priceUsdc, deadlineHours)
        HumanPagesClient->>HumanPages_API: POST /api/jobs
        HumanPages_API-->>HumanPagesClient: job created (job_id)
        HumanPagesClient-->>HumanFallbackAgent: job details

        loop poll until terminal or max attempts
            HumanFallbackAgent->>HumanPagesClient: get_job_status(job_id)
            HumanPagesClient->>HumanPages_API: GET /api/jobs/{job_id}
            HumanPages_API-->>HumanPagesClient: job status
            HumanPagesClient-->>HumanFallbackAgent: status
        end

        HumanFallbackAgent->>HumanPagesClient: get_job_messages(job_id)
        HumanPagesClient->>HumanPages_API: GET /api/jobs/{job_id}/messages
        HumanPages_API-->>HumanPagesClient: messages
        HumanPagesClient-->>HumanFallbackAgent: messages

        HumanFallbackAgent-->>Client: {"source":"humanpages","job_id":...,"status":...,"messages":[...]}
    end
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The PR title clearly summarizes the main change: adding a Human Pages integration package for automatic human fallback when AgentQL extraction fails.
Description check ✅ Passed The PR description is directly related to the changeset. It clearly explains the purpose (combining AgentQL with Human Pages for fallback), the main classes introduced (HumanFallbackAgent and HumanPagesClient), the package structure, and includes links to relevant documentation.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • [ ] Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

coderabbitai[bot] avatar Apr 21 '26 10:04 coderabbitai[bot]

Disclosure: I'm a maintainer of Human Pages. Happy to adjust the integration if there's anything you'd like changed to better fit the repo's conventions.

human-pages-ai avatar Apr 23 '26 10:04 human-pages-ai