Skip to content

Python API

Reference for Klisk's main Python API functions.

define_agent

Defines an AI agent with its instructions, model, and tools.

python
from klisk import define_agent

agent = define_agent(
    name="MyAgent",
    instructions="Agent instructions.",
    model="gpt-5.2",
    temperature=0.7,
    tools=get_tools("tool1", "tool2"),
)

Parameters

ParameterTypeDescription
namestrAgent name
instructionsstrBehavior instructions
modelstrModel to use (e.g. gpt-5.2, anthropic/claude-sonnet-4-20250514)
temperaturefloatResponse creativity (0-1). Optional
reasoning_effortstrReasoning effort (low, medium, high). Only o-series and gpt-5+
toolslistList of tools (result of get_tools())
builtin_toolslist[str]OpenAI built-in tools (web_search, code_interpreter, etc.)
handoffslist[Agent]Agents it can hand off to
guardrailslistSafety guardrails
output_typetypeStructured output type

Return value

Returns an Agent object from the OpenAI Agents SDK, directly usable with Runner.run().

WARNING

temperature and reasoning_effort must be direct parameters of define_agent(). Do not place them inside model_settings.

@tool

Decorator to define a tool.

python
from klisk import tool

@tool
async def my_tool(param: str) -> str:
    """Description of what it does."""
    return "result"

Requirements

  • async function
  • Docstring required
  • Type hints on all parameters
  • Returns str

get_tools

Retrieves tools by name to pass them to an agent.

python
from klisk import get_tools

tools = get_tools("tool1", "tool2")

Parameters

ParameterTypeDescription
*namesstrNames of the tools to retrieve

Tools are automatically discovered from the project's .py files. The name corresponds to the function name decorated with @tool.

Klisk Documentation