The official Python SDK for interacting with the Crossnode AI platform.
pip install crossnodeAuthenticate the client using an API Key from your crossnode dashboard. By default, the SDK looks for the CROSSNODE_API_KEY environment variable.
import os
from crossnode import CrossnodeClient
os.environ["CROSSNODE_API_KEY"] = "sk-crossnode-..."
client = CrossnodeClient()The SDK provides programmatic access to your Agents, Runs, and Tools.
Manage and run your AI agents.
# List agents
agents = client.agents.list(limit=10)
# Get specific agent
agent = client.agents.retrieve(agent_id="agt_123")
# Trigger an agent run
run = client.agents.run(agent_id="agt_123", input_data="Analyze the market trends.")
# Export an agent configuration
config = client.agents.export(agent_id="agt_123")
# View run history for an agent
history = client.agents.list_runs(agent_id="agt_123")Access and control agent execution logs, chat workflows, and files.
# Check run status
status = client.runs.retrieve(run_id=run["id"])
# Stream agent logs in real-time (Server-Sent Events)
for event in client.runs.stream_logs(run_id=run["id"]):
print(event)
# Upload a file to the sandbox for the agent to use
file_info = client.runs.upload_file(run_id=run["id"], file_path="dataset.csv")
# Continue a conversational agent session
response = client.runs.chat_continue(run_id=run["id"], input_text="What about Q3?")
# Pause and resume execution
client.runs.pause(run_id=run["id"])
client.runs.resume(run_id=run["id"])
# Human-In-The-Loop: List and approve pending runs
pending = client.runs.list_pending_approvals()
client.runs.approve(run_id=pending[0]["run_id"], decision="approved")Register, list, and delete custom tools used by your agents.
from crossnode import tool
@tool
def get_customer_details(customer_id: int) -> dict:
"""
Retrieves the details for a specific customer.
:param customer_id: The unique identifier for the customer.
"""
if customer_id == 123:
return {"name": "Jane Doe", "plan": "premium"}
return {"error": "Customer not found"}
# Register the Python function as a tool on Crossnode
registered_tool = client.tools.register(get_customer_details)
# List available tools
tools = client.tools.list()
# Retrieve or delete a tool
client.tools.retrieve(tool_id=registered_tool["id"])
client.tools.delete(tool_id=registered_tool["id"])