A flexible LLM orchestration framework with tool calling capabilities via MCP protocol
Project description
Jiki
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 aDetailedResponsecontaining the final result plus structured tool call data and raw interaction traces usingprocess_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
ConversationRootManagerfor 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"ortools=[{...}]: Provide tool schemas manually for explicit control.
- Varied MCP Transport: Connect to tool servers via
stdio(default, for local scripts) orsse(for servers exposing an HTTP endpoint). Seecustom_transport_example.py. - Detailed Interaction Data:
orchestrator.process(): Returns the final string result.
orchestrator.process_detailed(): Returns aDetailedResponseobject containing.result,.tool_calls(structured list), and.traces(raw logs). Essential for debugging and complex logic. Seedetailed_and_roots_example.py.
- Tracing & Logging: Built-in tracing (
trace=True) captures interactions, exportable viaorchestrator.export_traces()or automatically byrun_ui()and the main CLI. - LLM Sampling Configuration: Pass a
SamplerConfigobject duringJikiinitialization to control temperature, top_p, max_tokens, etc. Seeadvanced_examples.py. - State Management: Implement the
IConversationRootManagerinterface to manage conversation state, enabling snapshot and resume capabilities. Seeadvanced_examples.py. - Direct MCP Client Access: Use
orchestrator.mcp_clientfor lower-level interactions with the tool server (listing resources, direct RPC calls). Seecustom_transport_example.py. - Command-Line Interface:
python -m jiki.cliprovides commands forrun(interactive),process(single query), andtracemanagement. Use--helpfor details.
Contributing
Contributions are welcome! (TODO: Add contributing guide link)
License
Jiki is licensed under the Apache 2.0 License.
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
747dd1e2144cc14d3b0deb31133c632a6930b693c9d193438eaf51f1383b561c
|
|
| MD5 |
53101a2a276808ebc9d45502b0385780
|
|
| BLAKE2b-256 |
69bd37ef3d3bc5d86c8ceacd5f4977311b0a3acf1d6feb12d2b54e726ba544a7
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9aee814852311efd26ba637527bbd093d77f345abb0679e7cb948d75d3061f6
|
|
| MD5 |
11b761a3bbf2cf579839567bc0e57a11
|
|
| BLAKE2b-256 |
6a1d886407ce808b95e180924c87f7f7d82de52b805679a2bc77c11c097e18b7
|