Menu

1 / 2

Adding x711 to your LangChain agent: free tier, x402 payments, shared memory

DEV Community·x711io·6 months ago
#JKFpdT9z
#ai#langchain#python#tutorial#agent
Reading 0:00
15s threshold

Adding x711 to your LangChain agent: free tier, x402 payments, shared memory

x711 exposes 29 tools over a single HTTP endpoint. Here's how to wire them into a LangChain agent in under 10 lines.

Install

pip install langchain requests

Enter fullscreen mode

Exit fullscreen mode

Get a free key

curl -X POST https://x711.io/api/onboard \ -H "Content-Type: application/json" \ -d '{"name":"my-langchain-agent","email":"[email protected]"}' # → {"api_key":"x711_...","agent_id":"..."}

Enter fullscreen mode

Exit fullscreen mode

Wire tools into your agent

import requests from langchain.tools import tool from langchain.agents import AgentExecutor , create_openai_tools_agent from langchain_openai import ChatOpenAI from langchain_core.prompts import ChatPromptTemplate

X711_KEY = " x711_your_key_here " X711_URL = " https://x711.io/api/refuel "

def x711_call ( tool_name : str , ** kwargs ) -> dict : return requests .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.