This file serves as a simulation and testing entry point for the Crypto.com Agent Client. It demonstrates how to initialize the agent, configure plugins, and interact with the LangGraph-based conversational AI.
Overview
The simulation provides a controlled environment to experiment with the Crypto.com AI Agent’s capabilities before integrating it into real-world applications, configuring it with a large language model (LLM) and blockchain settings to enable seamless interactions. It integrates various plugins, including LangFuse for observability, SQLite for persistent storage, and custom tools for enhanced functionality.
Additionally, the script features an interactive CLI-based testing loop, allowing developers to validate AI-driven blockchain interactions in real time which makes it a powerful tool for experimentation and development.
Key Features
Agent initialization with LLM and blockchain configurations.
Plugin integration (LangFuse, SQLite for storage, and custom tools).
Interactive CLI loop for testing agent responses.
Prerequisites
Before starting, ensure you have the following components ready.
Python installed (version 3.12 in Windows, version ≥ 3.12 in other operating systems)
API Key for or
API Keys of AI provider, available AI providers as below. Only the API keys for the selected AI provider are required when initializing the agent.
Google Gemini
OpenAI
Anthropic
Mistral
Fireworks
For Windows Users:
Windows 10 SDK or Windows 11 SDK depends on system version
MSVC v143 - C++ x64/86 build tools
C++ CMake tools
Get Started
pip install cryptocom-agent-client
For Windows environment, it is recommended to add the package as a dependency in pyproject.toml and install it using Poetry.
Step 2 - Before running the script, ensure that all configurations are properly set up: Replace placeholders such as your-api-key with valid credentials to enable proper functionality. Then run the python file to initialize the bot.
Simulation Example Code
from crypto_com_agent_client import Agent, SQLitePlugin, tool
# (OPTIONAL) Use SQLiteStorage for persistence
custom_storage = SQLitePlugin(db_path="agent_state.db")
# (OPTIONAL) LangFuse plugin configuration
user_langfuse_handler = {
"public-key": "user-public-key",
"secret-key": "user-secret-key",
"host": "https://langfuse.example.com",
}
# (OPTIONAL) Custom personality and character
personality = {
"tone": "friendly",
"language": "German",
"verbosity": "high",
}
# (OPTIONAL)
instructions = (
"You are a humorous assistant that always includes a joke in your responses."
)
# (OPTIONAL)
@tool
def get_weather(location: str) -> str:
"""
Provide the current weather for a given location.
Args:
location (str): The name of the location for which to retrieve weather information.
Returns:
str: A message describing the current weather in the given location.
"""
# Simulated weather response for demonstration purposes
weather_data = {
"New York": "sunny, 25°C",
"Berlin": "cloudy, 18°C",
"Tokyo": "rainy, 22°C",
}
weather = weather_data.get(location, "unavailable at the moment")
return f"The current weather in {location} is {weather}."
# Initialize the agent with LLM and blockchain configurations
agent = Agent.init(
llm_config={
"provider": "OpenAI",
"model": "gpt-4o-mini",
"provider-api-key": "your-api-key",
},
blockchain_config={
"chainId": "chain-id",
"explorer-api-key": "your-api-key",
"private-key": "your-private-key",
"sso-wallet-url": "your-sso-wallet-url",
},
plugins={
"personality": {
"tone": "friendly",
"language": "English",
"verbosity": "high",
},
"instructions": "You are a humorous assistant that always includes a joke in your responses.",
"tools": [get_weather],
"storage": custom_storage,
},
)
# Run the Graph Interactively
# Interactive CLI loop for testing
if __name__ == "__main__":
print("Welcome to the interactive Crypto.com Agent! Type 'exit' to quit.\n")
while True:
user_input = input("You: ")
if user_input.lower() == "exit":
print("Goodbye!")
break
# Get the agent's response
response = agent.interact(user_input)
print(f"Agent: {response}\n")
from crypto_com_agent_client import Agent, SQLitePlugin, tool
# (OPTIONAL) Use SQLiteStorage for persistence
custom_storage = SQLitePlugin(db_path="agent_state.db")
# (OPTIONAL) LangFuse plugin configuration
user_langfuse_handler = {
"public-key": "user-public-key",
"secret-key": "user-secret-key",
"host": "https://langfuse.example.com",
}
# (OPTIONAL) Custom personality and character
personality = {
"tone": "friendly",
"language": "German",
"verbosity": "high",
}
# (OPTIONAL)
instructions = (
"You are a humorous assistant that always includes a joke in your responses."
)
# (OPTIONAL)
@tool
def get_weather(location: str) -> str:
"""
Provide the current weather for a given location.
Args:
location (str): The name of the location for which to retrieve weather information.
Returns:
str: A message describing the current weather in the given location.
"""
# Simulated weather response for demonstration purposes
weather_data = {
"New York": "sunny, 25°C",
"Berlin": "cloudy, 18°C",
"Tokyo": "rainy, 22°C",
}
weather = weather_data.get(location, "unavailable at the moment")
return f"The current weather in {location} is {weather}."
# Initialize the agent with LLM and blockchain configurations
agent = Agent.init(
llm_config={
"provider": "GoogleGenAI",
"model": "gemini-2.0-flash",
"provider-api-key": "your-api-key",
},
blockchain_config={
"chainId": "chain-id",
"explorer-api-key": "your-api-key",
"private-key": "your-private-key",
"sso-wallet-url": "your-sso-wallet-url",
},
plugins={
"personality": {
"tone": "friendly",
"language": "English",
"verbosity": "high",
},
"instructions": "You are a humorous assistant that always includes a joke in your responses.",
"tools": [get_weather],
"storage": custom_storage,
},
)
# Run the Graph Interactively
# Interactive CLI loop for testing
if __name__ == "__main__":
print("Welcome to the interactive Crypto.com Agent! Type 'exit' to quit.\n")
while True:
user_input = input("You: ")
if user_input.lower() == "exit":
print("Goodbye!")
break
# Get the agent's response
response = agent.interact(user_input)
print(f"Agent: {response}\n")
What’s Next?
Step 1 - Run this with the following command or to .
This Quick Start provide a foundation. To dive deeper, refer to the section for more use cases and advanced scenarios that suit your interest, including building your own Telegram bot, AI Agent Chatbot, "Magic Link" Signer and more.
Visit the for detailed information on available functionalities.