Overseas access: www.kdjingpai.com
Ctrl + D Favorites

Portia AI is an open source Python software development kit (SDK) focused on helping developers build intelligent, automated workflows. It makes it easy for users to design and run complex task processes through a multi-intelligence system.Portia AI supports developers to customize workflows and provides reliable support for production environments. Users can utilize it to connect to a variety of tools such as calendars, emails, and payment systems to quickly automate tasks. The official documentation and community support are perfect for developers who need to automate their development efficiently. The project is hosted on GitHub and follows open source protocols to encourage community contributions and feedback.

Function List

  • multi-intelligence workflow: Supports the creation and management of multiple intelligences to collaborate on complex tasks.
  • Mission planning and execution: Input tasks via natural language and automatically generate execution plans.
  • tool integration: Supports connecting to external tools such as Google Calendar, Stripe, etc. to extend functionality.
  • Status Tracking: Provide PlanRunState function to monitor the progress of task execution in real time.
  • Implementation Hooks: Ensures flexibility by allowing developers to insert custom logic into task execution.
  • Open Source and Community Support: Detailed documentation and the Discord community are provided to facilitate learning and communication.
  • Production environment optimization: Emphasizes reliability and low latency for large-scale deployments.

Using Help

Installation process

To use the Portia AI Python SDK, you need to first install Python 3.11 or higher. Installation and configuration can be accomplished by following the steps below:

  1. Checking the Python Version::
    Confirm the Python version by running the following command in a terminal:

    python --version
    

    If you have a version lower than 3.11, visit Python.org to download and install the latest version.

  2. Installing the Portia SDK::
    Install the Portia SDK using pip. run the following command:

    pip install portia
    
  3. Get Portia API key::
    • Visit the Portia website (app.portialabs.ai), register and get your free Portia API key.
    • Set the key as an environment variable. Run it in the terminal:
      export PORTIA_API_KEY='你的API密钥'
      

      Or use Python's dotenv The module loads the key:

      from dotenv import load_dotenv
      load_dotenv(override=True)
      
  4. Installation of dependent tools::
    Install additional toolkits as needed, such as Google Calendar or Stripe's Python library. Refer to the official documentation (docs.portialabs.ai) to obtain specific dependencies.

Basic use

The core functionality of Portia AI is to automatically generate and execute workflows by describing tasks through natural language. Below is a simple example showing how to schedule calendar events using Portia AI:

  1. Initialization Portia::
    Create a basic Portia instance, configure default tools and execute hooks:

    from portia import Config, Portia, DefaultToolRegistry
    from portia.cli import CLIExecutionHooks
    config = Config.from_default()
    portia = Portia(
    config=config,
    tools=DefaultToolRegistry(config=config),
    execution_hooks=CLIExecutionHooks(),
    )
    
  2. Defining tasks::
    Use natural language to describe tasks. For example, scheduling a meeting:

    recipient_email = input("请输入要安排会议的邮箱地址:\n")
    task = f"""
    请帮助我完成以下任务:
    - 检查明天 8:00 到 8:30 的 Google 日历空闲时间
    - 如果有空,安排一个 30 分钟的会议,标题为“Portia AI 演示”,描述为“测试演示”,与 {recipient_email} 共享
    """
    
  3. Running Tasks::
    Calling Portia's run method to perform the task:

    plan = portia.run(task)
    
  4. View execution results::
    Portia automatically checks the calendar, schedules meetings and sends email invitations. Execution progress can be viewed in real time via PlanRunState.

Featured Function Operation

  • multi-intelligence unit (MIM) synergy: Portia supports multiple intelligences working together. Developers can design complex workflows dialogically with the PlanBuilder tool. For example, creating a customer refund workflow:
    task = """
    检查用户订单状态,如果订单有效,使用 Stripe 执行退款,完成后发送确认邮件
    """
    plan = portia.run(task)
    

    During execution, developers can insert a manual confirmation step via ExecutionHook to ensure that sensitive operations (e.g., refunds) are secure and controllable.

  • Status Tracking: Use PlanRunState to track task execution. Example:
    state = plan.get_state()
    print(state.progress)
    

    This allows you to view the progress of task completion in real time, suitable for scenarios where you need to monitor long tasks.

  • tool integration: Portia supports a wide range of external tools. The developer can set up an external tool in the DefaultToolRegistry Add customized tools to the Stripe. For example, connect Stripe:
    from portia.tools import StripeTool
    tools = DefaultToolRegistry(config=config).add(StripeTool(api_key='你的Stripe密钥'))
    portia = Portia(config=config, tools=tools)
    

Advanced Use

  • Customized Execution Hooks: Developers can define hook functions to insert logic at critical nodes of task execution. For example, asking for manual confirmation before refunding:
    class CustomHook(CLIExecutionHooks):
    def before_execution(self, task):
    print(f"即将执行任务:{task}")
    return input("是否继续?(y/n) ") == "y"
    portia = Portia(config=config, execution_hooks=CustomHook())
    
  • Production environment optimization: Courtesy of Portia StorageClass.CLOUD option for storing task state, reducing latency and increasing reliability. Configuration method:
    config = Config(storage_class=StorageClass.CLOUD)
    

Community Support

Portia AI provides detailed official documentation (docs.portialabs.ai) and Discord communities where developers can ask questions, share experiences, or report issues. There is also a paid contribution program where developers are rewarded for fixing issues on GitHub.

application scenario

  1. Automated Schedule Management
    Developers can use Portia AI to automatically check calendar availability, schedule meetings and send invitations. Ideal for busy professionals or team managers, reduce the time spent on manual coordination.
  2. Customer Service Automation
    Portia AI can build intelligent customer service systems, such as automating refund requests. Developers can set up workflows to check order status, perform refunds, and notify customers to improve efficiency.
  3. Data processing workflow
    Portia AI is suitable for large-scale data processing tasks. Developers can design multi-intelligence systems that automatically clean, analyze and store data, suitable for data scientists or business analysts.

QA

  1. Do I need to pay for Portia AI?
    Portia AI offers free API keys so users can start using it without paying. Some premium features may require additional cloud service fees, check the official website for details.
  2. What external tools are supported?
    Portia AI supports tools such as Google Calendar, Stripe, etc. Developers can also extend the functionality by customizing the tools, refer to the official documentation.
  3. How can I get involved in contributing to my community?
    Visit GitHub on portiaAI/portia-sdk-python Repository, check out the contribution guidelines. Developers can participate by fixing issues or submitting new features and have a chance to earn rewards.
0Bookmarked
0kudos

Recommended

Can't find AI tools? Try here!

Just type in the keyword Accessibility Bing SearchYou can quickly find all the AI tools on this site.

inbox

Contact Us

Top

en_USEnglish