Base Interface#
Agent Interface#
- class core_genai.interfaces.IAgent(api_key: str, **kwargs)[source]#
Bases:
IFactoryInterface class for all agents.
- classmethod registration_key() str[source]#
It returns the name (reference) for the key used to register, like: return self.__name__
- classmethod create_agent(cls_name: str, api_key: str, **kwargs) Any[source]#
Instantiates and returns an agent by its registered class name.
- abstractmethod async analyze(model: str, prompt: Any, **kwargs) Any[source]#
Given a model and prompt the concrete agent must do the analysis.
- abstractmethod get_text(output: Any) str[source]#
Given a model output, it retrieves the response (text information).
- abstractmethod get_texts(output: Any) List[str][source]#
Given a model output, it retrieves all completion choices/candidates.
- abstractmethod get_cost(output: Any) float[source]#
Returns the estimated cost in USD for the given response.
- abstractmethod get_metadata(output: Any) UsageMetadata[source]#
Given a model output, it retrieves the metadata (metadata, cost, etc.) of request.
Scheduler Interface#
- class core_genai.interfaces.IScheduler[source]#
Bases:
ABCInterface for providers that support batch (scheduled) job execution.
- abstractmethod async schedule_job(requests: List[Any], model: str, **kwargs) Any[source]#
Submits a batch of requests for deferred execution.
- abstractmethod async check_job_status(job_name: str) Any[source]#
Returns the current status of a scheduled job.
- abstractmethod async extract_job_results(job_name: str) ScheduledJobResponse[source]#
Retrieves the results of a completed scheduled job.
Contracts#
- class core_genai.interfaces.UsageMetadata[source]#
Normalized token usage returned by every agent’s get_metadata.
- class core_genai.interfaces.ScheduledJobMetadata[source]#
Normalized response contract for scheduling a batch job across all providers.
- batch_name: NotRequired[str]#
Human-readable batch name. Grok only.
- created_at: NotRequired[datetime]#
Timestamp when the batch job was created.
- class core_genai.interfaces.ScheduledJobResponse[source]#
Normalized response contract for batch job results across all providers.
- results: List[Any] | None#
List of individual request results; None if the job has not completed successfully.
- start_time: NotRequired[datetime | None]#
Job start time. Gemini only.
- end_time: NotRequired[datetime | None]#
Job end time. Gemini only.
- usage: NotRequired[UsageMetadata | None]#
Aggregated token usage and cost across all succeeded requests. None if the job has not reached a terminal state or all requests failed.