Skip to content

Increment version to 0.0.78 in pyproject.toml, add API dependencies…#474

Merged
MervinPraison merged 1 commit intomainfrom
develop
May 14, 2025
Merged

Increment version to 0.0.78 in pyproject.toml, add API dependencies…#474
MervinPraison merged 1 commit intomainfrom
develop

Conversation

@MervinPraison
Copy link
Copy Markdown
Owner

@MervinPraison MervinPraison commented May 14, 2025

… for FastAPI and Uvicorn, and implement HTTP API launch functionality in agent.py for enhanced agent interaction.

Summary by CodeRabbit

  • New Features

    • Introduced the ability to launch agents as web services with HTTP API endpoints for external interaction.
    • Added example scripts demonstrating agents for weather, stock market, and travel information, each accessible via dedicated API endpoints.
    • Provided a simple agent example that can be queried via a web interface.
  • Chores

    • Updated project dependencies to include FastAPI and Uvicorn as optional requirements for API functionality.
    • Incremented the project version.

… for FastAPI and Uvicorn, and implement HTTP API launch functionality in `agent.py` for enhanced agent interaction.
@netlify
Copy link
Copy Markdown

netlify bot commented May 14, 2025

Deploy Preview for praisonai canceled.

Name Link
🔨 Latest commit 3fbaa6d
🔍 Latest deploy log https://app.netlify.com/sites/praisonai/deploys/68242acd4d34d600088575c6

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented May 14, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This update introduces new example scripts demonstrating agent creation and HTTP API launching using the praisonaiagents framework. It adds a launch method to the Agent class for running agents as FastAPI servers, updates project dependencies to support API features, and provides both simple and multi-agent API usage examples.

Changes

File(s) Change Summary
examples/mcp/mcp-sse-weather.py, src/praisonai-agents/simple-api-mcp.py, src/praisonai-agents/simple-api.py Added new example scripts demonstrating agent creation, tool integration, and launching as web services using the praisonaiagents framework. Examples include weather information agents and a general assistant, some integrating with MCP tools and SSE endpoints.
src/praisonai-agents/multi-agent-api.py Added a script to define and launch three agents (weather, stock, travel) as concurrent API endpoints on a single port, demonstrating multi-agent API deployment with non-blocking and blocking server calls.
src/praisonai-agents/praisonaiagents/agent/agent.py Introduced a launch method to the Agent class, enabling agents to serve as FastAPI HTTP API endpoints. Handles lazy imports, endpoint registration, path conflict resolution, global state management, and supports both blocking and non-blocking server execution.
src/praisonai-agents/pyproject.toml Updated project version to 0.0.78. Added an optional dependency group "api" for FastAPI and Uvicorn, and included it in the "all" features group. No changes to exported entities.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant FastAPI Server
    participant Agent
    participant Tool (optional)

    Client->>FastAPI Server: POST /{agent_path} with query
    FastAPI Server->>Agent: chat(query)
    alt Agent uses tool
        Agent->>Tool (MCP/SSE): fetch external data
        Tool (MCP/SSE)-->>Agent: return data
    end
    Agent-->>FastAPI Server: response
    FastAPI Server-->>Client: JSON response
Loading

Suggested labels

Review effort 2/5

Poem

🐇
New agents hop onto the scene,
With APIs crisp and keen.
FastAPI doors now open wide,
Weather, stocks, and travel—agents inside!
Optional deps for those who dare,
CodeRabbit’s magic everywhere.
Let’s launch, let’s chat, let’s share!
🌦️📈✈️

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 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 9d3501f and 3fbaa6d.

⛔ Files ignored due to path filters (1)
  • src/praisonai-agents/uv.lock is excluded by !**/*.lock
📒 Files selected for processing (6)
  • examples/mcp/mcp-sse-weather.py (1 hunks)
  • src/praisonai-agents/multi-agent-api.py (1 hunks)
  • src/praisonai-agents/praisonaiagents/agent/agent.py (2 hunks)
  • src/praisonai-agents/pyproject.toml (2 hunks)
  • src/praisonai-agents/simple-api-mcp.py (1 hunks)
  • src/praisonai-agents/simple-api.py (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@MervinPraison MervinPraison merged commit a930425 into main May 14, 2025
8 of 11 checks passed
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Hello @MervinPraison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

Summary of Changes

This pull request focuses on enhancing the PraisonAI agents by introducing HTTP API functionality. It increments the version to 0.0.78, adds FastAPI and Uvicorn as dependencies, and implements the launch method in agent.py to expose agents as API endpoints. The changes include adding new example scripts and modifying the pyproject.toml and uv.lock files to reflect the new dependencies and version.

Highlights

  • API Launch Functionality: The core addition is the launch method in agent.py, which allows agents to be exposed as HTTP API endpoints using FastAPI and Uvicorn. This includes handling queries via POST requests and managing server startup and shutdown.
  • Dependency Management: The pyproject.toml and uv.lock files are updated to include fastapi and uvicorn as dependencies under the api extra, ensuring that the necessary packages are installed for the API functionality.
  • Example Scripts: New example scripts (simple-api.py, simple-api-mcp.py, and multi-agent-api.py) are added to demonstrate how to launch agents as APIs, showcasing different configurations and use cases.

Changelog

Click here to see the changelog
  • examples/mcp/mcp-sse-weather.py
    • Added a new example script demonstrating how to use an agent with MCP (Message Communication Protocol) and SSE (Server-Sent Events) for weather information, using Agent and MCP from praisonaiagents and starting the agent with a weather query.
  • src/praisonai-agents/multi-agent-api.py
    • Added a new example script demonstrating how to launch multiple agents as HTTP API endpoints, including weather, stock market, and travel agents, each with specific instructions and using the launch method with blocking and non-blocking options.
  • src/praisonai-agents/praisonaiagents/agent/agent.py
    • Added lazy loading for FastAPI dependencies to avoid unnecessary imports.
    • Introduced shared variables (_shared_app, _server_started, _registered_agents) for managing the API server.
    • Implemented the launch method to expose agents as HTTP API endpoints, including handling API requests, managing server startup, and handling potential dependency import errors.
    • Added input validation and error handling for agent queries.
    • Implemented path conflict resolution for multiple agents using the same path.
  • src/praisonai-agents/pyproject.toml
    • Incremented the package version from 0.0.77 to 0.0.78.
    • Added fastapi and uvicorn as dependencies under the api extra.
    • Included the api extra in the all extra.
  • src/praisonai-agents/simple-api-mcp.py
    • Added a new example script demonstrating how to launch an agent with MCP as an HTTP API endpoint, using Agent and MCP from praisonaiagents and launching the agent on a specified path and port.
  • src/praisonai-agents/simple-api.py
    • Added a new example script demonstrating how to launch a simple agent as an HTTP API endpoint, using Agent from praisonaiagents and launching the agent on a specified path and port.
  • src/praisonai-agents/uv.lock
    • Incremented the package version from 0.0.77 to 0.0.78.
    • Added fastapi and uvicorn as dependencies under the api extra.
    • Included fastapi and uvicorn in the all extra.
    • Added dependency specifiers for fastapi and uvicorn with markers for the api extra.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


An agent's API,
FastAPI's quick reply,
Uvicorn takes flight.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request introduces a new launch method to the Agent class, enabling agents to be exposed as HTTP API endpoints using FastAPI and Uvicorn. This enhancement provides a convenient way to interact with agents programmatically. The implementation includes lazy loading of dependencies, path conflict resolution, and support for both blocking and non-blocking server execution. Overall, this is a valuable addition to the library. However, there are some areas that could be improved for clarity, maintainability, and error handling.

Summary of Findings

  • Error Handling: The error handling in the launch method could be improved by raising exceptions instead of just printing to the console. This would allow calling code to handle errors more gracefully.
  • Path Conflict Resolution: The logic for handling path conflicts could be improved. Instead of just modifying the path, consider checking if the modified path is also registered or generating a completely random path.
  • Asynchronous Compatibility: Consider using asyncio.sleep instead of time.sleep to avoid blocking the event loop.

Merge Readiness

The pull request introduces a valuable feature for exposing agents as HTTP API endpoints. However, I recommend addressing the error handling and path conflict resolution issues before merging. Additionally, consider using asyncio.sleep instead of time.sleep for better asynchronous compatibility. I am unable to approve this pull request, and recommend that others review and approve this code before merging.

shaneholloman pushed a commit to shaneholloman/praisonai that referenced this pull request Feb 4, 2026
Increment version to 0.0.78 in `pyproject.toml`, add API dependencies…
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.

1 participant