Python library to interact with Stackspot Agents API
Project description
stackclient
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_IDSTACKSPOT_CLIENT_SECRETSTACKSPOT_REALMSTACKSPOT_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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stackclient-0.2.4.tar.gz.
File metadata
- Download URL: stackclient-0.2.4.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1e25ecad82846fa15c72b140376a8ea923f56d5342079522486da586e38a40bc
|
|
| MD5 |
aca99fbffbfea3c58558967b1c1b8e0b
|
|
| BLAKE2b-256 |
59a3bee11d9a5ecb3ee6fbddc43e5613df8c1cec6e7ccd6c7e0aac07b1039f12
|
Provenance
The following attestation bundles were made for stackclient-0.2.4.tar.gz:
Publisher:
deploy.yml on riannselegar/stackclient
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stackclient-0.2.4.tar.gz -
Subject digest:
1e25ecad82846fa15c72b140376a8ea923f56d5342079522486da586e38a40bc - Sigstore transparency entry: 269562162
- Sigstore integration time:
-
Permalink:
riannselegar/stackclient@341b6499afa27bcfdca2cec0bfebdf310ffa76c8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/riannselegar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@341b6499afa27bcfdca2cec0bfebdf310ffa76c8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file stackclient-0.2.4-py3-none-any.whl.
File metadata
- Download URL: stackclient-0.2.4-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
154feb44f930728edc9c31e57dab9b317471d840fbf3aee40a275f6512067c5c
|
|
| MD5 |
7835c339e16408ca4185aa733a18a459
|
|
| BLAKE2b-256 |
5d592594e52f35d1e9281eaac9ca2f2b866dc12abf90d3f03a00add4d97cd734
|
Provenance
The following attestation bundles were made for stackclient-0.2.4-py3-none-any.whl:
Publisher:
deploy.yml on riannselegar/stackclient
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
stackclient-0.2.4-py3-none-any.whl -
Subject digest:
154feb44f930728edc9c31e57dab9b317471d840fbf3aee40a275f6512067c5c - Sigstore transparency entry: 269562172
- Sigstore integration time:
-
Permalink:
riannselegar/stackclient@341b6499afa27bcfdca2cec0bfebdf310ffa76c8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/riannselegar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@341b6499afa27bcfdca2cec0bfebdf310ffa76c8 -
Trigger Event:
push
-
Statement type: