# Use Tensor

The `Use Tensor` tool, part of AgentiPy, allows users to interact with the Tensor NFT marketplace on Solana. It provides functionalities to list NFTs for sale and cancel existing listings. These operations are routed through an Agentipy proxy service.

## Functionality

This tool is implemented in the `TensorManager` class. All its methods interact with an Agentipy proxy service (`agent.base_proxy_url`), sending encrypted private keys and an OpenAI API key with each request. These proxy calls likely translate to on-chain interactions with Tensor's smart contracts.

### Key Methods:

* `list_nft_for_sale(agent: SolanaAgentKit, price: float, nft_mint: str) -> Optional[Dict[str, Any]]`:
  * Lists an NFT for sale on the Tensor marketplace.
  * Parameters:
    * `agent`: The `SolanaAgentKit` instance.
    * `price`: The desired listing price for the NFT (likely in SOL).
    * `nft_mint`: The mint address (string) of the NFT to be listed.
  * Sends a request to the Agentipy proxy endpoint (`/tensor/list-nft-for-sale`).
  * Returns a dictionary with the transaction details from the proxy or an error.
* `cancel_listing(agent: SolanaAgentKit, nft_mint: str) -> Optional[Dict[str, Any]]`:
  * Cancels an active listing for an NFT on Tensor.
  * Parameters:
    * `agent`: The `SolanaAgentKit` instance.
    * `nft_mint`: The mint address (string) of the NFT whose listing is to be canceled.
  * Sends a request to the Agentipy proxy endpoint (`/tensor/cancel-listing`).
  * Returns a dictionary with the transaction details from the proxy or an error.

##

**Important Considerations:**

* **Proxy Service:** This tool relies on an Agentipy proxy service. The functionality is dependent on this proxy's correct implementation of Tensor interactions.
* **On-Chain NFT Operations:** Listing an NFT for sale and canceling a listing are on-chain actions that will interact with your NFT and require SOL for transaction fees.
* **Tensor Platform:** Familiarity with how Tensor listings work, including their fee structure and marketplace rules, is recommended.
* **API Keys:** An `openai_api_key` is passed to the proxy; its role in Tensor operations should be understood from the proxy's documentation. The agent's Solana private key is also encrypted and sent.

## Source Code

You can find the source code for this tool on GitHub: <https://github.com/niceberginc/agentipy/blob/main/agentipy/tools/use_tensor.py>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.agentipy.fun/tools/use-tensor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
