Skip to content
GitHubDiscord

API Reference

Terminal window
pip install giskard-hub
from giskard_hub import HubClient, AsyncHubClient

Synchronous client. All resource operations are available as attributes.

HubClient(
*,
api_key: str | None = None,
base_url: str | None = None,
auto_add_api_suffix: bool = True,
timeout: float | None = None,
max_retries: int = 2,
default_headers: dict[str, str] | None = None,
default_query: dict[str, object] | None = None,
http_client: httpx.Client | None = None,
)
ParameterDefaultDescription
api_keyGISKARD_HUB_API_KEY env varYour Hub API key
base_urlGISKARD_HUB_BASE_URL env varBase URL of your Hub instance
auto_add_api_suffixTrueAutomatically appends /_api to base_url
timeout60.0Default request timeout in seconds
max_retries2Number of automatic retries on transient errors
default_headersNoneHeaders added to every request
http_clientNoneCustom httpx.Client instance

Async counterpart to HubClient. Identical API surface — all methods are coroutines.

from giskard_hub import AsyncHubClient
import asyncio
async def main():
hub = AsyncHubClient()
projects = await hub.projects.list()
print(projects.data)
asyncio.run(main())

All methods return a pydantic.BaseModel

from giskard_hub.types import *

from giskard_hub.types import Agent, AgentOutput, ChatMessage
MethodReturnsDescription
create(**params)AgentRegister a new agent
retrieve(agent_id)AgentGet an agent by ID
update(agent_id, **params)AgentUpdate agent fields
list(**params)list[Agent]List agents, optionally filtered by project_id
delete(agent_id)NoneDelete an agent
bulk_delete(**params)NoneDelete multiple agents
generate_completion(agent_id, **params)AgentOutputCall the agent with a list of messages
test_connection(**params)AgentOutputTest an agent endpoint without registering
autofill_description(agent_id)strAI-generate a description for the agent

Agent fields: id, name, description, url, project_id, supported_languages, headers, status, created_at, updated_at

AgentOutput fields: response (ChatMessage), metadata (dict)

ChatMessage fields: role ("user" | "assistant" | "system"), content


from giskard_hub.types import Audit, AuditDisplay
MethodReturnsDescription
search(**params)Union[list[Audit], Tuple[list[Audit], APIPaginatedMetadata]]Search audit events with filters
list_entities(entity_id, entity_type, **params)list[AuditDisplay]Audit history for a specific resource

Search params: filters (dict — keys: project_id, entity_type, entity_id, action, user_id, each with {"selected_options": [...]} shape; created_at with {"from": ..., "to": ...} shape), limit, offset


from giskard_hub.types import (
Check,
CorrectnessParams, ConformityParams, GroundednessParams,
StringMatchParams, MetadataParams, SemanticSimilarityParams,
)
MethodReturnsDescription
create(**params)CheckCreate a custom check
retrieve(check_id)CheckGet a check by ID
update(check_id, **params)CheckUpdate check fields
list(**params)list[Check]List checks, optionally filtered by project_id
delete(check_id)NoneDelete a check
bulk_delete(**params)NoneDelete multiple checks

Check fields: id, identifier, name, description, project_id, params


from giskard_hub.types import Dataset, TestCase, TaskProgress
MethodReturnsDescription
create(**params)DatasetCreate a dataset
upload(**params)DatasetImport a dataset from a file
retrieve(dataset_id)DatasetGet a dataset by ID
update(dataset_id, **params)DatasetUpdate dataset fields
list(**params)list[Dataset]List datasets, optionally filtered by project_id
delete(dataset_id)NoneDelete a dataset
bulk_delete(**params)NoneDelete multiple datasets
generate_scenario_based(**params)DatasetGenerate test cases from scenarios
generate_document_based(**params)DatasetGenerate test cases from a knowledge base
list_tags(dataset_id)list[str]List all tags used in a dataset
list_test_cases(dataset_id)list[TestCase]List all test cases in a dataset
search_test_cases(dataset_id, **params)Union[list[TestCase], Tuple[list[TestCase], APIPaginatedMetadata]]Search test cases with filters

Dataset fields: id, name, description, project_id, created_at, updated_at


from giskard_hub.types import Evaluation, Metric, OutputAnnotation
MethodReturnsDescription
create(**params)EvaluationStart a remote evaluation
create_local(**params)EvaluationStart a local (in-process) evaluation
retrieve(evaluation_id, **params)EvaluationGet evaluation by ID, optionally include agent/dataset
update(evaluation_id, **params)EvaluationUpdate evaluation metadata
list(**params)list[Evaluation]List evaluations
delete(evaluation_id)NoneDelete an evaluation
bulk_delete(**params)NoneDelete multiple evaluations
rerun_errored_results(evaluation_id)EvaluationRerun all errored results
run_single(**params)list[Check]Evaluate a single (input, output) pair ad hoc

Evaluation fields: id, name, status (object with .state), agent_id, project_id, run_count, tags, metrics, created_at

create params: project_id, agent_id, criteria (dict with dataset_id), name, tags (filter by test case tags), run_count

create_local params: agent (dict with name, description), criteria (list of dicts with dataset_id), name, tags, run_count

from giskard_hub.types.evaluation import TestCaseEvaluation, TaskState, FailureCategory
MethodReturnsDescription
retrieve(result_id, *, evaluation_id, **params)TestCaseEvaluationGet a single result
update(result_id, *, evaluation_id, **params)TestCaseEvaluationUpdate result (review, comment)
list(evaluation_id, **params)list[TestCaseEvaluation]List results for an evaluation
search(evaluation_id, **params)Union[list[TestCaseEvaluation], Tuple[list[TestCaseEvaluation], APIPaginatedMetadata]]Search/filter results
rerun_test_case(result_id, *, evaluation_id)TestCaseEvaluationRerun a single result
submit_local_output(result_id, *, evaluation_id, **params)TestCaseEvaluationSubmit output for a local evaluation step
update_visibility(result_id, *, evaluation_id, **params)TestCaseEvaluationShow/hide a result

TestCaseEvaluation fields: id, evaluation_id, test_case (nested object with .id), state, results (list of check results with .name and .passed), output, reviewed, visible, created_at


from giskard_hub.types import (
KnowledgeBase,
KnowledgeBaseDocumentRow,
KnowledgeBaseDocumentDetail,
)
MethodReturnsDescription
create(**params)KnowledgeBaseCreate a knowledge base
retrieve(knowledge_base_id)KnowledgeBaseGet a knowledge base by ID
update(knowledge_base_id, **params)KnowledgeBaseUpdate knowledge base metadata
list(**params)list[KnowledgeBase]List knowledge bases by project_id
delete(knowledge_base_id)NoneDelete a knowledge base
bulk_delete(**params)NoneDelete multiple knowledge bases
search_documents(knowledge_base_id, **params)Union[list[KnowledgeBaseDocumentRow], Tuple[list[KnowledgeBaseDocumentRow], APIPaginatedMetadata]]Semantic search over documents
retrieve_document(knowledge_base_id, document_id)KnowledgeBaseDocumentDetailGet a specific document

KnowledgeBase fields: id, name, description, project_id, status, document_count, created_at

create params: project_id, name, description, file (a (filename, bytes) tuple for in-memory data, or a pathlib.Path for a file on disk — JSON/JSONL where each record has text and optional topic)


from giskard_hub.types import Project
MethodReturnsDescription
create(**params)ProjectCreate a project
retrieve(project_id)ProjectGet a project by ID
update(project_id, **params)ProjectUpdate project fields
list()list[Project]List all accessible projects
delete(project_id)NoneDelete a project
bulk_delete(**params)NoneDelete multiple projects

Project fields: id, name, description, created_at, updated_at

from giskard_hub.types import Scenario, ScenarioPreview
MethodReturnsDescription
create(project_id, **params)ScenarioCreate a scenario
retrieve(scenario_id, *, project_id)ScenarioGet a scenario
update(scenario_id, *, project_id, **params)ScenarioUpdate a scenario
list(project_id)list[Scenario]List scenarios for a project
delete(scenario_id, *, project_id)NoneDelete a scenario
preview(project_id, **params)ScenarioPreviewPreview generated questions for a scenario

from giskard_hub.types import ScanResult, ScanCategory, ScanProbeResult
MethodReturnsDescription
create(**params)ScanResultCreate and start a vulnerability scan
retrieve(scan_result_id, **params)ScanResultGet a scan result, optionally including agent/KB
list(**params)list[ScanResult]List scans
delete(scan_result_id)NoneDelete a scan result
bulk_delete(**params)NoneDelete multiple scan results
list_categories()list[ScanCategory]List all available scan categories/tags
list_probes(scan_result_id)list[ScanProbeResult]List probe results for a scan

ScanResult fields: id, status, grade, agent_id, knowledge_base_id, tags, created_at

create params: project_id, agent_id, knowledge_base_id (optional), tags (list of OWASP/Giskard tag strings)

from giskard_hub.types.scan import ScanProbeResult, ScanProbeAttempt
MethodReturnsDescription
retrieve(probe_result_id)ScanProbeResultGet a probe result
list_attempts(probe_result_id)list[ScanProbeAttempt]List all attempts for a probe
from giskard_hub.types.scan import ScanProbeAttempt, ReviewStatus, Severity
MethodReturnsDescription
update(probe_attempt_id, **params)ScanProbeAttemptUpdate review status or severity of an attempt

ReviewStatus values: "pending", "reviewed", "false_positive"

Severity values: "low", "medium", "high", "critical"


from giskard_hub.types import ScheduledEvaluation, FrequencyOption
MethodReturnsDescription
create(**params)ScheduledEvaluationCreate a scheduled evaluation
retrieve(scheduled_evaluation_id, **params)ScheduledEvaluationGet a schedule, optionally with recent runs
update(scheduled_evaluation_id, **params)ScheduledEvaluationUpdate schedule configuration
list(**params)list[ScheduledEvaluation]List schedules
delete(scheduled_evaluation_id)NoneDelete a schedule
bulk_delete(**params)NoneDelete multiple schedules
list_evaluations(scheduled_evaluation_id, **params)list[Evaluation]List past evaluation runs for a schedule

create params: project_id, agent_id, dataset_id, name, frequency ("daily" | "weekly" | "monthly"), time, day_of_week, day_of_month


from giskard_hub.types import Task, TaskStatus, TaskPriority
MethodReturnsDescription
create(**params)TaskCreate a task
retrieve(task_id)TaskGet a task by ID
update(task_id, **params)TaskUpdate task fields
list(**params)list[Task]List tasks, optionally filtered
delete(task_id)NoneDelete a task
bulk_delete(**params)NoneDelete multiple tasks

TaskStatus values: "open", "in_progress", "resolved"

TaskPriority values: "low", "medium", "high", "critical"

Task fields: id, title, description, status, priority, project_id, created_at, updated_at


from giskard_hub.types import TestCase, TestCaseComment, TestCaseCheckConfig, ChatMessageWithMetadata
MethodReturnsDescription
create(**params)TestCaseCreate a test case
retrieve(test_case_id)TestCaseGet a test case by ID
update(test_case_id, **params)TestCaseUpdate a test case
delete(test_case_id)NoneDelete a test case
bulk_delete(**params)NoneDelete multiple test cases
bulk_update(**params)list[TestCase]Update multiple test cases
bulk_move(**params)NoneMove test cases to another dataset

TestCase fields: id, dataset_id, messages, demo_output, checks, tags, created_at

create params: dataset_id, messages (list of {role, content}), demo_output ({role, content}), checks (list of {identifier, params}), tags

MethodReturnsDescription
add(test_case_id, **params)TestCaseCommentAdd a comment to a test case
edit(comment_id, *, test_case_id, **params)TestCaseCommentEdit a comment
delete(comment_id, *, test_case_id)NoneDelete a comment

from giskard_hub.types import PlaygroundChat
MethodReturnsDescription
list(**params)list[PlaygroundChat]List playground chats
retrieve(chat_id, **params)PlaygroundChatGet a chat by ID, optionally include agent
delete(chat_id)NoneDelete a chat
bulk_delete(**params)NoneDelete multiple chats

All error types are importable from the root giskard_hub package:

from giskard_hub import (
APIError,
APIStatusError,
APITimeoutError,
APIConnectionError,
BadRequestError, # 400
AuthenticationError, # 401
PermissionDeniedError, # 403
NotFoundError, # 404
ConflictError, # 409
UnprocessableEntityError, # 422
RateLimitError, # 429
InternalServerError, # 500
)
from giskard_hub import HubClient, NotFoundError, AuthenticationError
hub = HubClient()
try:
agent = hub.agents.retrieve("nonexistent-id").data
except NotFoundError:
print("Agent not found")
except AuthenticationError:
print("Invalid API key")