AnswerRocket Python SDK (`answerrocket-client`) Integration Guide
This guide walks third-party developers through integrating with AnswerRocket using its official Python SDK: answerrocket-client
. The SDK enables secure, programmatic access to AnswerRocket’s APIs, data sources, and AI-powered assistants.
📦 Installation (via pip)
Install the SDK using Python’s package manager:
pip install answerrocket-client
It’s recommended to use a virtual environment to isolate dependencies.
🔐 Authentication & Setup (Token-Based)
To securely connect to AnswerRocket using an API token:
from answer_rocket import AnswerRocketClient
arc = AnswerRocketClient(
url='https://your-answerrocket-instance.com',
token='<your_api_token>'
)
# Confirm the credentials work
arc.can_connect()
- Replace
https://your-answerrocket-instance.com
with your actual AnswerRocket environment URL. - Replace
<your_api_token>
with your generated API token.
🔑 How to Generate Your API Token
To generate an API token:
- Click the User Icon in the bottom-left corner of the AnswerRocket interface.
- In the profile panel, find the Client API Key section.
- Click Regenerate to generate a new token or Revoke to disable an existing one.
- Copy and use the token in your code.
🧠 SDK Capabilities
The answerrocket-client
SDK includes:
1. Configuration Management
- Access your current assistant (copilot) and its registered skills
- Manage chat questions and link them to skills
- Load and interact with artifacts (like layout templates and resource files)
2. Data Access
- Execute SQL queries against connected databases
- Retrieve structured results as pandas DataFrames
3. Skill Development
- Access the runtime context for skills
- Store and retrieve payloads for evaluations, visualizations, or debugging
4. AI and Language Model Services
- Generate chat completions using AnswerRocket's LLMs
- Stream real-time model responses
5. GraphQL API Integration
- Interact with the platform’s GraphQL schema using the built-in client
- Supports introspection and typed responses
For full documentation and additional examples, refer to our GitHub wiki:
📖 AnswerRocket Python SDK Wiki
💾 Example: Save a Custom Payload in a Skill
import pandas as pd
from answer_rocket.skill_platform import load_skill_platform
sp = load_skill_platform()
save_area = sp.ctx.get_payload_save_area()
save_area["validation_df"] = pd.DataFrame({
"user_question": ["barilla sales in 2022"],
"data": ["{}"]
})
This enables storing structured content like validation data for downstream processing or UI rendering.
For further guidance, visit the AnswerRocket SDK Wiki for deep dives into advanced usage, code samples, and architectural concepts.
Updated 5 days ago