Skip to main content

Python SDK for building civic AI tools in East Africa โ€” parliament, budgets, drought, M-Pesa, MCP and A2A

Project description

๐Ÿ› ๏ธ CivicAgentKit โ€” East African Civic AI SDK

The unified Python toolkit for building civic AI tools in East Africa. One install gives you access to Kenya's parliament records, county budgets, NDMA drought data, M-Pesa payments, and both MCP and A2A protocol integrations.

PyPI License: MIT MCP A2A

Install

pip install civic-agent-kit

What's included

from civic_agent_kit import (
    # Data loaders โ€” Kenya's public civic datasets
    KenyaBudgetData,       # Controller of Budget โ€” 47 counties
    KenyaParliamentData,   # MPs, bills, CDF โ€” 13th Parliament
    KenyaSACCOData,        # SASRA SACCO registry
    KenyaDroughtData,      # NDMA drought phases

    # Agents
    BudgetAgent,           # County budget analysis (CrewAI)
    RightsAgent,           # Constitutional rights Q&A (EN/SW)
    DroughtAgent,          # Drought + SMS alert agent

    # Protocols
    KenyaMCPServer,        # MCP server โ€” wraps all Kenya data as MCP tools
    KenyaA2AServer,        # A2A server โ€” Kenya civic skills for agent-to-agent

    # Utils
    KenyaCounties,         # All 47 county codes + names
    KiswahiliTranslator,   # Simple civic term translations ENโ†”SW
)

Quick examples

Load county budget data:

from civic_agent_kit import KenyaBudgetData

budgets = KenyaBudgetData.load()
low_absorption = budgets[budgets['absorption_rate'] < 0.5]
print(low_absorption[['county', 'allocation_kes_m', 'absorption_rate']])

Serve Kenya civic data as an A2A agent:

from civic_agent_kit import KenyaA2AServer

server = KenyaA2AServer(host="http://localhost:8000")
server.run()  # exposes /.well-known/agent.json + JSON-RPC endpoint

Serve as an MCP server:

from civic_agent_kit import KenyaMCPServer

# Run alongside mpesa-mcp for full East African AI stack
server = KenyaMCPServer()
server.run()

Ask a rights question in Kiswahili:

from civic_agent_kit import RightsAgent

agent = RightsAgent(language="sw")
answer = agent.ask("Haki yangu ya ardhi ni nini?")
print(answer)
# โ†’ "Kifungu 40: Kila mtu ana haki ya kupata na kumiliki mali..."

The East African AI Stack

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚         Your AI Agent                โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                  โ”‚
               โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
               โ”‚                                          โ”‚
        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”                          โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
        โ”‚   MCP Layer  โ”‚                          โ”‚  A2A Layer   โ”‚
        โ”‚  (tools)     โ”‚                          โ”‚  (agents)    โ”‚
        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
               โ”‚                                          โ”‚
     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
     โ”‚                    โ”‚                   โ”‚                     โ”‚
โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”     โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚mpesa-mcpโ”‚        โ”‚KenyaMCP    โ”‚     โ”‚kenya-a2a   โ”‚       โ”‚CivicAgent   โ”‚
โ”‚payments โ”‚        โ”‚civic data  โ”‚     โ”‚parliament  โ”‚       โ”‚Kit agents   โ”‚
โ”‚SMS      โ”‚        โ”‚budgets     โ”‚     โ”‚budgets     โ”‚       โ”‚budget/rightsโ”‚
โ”‚airtime  โ”‚        โ”‚parliament  โ”‚     โ”‚drought     โ”‚       โ”‚drought      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚rights EN/SWโ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                      โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Data

All data from the Kenya Civic Datasets (CC BY-SA 4.0):

Related packages

Package Description PyPI
mpesa-mcp M-Pesa + Africa's Talking MCP server PyPI
civic-agent-kit This package PyPI

Full portfolio

13 deployed civic apps: gabrielmahia.github.io

IP & Collaboration

ยฉ 2026 Gabriel Mahia ยท contact@aikungfu.dev License: MIT

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

civic_agent_kit-0.1.0.tar.gz (8.1 kB view details)

Uploaded Source

Built Distribution

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

civic_agent_kit-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file civic_agent_kit-0.1.0.tar.gz.

File metadata

  • Download URL: civic_agent_kit-0.1.0.tar.gz
  • Upload date:
  • Size: 8.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for civic_agent_kit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7bfc5d86866923087b064db09d57ed87ae9e54e08635ca4263e2be1bd78cb2b
MD5 7d12756553ecf1fde0228c7881f746a9
BLAKE2b-256 c5da703ba0c632040cb761782df228eb256ffd18dd1d1985c0e9f3b515ce5e27

See more details on using hashes here.

File details

Details for the file civic_agent_kit-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for civic_agent_kit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 620a15a9fd23786b91ea4d73d190e6c524b8a7601dc16a138cc3577511eeabe9
MD5 a27f416378a71c96c2f1a49498930b2c
BLAKE2b-256 24938b3a4422553af5c24d6c23f8a085fba17ae065d28807c4117dd2c8d1bd7d

See more details on using hashes here.

Supported by

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