Skip to main content

Python SDK for building GatherChat agents

Project description

GatherChat Agent SDK

Build AI agents that chat with real people. Deploy instantly from your local machine.

Installation

pip install gathersdk

Quick Start

1. Create an Agent

# Create account & agent
gathersdk create-agent

# Gets you:
# - Agent API key 
# - Private dev room
# - Shareable chat link

2. Initialize Project

gathersdk init

Creates:

  • agent.py - Your agent code
  • .env - Your API key
  • requirements.txt - Dependencies

3. Write Your Agent

from gatherchat_agent_sdk import Agent, AgentContext

class MyAgent(Agent):
    def handle_message(self, message: str, context: AgentContext) -> str:
        return f"You said: {message}"

if __name__ == "__main__":
    agent = MyAgent()
    agent.run()

4. Go Live

python agent.py

Your agent is now live. Chat with it at your dev room link using @youragent hello!

SDK Commands

Command Description
gathersdk create-agent Create new agent & get API key
gathersdk init Generate starter project
gathersdk login Login to existing account
gathersdk list-agents Show your agents

Agent Router

The router handles incoming messages and routes them to your agent:

class ChatAgent(Agent):
    def handle_message(self, message: str, context: AgentContext) -> str:
        # Your logic here
        return response
    
    def handle_mention(self, message: str, context: AgentContext) -> str:
        # Called when someone @mentions your agent
        return response

Agent Context

AgentContext provides information about the conversation:

class AgentContext:
    chat_id: str          # Which chat room
    user_id: str          # Who sent the message  
    username: str         # User's display name
    timestamp: datetime   # When message was sent
    message_type: str     # "message" | "mention" | "dm"

Using Context

def handle_message(self, message: str, context: AgentContext) -> str:
    if context.message_type == "mention":
        return f"Hi {context.username}! You mentioned me."
    
    if "help" in message.lower():
        return "I can help you with..."
    
    return "I don't understand."

What Agents Can Do

  • Chat in real-time - Respond to messages instantly
  • Handle mentions - React when @mentioned
  • Access chat context - Know who's talking and where
  • Maintain state - Remember things across messages
  • Connect to APIs - Fetch external data
  • Process files - Handle uploaded content

API Key Management

Your API key is automatically saved to .env when you create an agent. Keep it secure:

# .env file
GATHERCHAT_API_KEY=your_secret_key_here

The SDK loads this automatically. For production, use environment variables or secret management.

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

gathersdk-0.0.6.2.tar.gz (19.7 kB view details)

Uploaded Source

Built Distribution

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

gathersdk-0.0.6.2-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file gathersdk-0.0.6.2.tar.gz.

File metadata

  • Download URL: gathersdk-0.0.6.2.tar.gz
  • Upload date:
  • Size: 19.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for gathersdk-0.0.6.2.tar.gz
Algorithm Hash digest
SHA256 30ee557be52c016aa0c3eed42a342e511c6b461d21ff52dfa0d8d13248b6a560
MD5 d284162d526e72881c8c9f4dcaac89da
BLAKE2b-256 1ef299ab1f7b7467b2f788f1cfea59f5731883dc76ff1971647a6f2033054d55

See more details on using hashes here.

File details

Details for the file gathersdk-0.0.6.2-py3-none-any.whl.

File metadata

  • Download URL: gathersdk-0.0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for gathersdk-0.0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0033dd11875eaa825f5006a6b81bdb93df6a7f38661ed3cdd82085632c63f5f5
MD5 53329e74287e74737c0b905a24c6896b
BLAKE2b-256 84de24762cf70698aef057d5364c72b7915f42adf2d1098383c422a6d34351e6

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