Official Python Module for using entry blocks on kitchen
Project description
Entry on Kitchen Python Library
Official Python module for executing recipes on the Entry on Kitchen API. Supports both synchronous execution and real-time HTTP streaming.
Installation
pip install entry-on-kitchen
Quick Start
from entry_on_kitchen import KitchenClient
# Initialize the client with your auth code
client = KitchenClient(
auth_code="your-auth-code-here",
entry_point="beta" # Optional: use "" for production
)
# Synchronous execution
result = client.sync(
recipe_id="your-recipe-id",
entry_id="your-entry-id",
body={"message": "Hello, Kitchen!"}
)
print(result)
KitchenClient Class
The KitchenClient class provides a simple interface for executing recipes.
Constructor
KitchenClient(auth_code, entry_point="")
Parameters:
auth_code(str, required): Your X-Entry-Auth-Code for authenticationentry_point(str, optional): Entry point environment (e.g., "beta" for beta). Defaults to "" (production)
Raises:
ValueError: Ifauth_codeis not provided or empty
Methods
sync(recipe_id, entry_id, body, use_kitchen_billing=False, llm_override=None, api_key_override=None)
Execute a recipe synchronously and wait for the complete result.
Parameters:
recipe_id(str): The ID of the pipeline/recipeentry_id(str): The ID of the entry blockbody(dict or str): Request body datause_kitchen_billing(bool, optional): Enable Kitchen billingllm_override(str, optional): Override the LLM model (e.g., "gpt-4", "claude-3")api_key_override(dict, optional): Override API keys for external services
Returns: Dictionary containing:
runId: The execution run IDstatus: Execution status ("finished", "error", etc.)result: The execution result (if successful)error: Error message (if failed)exitBlock: Exit block information
Example:
result = client.sync(
recipe_id="recipe-123",
entry_id="entry-456",
body={
"message": "Hello!",
"provider": "google_genai",
"model": "gemini-2.5-flash"
}
)
if result["status"] == "finished":
print("Success:", result["result"])
else:
print("Error:", result["error"])
stream(recipe_id, entry_id, body, use_kitchen_billing=False, llm_override=None, api_key_override=None)
Execute a recipe with real-time streaming. Yields events as they arrive.
Parameters:
recipe_id(str): The ID of the pipeline/recipeentry_id(str): The ID of the entry blockbody(dict or str): Request body datause_kitchen_billing(bool, optional): Enable Kitchen billingllm_override(str, optional): Override the LLM model (e.g., "gpt-4", "claude-3")api_key_override(dict, optional): Override API keys for external services
Yields: Dictionary objects representing stream events with keys:
runId: The execution run IDtype: Event type (see types below)time: Timestamp of the eventdata: Event-specific datasocket: Socket ID (for "result" and "delta" events)statusCode: HTTP status code
Event Types:
"progress": Execution progress updates"result": Output data from blocks"delta": Incremental content updates (for streaming LLM responses)"info": Informational messages"end": Final result (marks completion)
Example:
for event in client.stream(
recipe_id="recipe-123",
entry_id="entry-456",
body={"message": "Hello!"}
):
event_type = event["type"]
if event_type == "progress":
data = event["data"]
print(f"Progress: {data['blockPosition']}/{data['blocksToExitBlock']}")
elif event_type == "result":
socket = event["socket"]
data = event["data"]
print(f"Result from {socket}: {data}")
elif event_type == "delta":
socket = event["socket"]
delta = event["data"]
print(f"Delta update for {socket}: {delta}")
elif event_type == "end":
print("Complete!")
print(f"Final result: {event['data']}")
stream_raw(recipe_id, entry_id, body)
Execute a recipe with streaming, yielding raw JSON strings. Useful for custom parsing.
Example:
for raw_json in client.stream_raw(
recipe_id="recipe-123",
entry_id="entry-456",
body={"message": "Hello!"}
):
print(raw_json)
Complete Examples
Synchronous Execution
from entry_on_kitchen import KitchenClient
client = KitchenClient(auth_code="your-auth-code", entry_point="beta")
result = client.sync(
recipe_id="my-recipe",
entry_id="my-entry",
body={"input": "value"}
)
print(f"Run ID: {result['runId']}")
print(f"Status: {result['status']}")
print(f"Result: {result.get('result')}")
Streaming with Progress Tracking
from entry_on_kitchen import KitchenClient
client = KitchenClient(auth_code="your-auth-code")
result_buffer = {}
for event in client.stream(
recipe_id="my-recipe",
entry_id="my-entry",
body={"input": "value"}
):
if event["type"] == "progress":
# Show progress
block = event["data"]["blockPosition"]
total = event["data"]["blocksToExitBlock"]
print(f"\rProgress: {block}/{total} blocks", end="", flush=True)
elif event["type"] == "result":
# Store results
socket = event["socket"]
result_buffer[socket] = event["data"]
print(f"\nReceived result from {socket}")
elif event["type"] == "end":
print("\nExecution complete!")
print(f"Final result: {event['data']}")
print("\nAll results:", result_buffer)
Streaming LLM Responses
from entry_on_kitchen import KitchenClient
client = KitchenClient(auth_code="your-auth-code")
full_response = ""
for event in client.stream(
recipe_id="llm-recipe",
entry_id="llm-entry",
body={"prompt": "Tell me a story"}
):
if event["type"] == "delta":
# Delta updates contain incremental text
for op in event["data"]:
if op[0] == "i": # Insert operation
position, length, text = op[1], op[2], op[3]
full_response += text
print(text, end="", flush=True)
elif event["type"] == "end":
print("\n\nComplete!")
Environment Configuration
Production
client = KitchenClient(auth_code="your-auth-code", entry_point="")
# Uses: https://entry.on.kitchen
Beta
client = KitchenClient(auth_code="your-auth-code", entry_point="beta")
# Uses: https://beta.entry.on.kitchen
Custom Entry Point
client = KitchenClient(auth_code="your-auth-code", entry_point="custom")
# Uses: https://custom.entry.on.kitchen
Optional Features
Kitchen Billing
Enable Kitchen billing for your recipe execution:
result = client.sync(
recipe_id="recipe-123",
entry_id="entry-456",
body={"message": "Hello!"},
use_kitchen_billing=True
)
LLM Model Override
Override the LLM model used in your recipe:
result = client.sync(
recipe_id="recipe-123",
entry_id="entry-456",
body={"message": "Write a poem"},
llm_override="gpt-4"
)
# Or with streaming
for event in client.stream(
recipe_id="recipe-123",
entry_id="entry-456",
body={"message": "Write a poem"},
llm_override="claude-3"
):
# Handle events
pass
Combining Options
You can use both options together:
result = client.sync(
recipe_id="recipe-123",
entry_id="entry-456",
body={"message": "Hello!"},
use_kitchen_billing=True,
llm_override="gpt-4"
)
Requirements
- Python 3.7 or higher
requestslibrary
Error Handling
from entry_on_kitchen import KitchenClient
import requests
client = KitchenClient(auth_code="your-auth-code")
try:
result = client.sync(
recipe_id="recipe-123",
entry_id="entry-456",
body={"input": "value"}
)
except requests.HTTPError as e:
print(f"HTTP Error: {e}")
except ValueError as e:
print(f"Value Error: {e}")
except Exception as e:
print(f"Unexpected error: {e}")
Migration from v0.x
Version 0.3.0 is a breaking change from v0.x. Here's how to migrate:
Old API (v0.x)
from entry_on_kitchen.Kitchen import EntryBlock
entry = EntryBlock(
pipelineId="recipe-123",
entryBlockId="entry-456",
entryAuthCode="your-auth-code",
entryPoint="beta"
)
# Synchronous
result = entry.runSync(input_data)
# Asynchronous with polling
result = await entry.runAsync(input_data)
New API (v0.3.0)
from entry_on_kitchen import KitchenClient
client = KitchenClient(
auth_code="your-auth-code",
entry_point="beta"
)
# Synchronous
result = client.sync(
recipe_id="recipe-123",
entry_id="entry-456",
body=input_data
)
# Streaming (replaces async/polling)
for event in client.stream(
recipe_id="recipe-123",
entry_id="entry-456",
body=input_data
):
handle_event(event)
License
Copyright © Endevre Technologies
Support
For issues and questions, contact: contact@endevre.com
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 entry_on_kitchen-0.3.2.tar.gz.
File metadata
- Download URL: entry_on_kitchen-0.3.2.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f72185624cc42b50be5ec27be79150993ea53ebb2cd78881816b5e6f553058d6
|
|
| MD5 |
28d78d32f7e6e84915fb9e39c59a70e0
|
|
| BLAKE2b-256 |
a2469f7eb852c420edb11a39e30a733e8a9d61a1137aefe025746e1b4398ea60
|
Provenance
The following attestation bundles were made for entry_on_kitchen-0.3.2.tar.gz:
Publisher:
python-ci-cd.yml on endevre/entry-on-kitchen-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
entry_on_kitchen-0.3.2.tar.gz -
Subject digest:
f72185624cc42b50be5ec27be79150993ea53ebb2cd78881816b5e6f553058d6 - Sigstore transparency entry: 825196539
- Sigstore integration time:
-
Permalink:
endevre/entry-on-kitchen-python@88cbc76e517f39c7f6e17ac0d75c65b2447c81bc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/endevre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-ci-cd.yml@88cbc76e517f39c7f6e17ac0d75c65b2447c81bc -
Trigger Event:
push
-
Statement type:
File details
Details for the file entry_on_kitchen-0.3.2-py3-none-any.whl.
File metadata
- Download URL: entry_on_kitchen-0.3.2-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ce21b4e3584e84a23cb6b341e97c9b5c262c7bc62e0962f096dff14c2717b639
|
|
| MD5 |
a33481f9a280888cbd338de7e3517d04
|
|
| BLAKE2b-256 |
72e3d653f66d45d88f9a2312e961b2bf261ab3b631fe9a4a29b315ff2bfb4f25
|
Provenance
The following attestation bundles were made for entry_on_kitchen-0.3.2-py3-none-any.whl:
Publisher:
python-ci-cd.yml on endevre/entry-on-kitchen-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
entry_on_kitchen-0.3.2-py3-none-any.whl -
Subject digest:
ce21b4e3584e84a23cb6b341e97c9b5c262c7bc62e0962f096dff14c2717b639 - Sigstore transparency entry: 825196575
- Sigstore integration time:
-
Permalink:
endevre/entry-on-kitchen-python@88cbc76e517f39c7f6e17ac0d75c65b2447c81bc -
Branch / Tag:
refs/heads/main - Owner: https://github.com/endevre
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-ci-cd.yml@88cbc76e517f39c7f6e17ac0d75c65b2447c81bc -
Trigger Event:
push
-
Statement type: