Skip to main content

A flexible LLM orchestration framework with tool calling capabilities via MCP protocol

Project description

Jiki

Jiki Logo

Overview

Jiki is a flexible LLM orchestration framework designed for building applications that leverage tool calling via the Multi-Capability Protocol (MCP). It integrates seamlessly with LiteLLM for broad LLM provider support and FastMCP for robust tool server communication.

Jiki aims to be easy to start with for simple use cases while providing the depth needed for complex, customized applications.

Quick Start

Get started quickly with Jiki's interactive CLI or by integrating it into your Python application.

Installation: (using uv recommended)

# Using uv
uv pip install jiki

Environment Setup: Export your LLM provider API key (default is Anthropic):

export ANTHROPIC_API_KEY=<your_api_key>
# Or OPENAI_API_KEY, etc., depending on the model used

Run Interactive CLI: The simplest way to start is using the built-in CLI with automatic tool discovery (requires a compatible MCP server, like the example servers/calculator_server.py).

python -m jiki.cli run --auto-discover --mcp-script-path servers/calculator_server.py

Exit with Ctrl-D, Ctrl-C, or exit.

Programmatic Usage (Simple):

from jiki import Jiki

# Create an orchestrator using auto-discovery
# Assumes servers/calculator_server.py is accessible
orchestrator = Jiki(
    auto_discover_tools=True,
    mcp_mode="stdio",
    mcp_script_path="servers/calculator_server.py"
)

# Get a simple response
result = orchestrator.process("What is 2 + 2?")
print(result) # Output: 4

# Or run the interactive CLI programmatically
# orchestrator.run_ui()

Examples

Explore the examples/ directory to see Jiki's capabilities in action:

  • simple_multiturn_cli.py: Demonstrates launching the interactive CLI programmatically with just a few lines, relying on automatic tool discovery for immediate use.
  • custom_transport_example.py: Shows how to connect to a tool server using a different protocol (SSE over HTTP), interact directly with the MCP client to list resources, and execute tool calls (RPC) without involving the LLM.
  • detailed_and_roots_example.py: Illustrates retrieving a DetailedResponse containing the final result plus structured tool call data and raw interaction traces using process_detailed(). Also shows interaction with MCP "roots".
  • advanced_examples.py: Highlights several advanced techniques:
    • Loading tool definitions manually from a JSON file instead of auto-discovery.
    • Customizing LLM generation parameters (like temperature, max tokens) using SamplerConfig.
    • Implementing persistent conversation state using a ConversationRootManager for snapshot and resume functionality across sessions.

Run these examples (uv recommended):

uv run examples/simple_multiturn_cli.py
uv run examples/custom_transport_example.py
uv run examples/detailed_and_roots_example.py
uv run examples/advanced_examples.py

Key Capabilities

Jiki offers a range of features, progressing from simple defaults to fine-grained control:

  • Multiple LLM Backends: Leverages LiteLLM for compatibility with OpenAI, Anthropic, Gemini, Mistral, Cohere, Azure, Bedrock, and more.
  • Flexible Tool Integration:
    • auto_discover_tools=True: Simple start by automatically fetching tool schemas from an MCP server.
    • tools="path/to/tools.json" or tools=[{...}]: Provide tool schemas manually for explicit control.
  • Varied MCP Transport: Connect to tool servers via stdio (default, for local scripts) or sse (for servers exposing an HTTP endpoint). See custom_transport_example.py.
  • Detailed Interaction Data:
    • orchestrator.process(): Returns the final string result.
    • orchestrator.process_detailed(): Returns a DetailedResponse object containing .result, .tool_calls (structured list), and .traces (raw logs). Essential for debugging and complex logic. See detailed_and_roots_example.py.
  • Tracing & Logging: Built-in tracing (trace=True) captures interactions, exportable via orchestrator.export_traces() or automatically by run_ui() and the main CLI.
  • LLM Sampling Configuration: Pass a SamplerConfig object during Jiki initialization to control temperature, top_p, max_tokens, etc. See advanced_examples.py.
  • State Management: Implement the IConversationRootManager interface to manage conversation state, enabling snapshot and resume capabilities. See advanced_examples.py.
  • Direct MCP Client Access: Use orchestrator.mcp_client for lower-level interactions with the tool server (listing resources, direct RPC calls). See custom_transport_example.py.
  • Command-Line Interface: python -m jiki.cli provides commands for run (interactive), process (single query), and trace management. Use --help for details.

Contributing

Contributions are welcome! (TODO: Add contributing guide link)

License

Jiki is licensed under the Apache 2.0 License.

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

jiki-0.1.0.tar.gz (37.6 kB view details)

Uploaded Source

Built Distribution

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

jiki-0.1.0-py3-none-any.whl (44.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: jiki-0.1.0.tar.gz
  • Upload date:
  • Size: 37.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for jiki-0.1.0.tar.gz
Algorithm Hash digest
SHA256 747dd1e2144cc14d3b0deb31133c632a6930b693c9d193438eaf51f1383b561c
MD5 53101a2a276808ebc9d45502b0385780
BLAKE2b-256 69bd37ef3d3bc5d86c8ceacd5f4977311b0a3acf1d6feb12d2b54e726ba544a7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: jiki-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 44.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for jiki-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b9aee814852311efd26ba637527bbd093d77f345abb0679e7cb948d75d3061f6
MD5 11b761a3bbf2cf579839567bc0e57a11
BLAKE2b-256 6a1d886407ce808b95e180924c87f7f7d82de52b805679a2bc77c11c097e18b7

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