Skip to main content

A framework for building intelligent agents that perform scheduled tasks and provide chat interfaces

Project description

Pancaik Agents

📚 Documentation

A framework for building intelligent agents that perform scheduled tasks and provide chat interfaces.

Features

  • Task Automation: Agents accomplish objectives through scheduled one-off or recurring tasks
  • Chat Interface: Direct interaction with agents through conversational interfaces
  • Flexible Scheduling: Support for cron-style, interval-based, and one-time scheduling
  • Extensible Architecture: Easy to customize and extend for specific use cases

Installation

# Install from PyPI
pip install pancaik

Getting Started

Building a Pancaik agent involves three simple steps:

1. Define your agent's tasks in a YAML configuration

# config.yaml
tasks:
  greet_share_time:
    objective: "Greet a person by name and share the current time"
    scheduler:
      type: "random_interval"
      params:
        min_minutes: 5
        max_minutes: 30
    pipeline:
      - greet
      - say_current_hour

2. Create your agent class with task functions

# greeter_agent.py
from pancaik.core.agent import Agent
import datetime

class GreetingAgent(Agent):
    """An agent specialized in greetings and conversations"""
    name = "greeting_agent"
    
    def __init__(self, id=None, yaml_path=None):
        super().__init__(yaml_path=yaml_path, id=id)
    
    async def say_current_hour(self):
        """Get and say the current time"""
        current_time = datetime.datetime.now()
        formatted_time = current_time.strftime("%H:%M:%S")
        return {"time": f"The current time is {formatted_time}."}
        
    async def greet(self, name="World"):
        """Greet a person by name"""
        greeting = f"Hello, {name}! Nice to meet you."
        return {"greeting": greeting}

3. Run your agent

# run_server.py
import asyncio
from greeter_agent import GreetingAgent
from pancaik import init, run_server
from datetime import datetime

async def main():
    # Initialize pancaik
    app = await init({
        "run_continuous": True,
        "app_title": "Greeter Agent Demo"
    })
    
    # Initialize agent
    greeter = GreetingAgent(yaml_path="config.yaml")

    # Run a task directly
    result = await greeter.run("greet", name="Alice")
    print(result["greeting"])  # Outputs: Hello, Alice! Nice to meet you.
    
    # Schedule a task
    await greeter.schedule_task(
        task_name="greet_share_time", 
        next_run=datetime.now(),
        params={"name": "Anna"}
    )

    return app

if __name__ == "__main__":
    app = asyncio.run(main())
    # Start the server
    run_server(app, host="0.0.0.0", port=8080)

Use Cases

  • Social media management with automated posting
  • Customer support chatbots with knowledge base integration
  • Inquiry and quotation systems with form processing
  • Content aggregation and distribution systems

Local Development

Running MongoDB Locally

For local development and testing, you can use Docker Compose to run a MongoDB instance:

# Start MongoDB
docker-compose up -d

# Connect to the MongoDB instance
# Default connection string: mongodb://localhost:27017/pancaik

# Stop MongoDB when finished
docker-compose down

This will start a MongoDB container accessible at mongodb://localhost:27017/pancaik, which is the default connection string used by Pancaik.

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pancaik-0.2.0a2.tar.gz (65.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pancaik-0.2.0a2-py3-none-any.whl (91.0 kB view details)

Uploaded Python 3

File details

Details for the file pancaik-0.2.0a2.tar.gz.

File metadata

  • Download URL: pancaik-0.2.0a2.tar.gz
  • Upload date:
  • Size: 65.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.4 Darwin/24.4.0

File hashes

Hashes for pancaik-0.2.0a2.tar.gz
Algorithm Hash digest
SHA256 ff5b962589c90ab5e7bb1f393b0fd0e632a4d608dbbc53f8126f8706774c0a31
MD5 b503d1b68b73299882d3cd17453c25c4
BLAKE2b-256 dbc93a3f511d1ae3531def34bc057ac200e189e92219c492871144af6c10f491

See more details on using hashes here.

File details

Details for the file pancaik-0.2.0a2-py3-none-any.whl.

File metadata

  • Download URL: pancaik-0.2.0a2-py3-none-any.whl
  • Upload date:
  • Size: 91.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.11.4 Darwin/24.4.0

File hashes

Hashes for pancaik-0.2.0a2-py3-none-any.whl
Algorithm Hash digest
SHA256 b382d742b6d623ad3972da9b65f35bd867f0ec3a17d33f05dff165efec4e328c
MD5 0a57c5f532ee95d285b7ca67293c4b47
BLAKE2b-256 3f907307e0f32ca6a45014a04cd89b85f8d9bb5cceb1788b9566c2c5389ed0ad

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page