Python SDK for AgentRPC
Project description
AgentRPC Python SDK
A universal RPC layer for AI agents. Connect to any function, any language, any framework, in minutes.
⚠️ The AgentRPC Python SDK does not currently support registering tools.
Installation
pip install agentrpc
Registering Tools
Creating an AgentRPC Client
from agentrpc import AgentRPC
client = AgentRPC(
api_secret="YOUR_API_SECRET"
)
OpenAI Tools
AgentRPC provides integration with OpenAI's function calling capabilities, allowing you to expose your registered RPC functions as tools for OpenAI models to use.
client.openai.get_tools()
The get_tools() method returns your registered AgentRPC functions formatted as OpenAI tools, ready to be passed to OpenAI's API.
# First register your functions with AgentRPC (Locally or on another machine)
# Then get the tools formatted for OpenAI
tools = client.openai.get_tools()
# Pass these tools to OpenAI
chat_completion = openai.chat.completions.create(
model="gpt-4-1106-preview",
messages=messages,
tools=tools,
tool_choice="auto"
)
client.openai.execute_tool(tool_call)
The execute_tool() method executes an OpenAI tool call against your registered AgentRPC functions.
# Process tool calls from OpenAI's response
if chat_completion.choices[0].tool_calls:
for tool_call in response_message.tool_calls:
client.openai.execute_tool(tool_call)
API
AgentRPC(options?)
Creates a new AgentRPC client.
Options:
| Option | Type | Default | Description |
|---|---|---|---|
api_secret |
str | Required | The API secret key. |
endpoint |
str | https://api.agentrpc.com |
Custom API endpoint. |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agentrpc-0.0.5.tar.gz.
File metadata
- Download URL: agentrpc-0.0.5.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bde7ac4c5eb0f34ffe25fb80185b2dd558fadf3930fae96086d15f2f07a4b09d
|
|
| MD5 |
3be38f3c41e324ef53f43f37253d1f86
|
|
| BLAKE2b-256 |
b4078b920a33a2f9a4116b62faa5bcf1823625ab5da459801a3451ab7d1395e7
|
File details
Details for the file agentrpc-0.0.5-py3-none-any.whl.
File metadata
- Download URL: agentrpc-0.0.5-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
37e1b2bdbdd6f4296eac93dcb10b92d7b4805a95bbbba06b061c6ff8f4b2df9e
|
|
| MD5 |
2117af1a405c9f6d0233e1822bdfe15a
|
|
| BLAKE2b-256 |
0c2cb3ac8003a79829919566f58e4e14282a64af670660487dc6fb262b868077
|