Skip to content

Added RunAgent Cloud support#79

Merged
sawradip merged 36 commits into
mainfrom
sawra/runagent_cloud_support_wip
Nov 6, 2025
Merged

Added RunAgent Cloud support#79
sawradip merged 36 commits into
mainfrom
sawra/runagent_cloud_support_wip

Conversation

@sawradip
Copy link
Copy Markdown
Contributor

@sawradip sawradip commented Nov 6, 2025

Summary by CodeRabbit

  • New Features
    • StockAgent: Multi-agent stock trading simulation powered by LLM
    • Lead Generation Suite: Complete workflow for AI-powered lead discovery and scoring
    • Book Writer: Full-stack application for AI-assisted book generation
    • LightRAG Agent: Advanced document knowledge base with multimodal support
    • RAG Agent: Intelligent query routing across multiple databases

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Nov 6, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This PR introduces six comprehensive example applications to the RunAgent framework: a multi-agent stock trading simulator, AI-driven lead generation workflows, an automated book writing system, a lead scoring SaaS platform, a vector-based retrieval system with streaming, and a multimodal knowledge management agent. Each example includes end-to-end implementations with backend services, frontends, databases, and SDK examples in Python and/or Rust.

Changes

Cohort / File(s) Summary
StockAgent Trading Simulation
examples/Stockagent/*
Multi-agent LLM-driven stock trading simulator with Agent class managing portfolio decisions, Stock price models, Secretary API validation wrapper, prompt templates for trading actions, trade/stock/agent record logging to Excel, custom colored logging, configuration utilities, and both Python and Rust SDK test clients. Includes README, requirements, and RunAgent config.
AI Lead Generation Workflow
examples/ai_lead_generation/agents/*
Lead extraction from Quora using Firecrawl web scraping and OpenAI for classification, with CSV export and persistence. Includes main.py orchestrator, Pydantic schemas, Flask API backends, RunAgent config, and Python/Rust SDK examples.
Book Writer Workflows
examples/book_writer/*
AI book writing system with Flask backend, React frontend (Vite/Tailwind), and CrewAI-based workflow implementation. Features outline generation, parallel chapter writing, and markdown compilation. Includes UI for book generation with progress tracking and download capabilities.
Lead Agent SaaS Platform
examples/lead-agent/*
Complete lead scoring SaaS with Rust (Axum) and Python (Flask) backends, React frontend with CSV upload/mapping UI, CrewAI scoring crews, and lead response email generation. Includes comprehensive deployment guide and multi-SDK test clients.
RAG Agent System
examples/rag_agent/*
Vector-based retrieval-augmented generation with Qdrant database routing to products/support/finance collections. Features RAG chains, DuckDuckGo fallback, streaming responses, PDF upload, statistics tracking, and Flask backend with JavaScript frontend.
LightRAG Knowledge System
examples/lightrag_agent_(developing)/*
Advanced multimodal knowledge management with Neon PostgreSQL backend, document processing, Neo4j graph storage support, streaming queries, and folder processing. Includes configuration management, storage initialization, document processor utilities, and comprehensive service orchestration.
Configuration & Documentation
.gitignore, CHANGELOG.md, various README.md and .config.json files
Minor .gitignore fix (trailing newline), changelog bump to v0.1.23 with feature/bug updates, README documentation for each example, and RunAgent config.json manifests defining agent entrypoints and environment variables.

Sequence Diagram(s)

sequenceDiagram
    participant Agent as Trading Agent
    participant Secretary as Secretary Validator
    participant LLM as LLM (GPT/Gemini)
    participant Stock as Stock Model
    participant Record as Excel Logger

    Agent->>Secretary: plan_loan(date, prices, forum)
    Secretary->>LLM: build_loan_prompt()
    LLM-->>Secretary: loan_decision_json
    Secretary->>Secretary: check_loan(response, max_amount)
    alt Valid
        Secretary-->>Agent: (true, "", loan_json)
        Agent->>Agent: apply_loan(cash, loan_list)
        Agent->>Record: create_trade_record()
    else Invalid
        Secretary-->>Agent: (false, error_msg, {})
        Agent->>Agent: retry_or_fail()
    end

    Agent->>Stock: plan_stock(date, time, prices)
    Stock->>LLM: build_action_prompt()
    LLM-->>Stock: buy/sell/no_action
    Stock->>Secretary: check_action(response, cash, holdings)
    alt Valid Action
        Secretary-->>Stock: (true, "", action_json)
        Stock->>Agent: execute_buy/sell
        Agent->>Record: log_transaction()
    else Invalid
        Secretary-->>Stock: (false, error_msg, {})
        Stock->>Agent: retry()
    end
Loading
sequenceDiagram
    participant User as User
    participant Frontend as Lead Scoring UI
    participant Backend as Flask/Axum Backend
    participant RunAgent as RunAgent Client
    participant Crew as LeadScoreCrew

    User->>Frontend: Upload CSV + Configure
    Frontend->>Frontend: Parse & Map Columns
    User->>Frontend: Submit (top_n, generate_emails)
    Frontend->>Backend: POST /api/score-leads (candidates, params)
    Backend->>RunAgent: initialize_client(entrypoint: lead_score_flow)
    RunAgent->>Crew: run_flow(candidates, top_n, job_description)
    Crew->>Crew: score_all_candidates_async()
    Crew-->>RunAgent: {top_candidates, all_candidates, emails}
    RunAgent-->>Backend: result
    Backend-->>Frontend: scores_json
    Frontend->>Frontend: Render Top Candidates Table
    Frontend->>User: Offer Download (CSV, Emails)
Loading
sequenceDiagram
    participant User as User
    participant Backend as Flask Backend
    participant Agent as RAGRouterAgent
    participant VectorDB as Qdrant (3 Collections)
    participant LLM as LLM Chain
    participant Fallback as Web Search/LLM

    User->>Backend: POST /api/query (question)
    Backend->>Agent: query(question)
    Agent->>Agent: route_query(question)
    alt High Confidence Vector Match
        Agent->>VectorDB: search(question, k=3) → [products|support|finance]
    else Use Router Agent
        Agent->>LLM: route_via_agent(question)
        LLM-->>Agent: determined_db
    end
    Agent->>VectorDB: retrieve_documents(db_collection)
    Agent->>LLM: rag_chain(question, documents)
    LLM-->>Agent: answer
    alt Success
        Agent-->>Backend: {success: true, answer, source, docs}
    else No Good Match
        Agent->>Fallback: web_search(question)
        Fallback-->>Agent: web_results
        Agent->>LLM: summarize_web(results)
        LLM-->>Agent: answer
        Agent-->>Backend: {success: true, answer, source: "web"}
    end
    Backend-->>User: json_response
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

This PR introduces substantial, heterogeneous complexity across six distinct example systems with high logic density:

  • Core agent/crew implementations (StockAgent, LeadScoreCrew, RAGRouterAgent, RAGService): intricate state management, API integrations, retry logic, and financial/scoring workflows requiring careful verification of correctness
  • Database and storage layers (NeonStorageManager, rag_service.py): async PostgreSQL operations, Neo4j graph initialization, collection management—critical infrastructure requiring validation
  • Multi-language implementations (Python/Rust/TypeScript backends and frontends): platform-specific concerns, API contract mismatches, serialization issues
  • External service integrations (OpenAI, Firecrawl, Qdrant, Neon, Google APIs): credential handling, fallback logic, error recovery paths
  • Configuration cascades (LightRAGConfig with env variable mutations, runagent.config.json manifests): complex precedence and initialization ordering
  • No apparent duplication across examples—each represents unique logic patterns
  • Frontend complexity: React components with stateful workflows (CSV mapping, multi-step forms, streaming UI)

Areas requiring extra attention:

  • examples/Stockagent/agent.py — Financial calculations, loan repayment, bankruptcy handling; verify mathematical correctness and edge cases
  • examples/lead-agent/lead-score-flow/main.py — Async/await orchestration, event loop nesting (nest_asyncio), error recovery paths
  • examples/lightrag_agent_(developing)/agent/storage.py — AGE (Apache AGE) graph setup, conditional Neo4j initialization; database-specific logic
  • examples/lightrag_agent_(developing)/agent/config.py — Pydantic validation, env var mutation (os.environ side effects), Neon connection string parsing
  • examples/rag_agent/agent/agent.py — RAG chain construction, routing heuristics (score averaging), fallback strategies
  • Frontend state machines (examples/lead-agent/frontend/src/App.tsx, examples/rag_agent/frontend/app.js) — Multi-step workflows, error recovery, loading states

Possibly related PRs

  • Added examples and Rust SDK fix #78: Overlaps with StockAgent example additions (.gitignore newline, config files, core agent implementation); likely a previous attempt or preparatory PR.
  • Rad/new ready example #77: Shares identical StockAgent module changes (Agent, Stock, Secretary classes, prompts, utilities, logging); appears to be a related or duplicate effort for the same example.

Poem

🐰 Six new agents hop into the warren,
Trading stocks and scoring leads with fervor,
Books they write, knowledge they explore,
RAG retrieval, multimodal and more!
The runagent ecosystem grows so bright,
Example by example, feature-rich and tight!

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch sawra/runagent_cloud_support_wip

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d8b0aa and 7aa44e4.

⛔ Files ignored due to path filters (17)
  • examples/Stockagent/res/stocks.xlsx is excluded by !**/*.xlsx
  • examples/Stockagent/res/trades.xlsx is excluded by !**/*.xlsx
  • examples/book_writer/frontend/package-lock.json is excluded by !**/package-lock.json
  • examples/book_writer/sample.png is excluded by !**/*.png
  • examples/deprecated/Vibe_Agent_Builder_gpt_5/image/agent-builder-ui.png is excluded by !**/*.png
  • examples/deprecated/Vibe_Agent_Builder_gpt_5/image/agent-ui.png is excluded by !**/*.png
  • examples/deprecated/Vibe_Agent_Builder_gpt_5/image/graph.png is excluded by !**/*.png
  • examples/deprecated/Vibe_Agent_Builder_gpt_5/static/icon.png is excluded by !**/*.png
  • examples/lead-agent/frontend/package-lock.json is excluded by !**/package-lock.json
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/leads.csv is excluded by !**/*.csv
  • examples/rag_agent/frontend/package-lock.json is excluded by !**/package-lock.json
  • examples/rag_agent/nvidia_fin.pdf is excluded by !**/*.pdf
  • examples/recipe_creator/frontend/package-lock.json is excluded by !**/package-lock.json
  • examples/trip_planner/frontend/package-lock.json is excluded by !**/package-lock.json
  • leads_20251102_115848.csv is excluded by !**/*.csv
  • leads_20251102_120327.csv is excluded by !**/*.csv
  • runagent-ts/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (107)
  • .gitignore (1 hunks)
  • CHANGELOG.md (1 hunks)
  • examples/Stockagent/README.md (1 hunks)
  • examples/Stockagent/agent.py (1 hunks)
  • examples/Stockagent/log/custom_logger.py (1 hunks)
  • examples/Stockagent/main.py (1 hunks)
  • examples/Stockagent/prompt/agent_prompt.py (1 hunks)
  • examples/Stockagent/record.py (1 hunks)
  • examples/Stockagent/requirements.txt (1 hunks)
  • examples/Stockagent/runagent.config.json (1 hunks)
  • examples/Stockagent/runagent_wrapper.py (1 hunks)
  • examples/Stockagent/sdk_test/python/test_agent.py (1 hunks)
  • examples/Stockagent/sdk_test/rust/Cargo.toml (1 hunks)
  • examples/Stockagent/sdk_test/rust/src/main.rs (1 hunks)
  • examples/Stockagent/secretary.py (1 hunks)
  • examples/Stockagent/stock.py (1 hunks)
  • examples/Stockagent/util.py (1 hunks)
  • examples/ai_lead_generation/agents/README.md (1 hunks)
  • examples/ai_lead_generation/agents/main.py (1 hunks)
  • examples/ai_lead_generation/agents/requirements.txt (1 hunks)
  • examples/ai_lead_generation/agents/runagent.config.json (1 hunks)
  • examples/ai_lead_generation/sdk/python/test.py (1 hunks)
  • examples/book_writer/backend/app.py (1 hunks)
  • examples/book_writer/frontend/index.html (1 hunks)
  • examples/book_writer/frontend/package.json (1 hunks)
  • examples/book_writer/frontend/postcss.config.cjs (1 hunks)
  • examples/book_writer/frontend/src/App.tsx (1 hunks)
  • examples/book_writer/frontend/src/index.css (1 hunks)
  • examples/book_writer/frontend/src/main.tsx (1 hunks)
  • examples/book_writer/frontend/tailwind.config.js (1 hunks)
  • examples/book_writer/frontend/tsconfig.json (1 hunks)
  • examples/book_writer/frontend/vite.config.ts (1 hunks)
  • examples/book_writer/sdk/python/test.py (1 hunks)
  • examples/book_writer/write_a_book_with_flows/.gitignore (1 hunks)
  • examples/book_writer/write_a_book_with_flows/Automating_Tasks_with_CrewAI.md (1 hunks)
  • examples/book_writer/write_a_book_with_flows/README.md (1 hunks)
  • examples/book_writer/write_a_book_with_flows/The_Current_State_of_AI_in_July_2025.md (1 hunks)
  • examples/book_writer/write_a_book_with_flows/main.py (1 hunks)
  • examples/book_writer/write_a_book_with_flows/pyproject.toml (1 hunks)
  • examples/book_writer/write_a_book_with_flows/requirements.txt (1 hunks)
  • examples/book_writer/write_a_book_with_flows/runagent.config.json (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/crews/__init__.py (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/crews/outline_book_crew/__init__.py (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/crews/outline_book_crew/config/agents.yaml (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/crews/outline_book_crew/config/tasks.yaml (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/crews/outline_book_crew/outline_crew.py (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/crews/write_book_chapter_crew/__init__.py (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/crews/write_book_chapter_crew/config/agents.yaml (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/crews/write_book_chapter_crew/config/tasks.yaml (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/crews/write_book_chapter_crew/write_book_chapter_crew.py (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/main_back.py (1 hunks)
  • examples/book_writer/write_a_book_with_flows/src/write_a_book_with_flows/types.py (1 hunks)
  • examples/lead-agent/backend-rust/.gitignore (1 hunks)
  • examples/lead-agent/backend-rust/Cargo.toml (1 hunks)
  • examples/lead-agent/backend-rust/README.md (1 hunks)
  • examples/lead-agent/backend-rust/src/main.rs (1 hunks)
  • examples/lead-agent/backend/app.py (1 hunks)
  • examples/lead-agent/deployment_guide.md (1 hunks)
  • examples/lead-agent/frontend/index.html (1 hunks)
  • examples/lead-agent/frontend/package.json (1 hunks)
  • examples/lead-agent/frontend/postcss.config.js (1 hunks)
  • examples/lead-agent/frontend/src/App.tsx (1 hunks)
  • examples/lead-agent/frontend/src/index.css (1 hunks)
  • examples/lead-agent/frontend/src/main.tsx (1 hunks)
  • examples/lead-agent/frontend/tailwind.config.js (1 hunks)
  • examples/lead-agent/frontend/tsconfig.json (1 hunks)
  • examples/lead-agent/frontend/tsconfig.node.json (1 hunks)
  • examples/lead-agent/frontend/vite.config.ts (1 hunks)
  • examples/lead-agent/lead-score-flow/.gitignore (1 hunks)
  • examples/lead-agent/lead-score-flow/Automating_Tasks_with_CrewAI.md (1 hunks)
  • examples/lead-agent/lead-score-flow/README.md (1 hunks)
  • examples/lead-agent/lead-score-flow/main.py (1 hunks)
  • examples/lead-agent/lead-score-flow/pyproject.toml (1 hunks)
  • examples/lead-agent/lead-score-flow/requirements.txt (1 hunks)
  • examples/lead-agent/lead-score-flow/runagent.config.json (1 hunks)
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/constants.py (1 hunks)
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/crews/lead_response_crew/config/agents.yaml (1 hunks)
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/crews/lead_response_crew/config/tasks.yaml (1 hunks)
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/crews/lead_response_crew/lead_response_crew.py (1 hunks)
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/crews/lead_score_crew/config/agents.yaml (1 hunks)
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/crews/lead_score_crew/config/tasks.yaml (1 hunks)
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/crews/lead_score_crew/lead_score_crew.py (1 hunks)
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/types.py (1 hunks)
  • examples/lead-agent/lead-score-flow/src/lead_score_flow/utils/candidateUtils.py (1 hunks)
  • examples/lead-agent/runagent_sdk/python/test_sdk.py (1 hunks)
  • examples/lead-agent/runagent_sdk/rust/Cargo.toml (1 hunks)
  • examples/lead-agent/runagent_sdk/rust/src/main.rs (1 hunks)
  • examples/lightrag_agent_(developing)/agent/__init__.py (1 hunks)
  • examples/lightrag_agent_(developing)/agent/config.py (1 hunks)
  • examples/lightrag_agent_(developing)/agent/lightrag_agent.py (1 hunks)
  • examples/lightrag_agent_(developing)/agent/storage.py (1 hunks)
  • examples/lightrag_agent_(developing)/requirements.txt (1 hunks)
  • examples/lightrag_agent_(developing)/runagent.config.json (1 hunks)
  • examples/lightrag_agent_(developing)/sdk/python/test.py (1 hunks)
  • examples/lightrag_agent_(developing)/services/__init__.py (1 hunks)
  • examples/lightrag_agent_(developing)/services/document_processor.py (1 hunks)
  • examples/lightrag_agent_(developing)/services/neon_service.py (1 hunks)
  • examples/lightrag_agent_(developing)/services/rag_service.py (1 hunks)
  • examples/lightrag_agent_(developing)/utils/__init__.py (1 hunks)
  • examples/lightrag_agent_(developing)/utils/helpers.py (1 hunks)
  • examples/rag_agent/README.md (1 hunks)
  • examples/rag_agent/agent/agent.py (1 hunks)
  • examples/rag_agent/agent/requirements.txt (1 hunks)
  • examples/rag_agent/agent/runagent.config.json (1 hunks)
  • examples/rag_agent/backend/app.py (1 hunks)
  • examples/rag_agent/backend/requirements.txt (1 hunks)
  • examples/rag_agent/frontend/app.js (1 hunks)
⛔ Files not processed due to max files limit (19)
  • examples/rag_agent/frontend/index.html
  • examples/rag_agent/frontend/package.json
  • examples/rag_agent/frontend/style.css
  • examples/rag_agent/manage_documents.py
  • examples/rag_agent/sdk/python/test.py
  • examples/rag_agent/test_connection.py
  • examples/recipe_creator/agents/recipe_agent.py
  • examples/recipe_creator/agents/requirements.txt
  • examples/recipe_creator/agents/runagent.config.json
  • examples/recipe_creator/backend/app.py
  • examples/recipe_creator/frontend/README.md
  • examples/recipe_creator/frontend/app.js
  • examples/recipe_creator/frontend/index.html
  • examples/recipe_creator/frontend/package.json
  • examples/recipe_creator/frontend/style.css
  • examples/recipe_creator/sdk/python/test.py
  • examples/screenplay_writer/README.md
  • examples/screenplay_writer/agents/requirements.txt
  • examples/screenplay_writer/agents/runagent.config.json

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.

@sawradip sawradip merged commit 7c02b2d into main Nov 6, 2025
1 of 2 checks passed
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