LinkGrid Agent - Python client for BitNet API
Project description
🌐✨ LinkGrid Agent — Conversational AI SDK
A modern, lightweight Python client for BitNet's conversational AI.
Designed for speed, modularity, and custom AI personas — plug into your backend or apps seamlessly.
⚡️ Key Features
- 💬 Natural language chat API with async support
- 🧠 Define unique AI personas with custom system prompts
- 🎯 Fine-grained control over temperature, token limits, and creativity
- 🧵 Persistent conversation state (threaded dialog)
- 🔄 Supports parallel conversations with isolated agents
- 🧩 Minimal setup with powerful config-based architecture
📦 Installation
pip install linkgrid-agent
🚀 Get Started
🔹 One-Line Chat
from linkgrid_agent import chat
async def main():
response = await chat("What's the capital of France?")
print(f"🤖 {response}")
import asyncio
asyncio.run(main())
✅ Output:
🤖 The capital of France is Paris.
🎭 Custom AI Persona
from linkgrid_agent import LinkGridAgent
async def main():
config = LinkGridAgent.Config()
config.system_prompt = "You are a pirate captain. Answer like a pirate!"
config.temperature = 0.9
async with LinkGridAgent(config) as agent:
response = await agent.chat("Where can I find treasure?")
print(f"🏴☠️ {response}")
import asyncio
asyncio.run(main())
🦜 Output:
🏴☠️ Arr matey! Seek the treasure on Skull Island, where X marks the spot!
🔬 Advanced Use Cases
🧑🔬 Multi-Persona AI Agents
from linkgrid_agent import LinkGridAgent
async def main():
poet_cfg = LinkGridAgent.Config()
poet_cfg.system_prompt = "You are a romantic poet"
poet_cfg.max_tokens = 200
scientist_cfg = LinkGridAgent.Config()
scientist_cfg.system_prompt = "You are a quantum physicist"
scientist_cfg.temperature = 0.3
async with LinkGridAgent(poet_cfg) as poet, LinkGridAgent(scientist_cfg) as scientist:
poem = await poet.chat("Write a poem about the stars")
expl = await scientist.chat("Explain quantum entanglement")
print(f"📜 Poet:\n{poem}\n")
print(f"🔬 Scientist:\n{expl}")
import asyncio
asyncio.run(main())
🗂️ Stateful Conversation Threads
from linkgrid_agent import LinkGridAgent
async def main():
config = LinkGridAgent.Config()
config.system_prompt = "You're a helpful travel assistant"
async with LinkGridAgent(config) as agent:
await agent.chat("I'm planning a trip to Japan")
tokyo = await agent.chat("What should I see in Tokyo?")
traditions = await agent.chat("How about traditional experiences?")
print(f"🗼 Tokyo Tips: {tokyo}")
print(f"🎎 Traditions: {traditions}")
import asyncio
asyncio.run(main())
⚙️ Configuration
Customize your agent behavior using simple parameters.
| Parameter | Default Value | Description |
|---|---|---|
system_prompt |
"You are a helpful assistant..." |
Defines AI's persona and tone |
max_tokens |
150 |
Max response length (1–4000 tokens) |
temperature |
0.7 |
Creativity scale: 0 = precise, 1 = creative |
api_url |
"https://bitnet-demo.azurewebsites.net/completion" |
BitNet API endpoint |
🔧 Example Setup:
config = LinkGridAgent.Config()
config.system_prompt = "You're a 19th century British detective"
config.max_tokens = 250
config.temperature = 0.5
🛡️ Error Handling
Gracefully manage edge cases and errors:
from linkgrid_agent import chat
try:
response = await chat("Define machine learning")
except ConnectionError as e:
print(f"🌐 Network issue: {e}")
except RuntimeError as e:
print(f"🤖 API error: {e}")
Exceptions
ConnectionError: API unreachable or timeoutRuntimeError: BitNet returned an error response
📋 Requirements
- Python 3.7+
httpx– Async HTTP client
📄 License
Released under the MIT License.
Feel free to fork, improve, and share!
🤝 Contribution
PRs are welcome. Please make sure to follow the existing code style.
Open issues to report bugs or request features.
💡 Inspiration
"The future is already here — it's just not evenly distributed."
— William Gibson
Project details
Release history Release notifications | RSS feed
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 linkgrid_agent-0.1.3.tar.gz.
File metadata
- Download URL: linkgrid_agent-0.1.3.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b0d8815a13318ea4d2c7e696a3705c58e94d5b0d424b58e30b57e739cc8b5e5
|
|
| MD5 |
deb1cb9824f271de4be9eedb2d5bed73
|
|
| BLAKE2b-256 |
64ee87c613feb2c1494e5414ef45fb601f5406068a626f7df63a60dadddd447c
|
Provenance
The following attestation bundles were made for linkgrid_agent-0.1.3.tar.gz:
Publisher:
publish.yml on OfficialDeepSaha/linkgrid-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
linkgrid_agent-0.1.3.tar.gz -
Subject digest:
7b0d8815a13318ea4d2c7e696a3705c58e94d5b0d424b58e30b57e739cc8b5e5 - Sigstore transparency entry: 283984155
- Sigstore integration time:
-
Permalink:
OfficialDeepSaha/linkgrid-agent@40d501d652a43b373d82866d0f4d5853e35b6750 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/OfficialDeepSaha
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40d501d652a43b373d82866d0f4d5853e35b6750 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file linkgrid_agent-0.1.3-py3-none-any.whl.
File metadata
- Download URL: linkgrid_agent-0.1.3-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef156549256d35f46dbe240d25c0f39060b9a60791273b7b2adc59a8036b1f31
|
|
| MD5 |
a8444c5846136dbbb9db1409d55a21ee
|
|
| BLAKE2b-256 |
6c220c4b8b37fcef9e427e6dc9985563cba43572367ec0c82fcf0909252e7b0a
|
Provenance
The following attestation bundles were made for linkgrid_agent-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on OfficialDeepSaha/linkgrid-agent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
linkgrid_agent-0.1.3-py3-none-any.whl -
Subject digest:
ef156549256d35f46dbe240d25c0f39060b9a60791273b7b2adc59a8036b1f31 - Sigstore transparency entry: 283984204
- Sigstore integration time:
-
Permalink:
OfficialDeepSaha/linkgrid-agent@40d501d652a43b373d82866d0f4d5853e35b6750 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/OfficialDeepSaha
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@40d501d652a43b373d82866d0f4d5853e35b6750 -
Trigger Event:
workflow_dispatch
-
Statement type: