PsyNova Docs
WebsiteGitHubXTG Channel
  • PsyNova Documentation
  • Overview
  • PsyNova Framework Foundations
  • Core Technology
    • 🤖No-Code AI Agents Creation
    • 🧠Integration with Advanced LLMs
    • 🌐API Integration and WebSocket Support
    • 📝Scalable and Secure
  • PsyNova - SDK
  • PsyNova #101: App Guide
  • Key Advantages
  • Dashboard Features and Updates
  • Tokenomics
  • Contact and Support
Powered by GitBook
On this page
  • Technical Requirements
  • Quick Start
  • Installation
  • Basic Usage
  • Error Handling
  • API Reference

PsyNova - SDK

Psynova is a Python-based AI agent framework that enables developers to create, manage, and interact with AI agents through a simple yet powerful API interface.

PreviousScalable and SecureNextPsyNova #101: App Guide

Last updated 5 months ago


Technical Requirements

  • Python 3.10 or higher

  • Dependencies:

    • requests 2.31.0


Quick Start

Installation

pip install psynova==1.2

Basic Usage

from psynova import PsynovaClient

# Initialize the client
client = PsynovaClient(
    private_key="your_private_key",
    base_url="https://api.psynova.ai"  # Optional: defaults to dev environment
)

# Create a new agent
agent_id = client.create_agent(
    name="My AI Agent",
    version_id=1,
    using_https=True,
    using_socket=True
)

# Chat with the agent
response = client.chat(
    agent_id=agent_id,
    message="Hello, AI agent!"
)
print(response)

Error Handling

The framework includes robust error handling through the PsynovaAPIError class, which provides detailed error messages and optional additional error context when API requests fail.

try:
    response = client.chat(agent_id=1, message="Hello")
except PsynovaAPIError as e:
    print(f"Error: {str(e)}")
    if e.errors:
        print(f"Additional details: {e.errors}")

API Reference

PsynovaClient

Constructor

client = PsynovaClient(private_key, base_url="https://api.psynova.ai", timeout=30)
  • private_key (str): Private key for authentication

  • base_url (str, optional): Base URL for API. Defaults to development environment

  • timeout (int, optional): Request timeout in seconds. Defaults to 30

Methods

get_agent(agent_id)

Retrieves details of a specific agent.

agent = client.get_agent(agent_id=1)

Returns: Dictionary containing agent details (id, name, version_id, status)

list_agents()

Lists all agents associated with the account.

agents = client.list_agents()

Returns: List of dictionaries containing agent details

chat(agent_id, message)

Sends a chat message to an agent.

response = client.chat(agent_id=1, message="Hello!")

Returns: String containing the agent's response

create_agent(name, version_id, using_https=True, using_socket=True)

Creates a new agent with specified configuration.

agent_id = client.create_agent(
    name="My Agent",
    version_id=1,
    using_https=True,
    using_socket=True
)

Returns: Integer ID of the newly created agent

GitHub - psynova-ai/psynova-sdk: Psynova is a Python-based AI agent framework that enables developers to create, manage, and interact with AI agents through a simple yet powerful API interface.GitHub
https://github.com/psynova-ai/psynova-sdk
Logo