Skip to main content

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.py imports 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:

  1. Get a PyPI token: https://pypi.org/manage/account/token/
  2. Add to GitHub: Repo Settings > Secrets > Actions > PYPI_API_TOKEN
  3. 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 @tool decorators
  • Runtime tool injection (caller passes tools, agent doesn't hardcode them)
  • Required tool validation
  • shonku init scaffolding 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

  1. Fork and clone autoresearch-prompt-manager
  2. cd packages/shonku && pip install -e '.[dev]'
  3. Make changes, run pytest, run ruff check src/
  4. Submit a PR

For agents

Build agents with shonku and publish them as PyPI packages:

  1. shonku init my-agent — scaffold a project
  2. Edit src/my_agent/agent.py — add @tool methods, set required_tools
  3. pip install -e '.[dev]' && pytest — verify
  4. Publish to PyPI — anyone can pip install and run your agent

Key rules for agent authors:

  • Never hardcode LLM creds — always passed via LLMConfig at runtime
  • Never hardcode data access — receive tools from the caller
  • Declare required_tools so callers know what to provide
  • Keep agent code agno-free — only bridge.py imports agno

License

MIT

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

shonku-0.1.2.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

shonku-0.1.2-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file shonku-0.1.2.tar.gz.

File metadata

  • Download URL: shonku-0.1.2.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for shonku-0.1.2.tar.gz
Algorithm Hash digest
SHA256 52d484836b6c00f5a01e95ff83fe27e06605ad13aa726a1cfbf9d3d3f0a0a4f7
MD5 fbc2ac13dbb8943224dd9c4a0e140084
BLAKE2b-256 f45168a052a0f601763782394ff30fd8276a909b7ab685b3d4321d443c6d6a29

See more details on using hashes here.

File details

Details for the file shonku-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: shonku-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for shonku-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1edfe6890227095ae41fd3f9a3f0b8a9581dca03f82c18c34d4600c62badb33b
MD5 43f57d206f284d8da1ee6689a422c0ab
BLAKE2b-256 30c41028cee101b41fa1eade22ad49d81037b5eea48ff22d48ec04886b6087a9

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page