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
| Parameter | Type | Description |
|---|---|---|
name | str | Agent name |
instructions | str | Behavior instructions |
model | str | Model to use (e.g. gpt-5.2, anthropic/claude-sonnet-4-20250514) |
temperature | float | Response creativity (0-1). Optional |
reasoning_effort | str | Reasoning effort (low, medium, high). Only o-series and gpt-5+ |
tools | list | List of tools (result of get_tools()) |
builtin_tools | list[str] | OpenAI built-in tools (web_search, code_interpreter, etc.) |
handoffs | list[Agent] | Agents it can hand off to |
guardrails | list | Safety guardrails |
output_type | type | Structured 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
asyncfunction- 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
| Parameter | Type | Description |
|---|---|---|
*names | str | Names 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.
