Skip to main content

SilverRiver SDK for advanced automation and AI-driven tasks

Project description

SilverRiver

SilverRiver is an SDK for advanced automation and AI-driven tasks.

Installation

You can install SilverRiver using pip:

pip install silverriver

Agentic API

Here's a basic example of how to use SilverRiver:

import os
import time

from silverriver import AgentChatInterface
from silverriver.client import Crux
from silverriver.interfaces import SupportedModes
from silverriver.interfaces.data_models import Observation, ChatMessage, HUMAN_ROLE


# Create a custom chat interface
class CustomChat(AgentChatInterface):
    def __init__(self, init_message):
        self.chat_history = init_message

    def send_message_to_user(self, message):
        # Implement this method to send messages to the user
        pass

    def wait_for_user_message(self):
        # Implement this method to wait for and return user messages
        pass


# Initialize the Crux client
client = Crux(api_key=os.environ["CRUX_API_KEY"])

# Create a chat instance with an initial message
chat = CustomChat(
    init_message=[ChatMessage(role=HUMAN_ROLE, message="On which website are you?", timestamp=time.time())]
)

# Create a browser session
browser_session, browser_obs, browser_meta = client.create_browser_session(
    start_url="https://www.example.com",
    chat=chat
)

# Create an observation
browser_obs = Observation(
    **dict(browser_obs),
    chat_messages=chat.chat_history,
    last_action_error="",
)

# Get an action from the AI agent
code = client.get_action(browser_obs, mode=SupportedModes.FLASH)

# Execute the action
browser_session.execute(code)

# Close the client when done
client.close()

Workflow Automation

SilverRiver now includes a command-line interface (CLI) for easier interaction. Here are the available commands:

Record a Trace

To record a new trace:

silverriver record URL [-o OUTPUT] [--upload]
  • URL: The URL of the webpage to trace (must start with http:// or https://)
  • -o OUTPUT, --output OUTPUT: The output filename for the trace (default: 'silverriver_trace')

License

This project is licensed under the 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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

silverriver-0.1.37b4-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file silverriver-0.1.37b4-py3-none-any.whl.

File metadata

File hashes

Hashes for silverriver-0.1.37b4-py3-none-any.whl
Algorithm Hash digest
SHA256 322dbe6388af5dcbc75668264244257e70464b36a14acf9cfbc6e6cebae8c773
MD5 1fd5c12ff145d65a31c77455efdfb6d4
BLAKE2b-256 adae7a164fd784297750be23b01d6042fd5a107b0057f232001340a7fb5e04d4

See more details on using hashes here.

Supported by

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