Skip to main content

Add your description here

Project description

stackclient

PyPI version

A simple Python client for interacting with StackSpot public Agents API.
Handles authentication (OAuth2 client credentials) and allows you to send prompts to StackSpot agents.


Features

  • Authenticate with StackSpot using OAuth2 client credentials.
  • Send prompts to any StackSpot agent and receive responses.
  • Minimal dependencies (urllib3).

Installation

Install from PyPI:

pip install stackclient

Usage

1. Import and Initialize

You can provide credentials directly or via environment variables:

  • STACKSPOT_CLIENT_ID
  • STACKSPOT_CLIENT_SECRET
  • STACKSPOT_REALM
  • STACKSPOT_AGENT_ID (optional, can be set per call)
from stackclient.client import StackSpotAgentClient

# Option 1: Pass credentials directly
client = StackSpotAgentClient(
    realm="your-realm",
    client_id="your-client-id",
    client_secret="your-client-secret",
    agent_id="your-agent-id"  # optional, can be set per call
)

# Option 2: Use environment variables
# export STACKSPOT_CLIENT_ID=your-client-id
# export STACKSPOT_CLIENT_SECRET=your-client-secret
# export STACKSPOT_REALM=your-realm
# export STACKSPOT_AGENT_ID=your-agent-id
client = StackSpotAgentClient()

2. Call an Agent

try:
    response = client.call_agent("Hello, StackSpot agent!")
    print(response)
except Exception as e:
    print(f"Error: {e}")

You can override the default agent ID per call:

response = client.call_agent("Prompt for another agent", agent_id="another-agent-id")

Exception Handling

  • AuthenticationError: Raised if authentication fails.
  • AgentCallError: Raised if the agent call fails.
  • MissingCredentialsError: Raised if required credentials are missing.
  • MissingAgentIDError: Raised if no agent ID is provided.

Requirements

  • Python 3.7+
  • urllib3>=2.5.0

License

MIT


Example

from stackclient.client import StackSpotAgentClient

client = StackSpotAgentClient(
    realm="myrealm",
    client_id="myclientid",
    client_secret="mysecret",
    agent_id="myagentid"
)
result = client.call_agent("What is StackSpot?")
print(result)

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

stackclient-0.2.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

stackclient-0.2.2-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file stackclient-0.2.2.tar.gz.

File metadata

  • Download URL: stackclient-0.2.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for stackclient-0.2.2.tar.gz
Algorithm Hash digest
SHA256 45ced85bd85a69bbdd7431d5211b7f5c3dce9b711d6d96a322d05cfcd2ab9680
MD5 da228f042fa613585083405a1d0afa67
BLAKE2b-256 39b6925b6a6cf56e349ece599ae06b58d3c81136deeebf743ed0fabc3469fcf7

See more details on using hashes here.

Provenance

The following attestation bundles were made for stackclient-0.2.2.tar.gz:

Publisher: deploy.yml on riannselegar/stackclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file stackclient-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: stackclient-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for stackclient-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1c4a05a039e04eb620782df7a9e5bf3ca5ecfdcf1fe80f9847bde409daf6ea59
MD5 37dd8ee0ebf153faf351e29c2a1242da
BLAKE2b-256 3df09ee8830291c5679bd1f9aa6829ec294885c5c3eea86dbc67168e797cd5a1

See more details on using hashes here.

Provenance

The following attestation bundles were made for stackclient-0.2.2-py3-none-any.whl:

Publisher: deploy.yml on riannselegar/stackclient

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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