Shonku
Build, publish, and run AI agents as PyPI packages.
shonku is a declarative agent framework that wraps agno. Define agents with built-in tools, accept external tools at runtime, and publish them as installable packages.
Install
pip install shonku
Scaffold a new agent project
shonku init my-agent
cd my-agent
pip install -e '.[dev]'
pytest
This creates a ready-to-go project:
my-agent/
src/my_agent/agent.py <- your agent (ShonkuAgent subclass)
tests/test_agent.py <- tests (passing out of the box)
pyproject.toml <- package config (pip installable)
README.md
Edit agent.py, add tools, publish to PyPI. Anyone can then pip install my-agent and run your agent with their own LLM creds.
Quick start
from shonku import ShonkuAgent, tool, LLMConfig
class MyAgent(ShonkuAgent):
name = "my-agent"
instructions = "You are a helpful assistant. Use tools when needed."
required_tools = ["search"] # caller must provide this
@tool(description="Calculate a math expression")
def calculate(self, expression: str) -> str:
return str(eval(expression))
# Caller provides the external tool
def search(query: str) -> str:
return f"Results for: {query}"
# Run with external tools + LLM creds passed at runtime
agent = MyAgent()
result = await agent.run(
input="Search for Python frameworks, then calculate 42 * 17",
llm_config=LLMConfig(provider="groq", model="openai/gpt-oss-120b", api_key="..."),
tools=[ToolSpec(name="search", description="Search the web", callable=search)],
)
print(result.content)
Key concepts
ShonkuAgent-- subclass to define agents with@tool-decorated methods- Tool merging -- agent's own tools + caller-provided tools merge at runtime
- Required tools -- declare what tools callers must provide
LLMConfig-- LLM credentials passed at runtime, never stored in the agent- Only
bridge.pyimports agno -- swap the runtime without touching agent code
Publish agents as PyPI packages
1. Scaffold
shonku init my-weather-agent
cd my-weather-agent
2. Build your agent
# src/my_weather_agent/agent.py
from shonku import ShonkuAgent, tool
class WeatherAgent(ShonkuAgent):
name = "weather-agent"
instructions = "Look up weather using the tools provided."
required_tools = ["get_weather"]
@tool(description="Format temperature")
def format_temp(self, celsius: str) -> str:
return f"{celsius}C / {float(celsius) * 9/5 + 32:.0f}F"
3. Test locally
pip install -e ".[dev]"
pytest
4. Set up GitHub + PyPI
Create a GitHub repo and add your PyPI API token:
- Get a PyPI token: https://pypi.org/manage/account/token/
- Add to GitHub: Repo Settings > Secrets > Actions >
PYPI_API_TOKEN - Create environment: Repo Settings > Environments > create
pypi
shonku init creates .github/workflows/release.yml automatically. It runs tests on every push and publishes to PyPI on tags.
5. Push and publish
git init && git add -A && git commit -m "Initial commit"
git remote add origin git@github.com:you/my-weather-agent.git
git push -u origin main
# Publish to PyPI
git tag v0.1.0 && git push --tags
6. Anyone can now use it
pip install my-weather-agent
from my_weather_agent import WeatherAgent
from shonku import LLMConfig
from shonku.types import ToolSpec
def get_weather(city: str) -> str:
return f"22C, sunny in {city}"
result = await WeatherAgent().run(
input="Weather in Tokyo?",
llm_config=LLMConfig(provider="groq", model="openai/gpt-oss-120b", api_key="..."),
tools=[ToolSpec(name="get_weather", description="Get weather", callable=get_weather)],
)
Configuration
LLM credentials are passed at runtime via LLMConfig, never stored in the agent:
from shonku import LLMConfig
llm_config = LLMConfig(
provider="groq", # or: anthropic, openai, gemini, openrouter
model="openai/gpt-oss-120b", # model ID for the provider
api_key="your-api-key", # API key
)
When used with autoresearch-prompt-manager, these map to environment variables:
| Env var | LLMConfig field | Example |
|---|---|---|
PM_LLM_PROVIDER |
provider |
groq |
PM_LLM_MODEL |
model |
openai/gpt-oss-120b |
PM_LLM_API_KEY |
api_key |
gsk_... |
Supported LLM providers
All providers supported by agno work out of the box:
| Provider | provider= |
Example model |
|---|---|---|
| Anthropic (Claude) | anthropic |
claude-sonnet-4-20250514 |
| OpenAI | openai |
gpt-4o |
| Groq | groq |
openai/gpt-oss-120b |
| Google Gemini | gemini |
gemini-2.0-flash |
| OpenRouter | openrouter |
meta-llama/llama-3.1-70b |
Built on agno
shonku is a thin, opinionated layer on top of agno (the open-source agent framework by Agno). agno provides the production-grade agent runtime, LLM provider integrations, and AgentOS for deploying agents at scale. shonku adds:
- Declarative agent definitions with
@tooldecorators - Runtime tool injection (caller passes tools, agent doesn't hardcode them)
- Required tool validation
shonku initscaffolding for publishable PyPI packages- A single-file bridge (
bridge.py) so agent code never imports agno directly
If you need the full agent runtime directly, use agno: pip install agno
Part of autoresearch-prompt-manager
shonku is the agent framework layer in the autoresearch-prompt-manager stack:
autoresearch-prompt-manager (prompt CRUD, experiments, metrics)
-> autoresearcher-shonku (optimization agents)
-> shonku (this package -- agent framework)
-> agno (runtime -- https://agno.com)
Install via the parent package: pip install autoresearch-prompt-manager[shonku]
Contributing
For humans
- Fork and clone autoresearch-prompt-manager
cd packages/shonku && pip install -e '.[dev]'- Make changes, run
pytest, runruff check src/ - Submit a PR
For agents
Build agents with shonku and publish them as PyPI packages:
shonku init my-agent— scaffold a project- Edit
src/my_agent/agent.py— add@toolmethods, setrequired_tools pip install -e '.[dev]' && pytest— verify- Publish to PyPI — anyone can
pip installand run your agent
Key rules for agent authors:
- Never hardcode LLM creds — always passed via
LLMConfigat runtime - Never hardcode data access — receive tools from the caller
- Declare
required_toolsso callers know what to provide - Keep agent code agno-free — only
bridge.pyimports agno
License
MIT
Metadata
Release files for shonku 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| shonku-0.1.2.tar.gz | 13.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| shonku-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.5 kB
Release files / shonku-0.1.2.tar.gz
| Download URL | shonku-0.1.2.tar.gz |
|---|---|
| Size | 13.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52d484836b6c00f5a01e95ff83fe27e06605ad13aa726a1cfbf9d3d3f0a0a4f7
|
|
BLAKE2b-256 checksum How to use checksums |
f45168a052a0f601763782394ff30fd8276a909b7ab685b3d4321d443c6d6a29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Release files / shonku-0.1.2-py3-none-any.whl
| Download URL | shonku-0.1.2-py3-none-any.whl |
|---|---|
| Size | 15.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1edfe6890227095ae41fd3f9a3f0b8a9581dca03f82c18c34d4600c62badb33b
|
|
BLAKE2b-256 checksum How to use checksums |
30c41028cee101b41fa1eade22ad49d81037b5eea48ff22d48ec04886b6087a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|