cryptocom-agent-client


Namecryptocom-agent-client JSON
Version 1.1.1 PyPI version JSON
download
home_pageNone
SummaryA Python client to interact with @cryptocom/agent
upload_time2025-07-16 19:33:47
maintainerNone
docs_urlNone
authorRic Arcifa
requires_python<4.0.0,>=3.12
licenseMIT
keywords blockchain crypto.com ai tool sdk
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Crypto.com Agent Client

The **Crypto.com Agent Client** is a Python library designed to integrate advanced conversational AI capabilities with blockchain functionality. It provides tools, plugins, and utilities to build robust and extensible agent workflows with graphs and Crypto.com blockchain integrations.

## Features

### Conversational AI Integration

- Build conversational agents with state-of-the-art Large Language Models (LLMs) like OpenAI's GPT series, Anthropic's Claude, and Meta's Llama 4.
- Customize agent behavior using plugins for personality and instructions.

### Blockchain Integration

- Perform blockchain-specific operations with pre-built functions:

  - Create wallets.
  - Retrieve native and ERC20 token balances.
  - Fetch transactions by hash.
  - Transfer tokens.

### Extensible Tools

- Extend agent functionality with custom user-defined tools.
- Simple decorator-based implementation using `@tool`.

### Persistent Storage

- Use `SQLitePlugin` for local state persistence.
- Seamlessly store and retrieve agent states.

### LangFuse Monitoring

- Integrate with LangFuse for real-time telemetry and interaction monitoring.
- Enable detailed analytics for agent performance and usage.

### Plugin System

- Flexible plugin configuration for tools, storage, personality, and telemetry.
- Easily swap or extend functionality without modifying core logic.

### Custom Instructions

- Tailor agent responses using flexible instructions.
- Combine personality settings for tone, verbosity, and language.

### Easy Initialization

- Initialize with just a few lines of code.
- Include blockchain, LLM, and plugin configurations.

## Installation

Install the package from PyPI:

```bash
pip install cryptocom-agent-client
```

## Usage

### Importing the Library

```python
from cryptocom_agent_client import Agent, tool, SQLitePlugin
```

## Getting Started

### Agent Initialization

To get started, initialize the SDK with your API key. To obtain an API key, create an account and a project at: [https://developer.crypto.com](https://developer.crypto.com)

```python
from cryptocom_agent_client import Agent, tool

@tool
def get_weather(location: str) -> str:
    return f"The weather in {location} is sunny."

agent = Agent.init(
    llm_config={
        "provider": "OpenAI",
        "model": "gpt-4",
        "provider-api-key": "OPENAI_API_KEY",
    },
    blockchain_config={
        "api-key": "SDK_API_KEY",
        "explorer-api-key": "EXPLORER_API_KEY",
        "private-key": "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": SQLitePlugin(db_path="agent_state.db"),
        "langfuse": {
            "public-key": "user-public-key",
            "secret-key": "user-secret-key",
            "host": "https://langfuse.example.com",
        },
    },
)

response = agent.interact("What's the weather in Berlin?")
print(response)
```

## Using Llama 4 with Groq Provider

```python
agent = Agent.init(
    llm_config={
        "provider": "Groq",
        "model": "meta-llama/llama-4-scout-17b-16e-instruct",
        "provider-api-key": "GROQ_API_KEY",
        "temperature": 0.7,
    },
    blockchain_config={
        "api-key": "DEVELOPER_SDK_API_KEY",
    },
    plugins={
        "personality": {
            "tone": "friendly",
            "language": "English",
            "verbosity": "medium",
        },
        "instructions": "You are a helpful blockchain assistant powered by Llama 4."
    },
)

response = agent.interact("How can I create a wallet on Cronos?")
print(response)
```

## Plugins

### Storage Plugin

```python
agent = Agent.init(
    llm_config={...},
    blockchain_config={...},
    plugins={
        "storage": SQLitePlugin(db_path="agent_state.db")
    },
)
```

### LangFuse Plugin

```python
agent = Agent.init(
    llm_config={...},
    blockchain_config={...},
    plugins={
        "langfuse": {
            "public-key": "user-public-key",
            "secret-key": "user-secret-key",
            "host": "https://langfuse.example.com",
        }
    },
)
```

### Personality Plugin

```python
agent = Agent.init(
    llm_config={...},
    blockchain_config={...},
    plugins={
        "personality": {
            "tone": "friendly",
            "language": "English",
            "verbosity": "high",
        },
    },
)
```

## Tools

### Defining Tools

```python
@tool
def get_weather(location: str) -> str:
    return f"The weather in {location} is sunny."

@tool
def greet_user(name: str) -> str:
    return f"Hello, {name}! How can I assist you today?"

@tool
def calculate_sum(a: int, b: int) -> int:
    return a + b
```

### Using Tools

```python
agent = Agent.init(
    llm_config={...},
    blockchain_config={...},
    plugins={
        "tools": [get_weather, greet_user, calculate_sum],
    },
)

response = agent.interact("What's the weather in Berlin?")
print(response)
```

## Blockchain Functions

### Pre-Built Functions

- `create_wallet()`
- `get_native_balance(address: str)`
- `get_erc20_balance(address: str, token: str)`
- `get_transaction_by_hash(tx_hash: str)`
- `transfer_token(from_address: str, to_address: str, amount: int, token: str)`

### Example Usage

```python
agent = Agent.init(...)

response = agent.interact("Create 2 Wallets")
print(response)
```

## Custom Instructions

```python
agent = Agent.init(
    llm_config={...},
    blockchain_config={...},
    plugins={
        "instructions": "Be concise and professional."
    },
)
```

## API

### Agent

- `Agent.init(...)`: Initializes the agent with configuration for LLM, blockchain, and plugins.
- `Agent.interact(input: str)`: Sends input to the agent and returns the response.

### Tool Decorator

- `@tool`: Decorator used to register a function as an agent tool.

## Contributing

We welcome contributions! Please follow the guidelines in the repository.

## License

This project is licensed under the MIT License. See the LICENSE file for details.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cryptocom-agent-client",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.12",
    "maintainer_email": null,
    "keywords": "blockchain, crypto.com, AI, tool, SDK",
    "author": "Ric Arcifa",
    "author_email": "ricardo.arcifa@crypto.com",
    "download_url": null,
    "platform": null,
    "description": "# Crypto.com Agent Client\n\nThe **Crypto.com Agent Client** is a Python library designed to integrate advanced conversational AI capabilities with blockchain functionality. It provides tools, plugins, and utilities to build robust and extensible agent workflows with graphs and Crypto.com blockchain integrations.\n\n## Features\n\n### Conversational AI Integration\n\n- Build conversational agents with state-of-the-art Large Language Models (LLMs) like OpenAI's GPT series, Anthropic's Claude, and Meta's Llama 4.\n- Customize agent behavior using plugins for personality and instructions.\n\n### Blockchain Integration\n\n- Perform blockchain-specific operations with pre-built functions:\n\n  - Create wallets.\n  - Retrieve native and ERC20 token balances.\n  - Fetch transactions by hash.\n  - Transfer tokens.\n\n### Extensible Tools\n\n- Extend agent functionality with custom user-defined tools.\n- Simple decorator-based implementation using `@tool`.\n\n### Persistent Storage\n\n- Use `SQLitePlugin` for local state persistence.\n- Seamlessly store and retrieve agent states.\n\n### LangFuse Monitoring\n\n- Integrate with LangFuse for real-time telemetry and interaction monitoring.\n- Enable detailed analytics for agent performance and usage.\n\n### Plugin System\n\n- Flexible plugin configuration for tools, storage, personality, and telemetry.\n- Easily swap or extend functionality without modifying core logic.\n\n### Custom Instructions\n\n- Tailor agent responses using flexible instructions.\n- Combine personality settings for tone, verbosity, and language.\n\n### Easy Initialization\n\n- Initialize with just a few lines of code.\n- Include blockchain, LLM, and plugin configurations.\n\n## Installation\n\nInstall the package from PyPI:\n\n```bash\npip install cryptocom-agent-client\n```\n\n## Usage\n\n### Importing the Library\n\n```python\nfrom cryptocom_agent_client import Agent, tool, SQLitePlugin\n```\n\n## Getting Started\n\n### Agent Initialization\n\nTo get started, initialize the SDK with your API key. To obtain an API key, create an account and a project at: [https://developer.crypto.com](https://developer.crypto.com)\n\n```python\nfrom cryptocom_agent_client import Agent, tool\n\n@tool\ndef get_weather(location: str) -> str:\n    return f\"The weather in {location} is sunny.\"\n\nagent = Agent.init(\n    llm_config={\n        \"provider\": \"OpenAI\",\n        \"model\": \"gpt-4\",\n        \"provider-api-key\": \"OPENAI_API_KEY\",\n    },\n    blockchain_config={\n        \"api-key\": \"SDK_API_KEY\",\n        \"explorer-api-key\": \"EXPLORER_API_KEY\",\n        \"private-key\": \"PRIVATE_KEY\",\n        \"sso-wallet-url\": \"your-sso-wallet-url\",\n    },\n    plugins={\n        \"personality\": {\n            \"tone\": \"friendly\",\n            \"language\": \"English\",\n            \"verbosity\": \"high\",\n        },\n        \"instructions\": \"You are a humorous assistant that always includes a joke in your responses.\",\n        \"tools\": [get_weather],\n        \"storage\": SQLitePlugin(db_path=\"agent_state.db\"),\n        \"langfuse\": {\n            \"public-key\": \"user-public-key\",\n            \"secret-key\": \"user-secret-key\",\n            \"host\": \"https://langfuse.example.com\",\n        },\n    },\n)\n\nresponse = agent.interact(\"What's the weather in Berlin?\")\nprint(response)\n```\n\n## Using Llama 4 with Groq Provider\n\n```python\nagent = Agent.init(\n    llm_config={\n        \"provider\": \"Groq\",\n        \"model\": \"meta-llama/llama-4-scout-17b-16e-instruct\",\n        \"provider-api-key\": \"GROQ_API_KEY\",\n        \"temperature\": 0.7,\n    },\n    blockchain_config={\n        \"api-key\": \"DEVELOPER_SDK_API_KEY\",\n    },\n    plugins={\n        \"personality\": {\n            \"tone\": \"friendly\",\n            \"language\": \"English\",\n            \"verbosity\": \"medium\",\n        },\n        \"instructions\": \"You are a helpful blockchain assistant powered by Llama 4.\"\n    },\n)\n\nresponse = agent.interact(\"How can I create a wallet on Cronos?\")\nprint(response)\n```\n\n## Plugins\n\n### Storage Plugin\n\n```python\nagent = Agent.init(\n    llm_config={...},\n    blockchain_config={...},\n    plugins={\n        \"storage\": SQLitePlugin(db_path=\"agent_state.db\")\n    },\n)\n```\n\n### LangFuse Plugin\n\n```python\nagent = Agent.init(\n    llm_config={...},\n    blockchain_config={...},\n    plugins={\n        \"langfuse\": {\n            \"public-key\": \"user-public-key\",\n            \"secret-key\": \"user-secret-key\",\n            \"host\": \"https://langfuse.example.com\",\n        }\n    },\n)\n```\n\n### Personality Plugin\n\n```python\nagent = Agent.init(\n    llm_config={...},\n    blockchain_config={...},\n    plugins={\n        \"personality\": {\n            \"tone\": \"friendly\",\n            \"language\": \"English\",\n            \"verbosity\": \"high\",\n        },\n    },\n)\n```\n\n## Tools\n\n### Defining Tools\n\n```python\n@tool\ndef get_weather(location: str) -> str:\n    return f\"The weather in {location} is sunny.\"\n\n@tool\ndef greet_user(name: str) -> str:\n    return f\"Hello, {name}! How can I assist you today?\"\n\n@tool\ndef calculate_sum(a: int, b: int) -> int:\n    return a + b\n```\n\n### Using Tools\n\n```python\nagent = Agent.init(\n    llm_config={...},\n    blockchain_config={...},\n    plugins={\n        \"tools\": [get_weather, greet_user, calculate_sum],\n    },\n)\n\nresponse = agent.interact(\"What's the weather in Berlin?\")\nprint(response)\n```\n\n## Blockchain Functions\n\n### Pre-Built Functions\n\n- `create_wallet()`\n- `get_native_balance(address: str)`\n- `get_erc20_balance(address: str, token: str)`\n- `get_transaction_by_hash(tx_hash: str)`\n- `transfer_token(from_address: str, to_address: str, amount: int, token: str)`\n\n### Example Usage\n\n```python\nagent = Agent.init(...)\n\nresponse = agent.interact(\"Create 2 Wallets\")\nprint(response)\n```\n\n## Custom Instructions\n\n```python\nagent = Agent.init(\n    llm_config={...},\n    blockchain_config={...},\n    plugins={\n        \"instructions\": \"Be concise and professional.\"\n    },\n)\n```\n\n## API\n\n### Agent\n\n- `Agent.init(...)`: Initializes the agent with configuration for LLM, blockchain, and plugins.\n- `Agent.interact(input: str)`: Sends input to the agent and returns the response.\n\n### Tool Decorator\n\n- `@tool`: Decorator used to register a function as an agent tool.\n\n## Contributing\n\nWe welcome contributions! Please follow the guidelines in the repository.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Python client to interact with @cryptocom/agent",
    "version": "1.1.1",
    "project_urls": {
        "Documentation": "https://github.com/crypto-com/agent-client-py#readme",
        "Homepage": "https://github.com/crypto-com/agent-client-py",
        "Repository": "https://github.com/crypto-com/agent-client-py"
    },
    "split_keywords": [
        "blockchain",
        " crypto.com",
        " ai",
        " tool",
        " sdk"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "0cd94a1130b46de0133f8e4c42c44af9335310f989d18b061275d3e95604b148",
                "md5": "bc1453afdf5e9f21a7456052a2c2a7b2",
                "sha256": "253558e91a4bbba6f0bd8af618a6c84bea4682341fe9a711a7635afbf25cf85f"
            },
            "downloads": -1,
            "filename": "cryptocom_agent_client-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "bc1453afdf5e9f21a7456052a2c2a7b2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.12",
            "size": 67417,
            "upload_time": "2025-07-16T19:33:47",
            "upload_time_iso_8601": "2025-07-16T19:33:47.870024Z",
            "url": "https://files.pythonhosted.org/packages/0c/d9/4a1130b46de0133f8e4c42c44af9335310f989d18b061275d3e95604b148/cryptocom_agent_client-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-16 19:33:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "crypto-com",
    "github_project": "agent-client-py#readme",
    "github_not_found": true,
    "lcname": "cryptocom-agent-client"
}
        
Elapsed time: 1.14558s