Skip to main content

Installation

Install the Conversimple SDK using pip:
pip install conversimple-sdk

Basic Usage

Here is a basic example of a Conversimple agent that can get the current weather:
import asyncio
from conversimple import ConversimpleAgent, tool

class MyAgent(ConversimpleAgent):
    @tool("Get current weather for a location")
    def get_weather(self, location: str) -> dict:
        return {"location": location, "temperature": 72, "condition": "sunny"}

    def on_conversation_started(self, conversation_id: str):
        print(f"Conversation started: {conversation_id}")

async def main():
    agent = MyAgent(
        api_key="your-api-key",
        customer_id="your-customer-id"
    )
    
    await agent.start()
    
    # Keep running
    while True:
        await asyncio.sleep(1)

if __name__ == "__main__":
    asyncio.run(main())

Running the Agent

  1. Save the code above as my_agent.py.
  2. Set your API key and customer ID as environment variables:
    export CONVERSIMPLE_API_KEY="your-api-key"
    export CONVERSIMPLE_CUSTOMER_ID="your-customer-id"
    
  3. Run the agent:
    python my_agent.py
    
Your agent is now running and connected to the Conversimple platform. You can now start a conversation and test your get_weather tool.