Table of contents
Official Content
  • This documentation is valid for:

The Python SDK - PyGEAI provides a Python-native experience to interact with The Lab.

It allows you to to define Agents, Tools, Reasoning Strategies, and Agentic Processes through the PyGEAI SDK’s The Lab module.

PyGEAI SDK’s The Lab module offers a Command Line Interface, High-Level Interface and Low-Level Interface that facilitates interaction with The Lab.

These are designed to integrate seamlessly into development workflows with structured, object-oriented access or flexible JSON-based interactions, as explained below.

Command Line

The Command Line tool facilitates interaction with Agents, Tools, Reasoning Strategies, Agentic Processes and Tasks. It also enables you to start process instances, monitor their progress, retrieve instance details, access execution history, send signals to influence workflow, or abort instances as needed.

High-Level Interface: AILabManager

The AILabManager class serves as the primary High-Level Interface, offering a Pythonic, object-oriented approach to managing The Lab.

It abstracts the underlying API complexity, mapping responses to structured Python objects such as Agents, Tools, Reasoning Strategy, Agentic Processes, Tasks, and Process Instances.

  • Agent Management: Create, update, retrieve, list, publish, share, or delete agents using methods like: create_agent, update_agent, get_agent, and delete_agent. Agents are represented as Agent objects, encapsulating properties like name, prompts, and LLM configurations.
  • Tool Management: Define and manage Tools with methods such as create_tool, update_tool, get_tool, list_tools, publish_tool_revision, and delete_tool. Tools are modeled as Tool objects, supporting API-based or custom configurations with parameters (ToolParameter).
  • Reasoning Strategies: Configure Agent Reasoning Strategy with create_reasoning_strategy, update_reasoning_strategy, get_reasoning_strategy, and list_reasoning_strategies. Strategies are represented as ReasoningStrategy objects, defining system prompts and access scopes.
  • Agentic Process: Manage workflows through create_process, update_process, get_process, list_processes, publish_process_revision, and delete_process. Agentic Processes are encapsulated as AgenticProcess objects, detailing activities, signals, and sequence flows.
  • Task Management: Create and manage Tasks with create_task, update_task, get_task, list_tasks, publish_task_revision, and delete_task. Tasks are modeled as Task Objects, specifying prompts and artifact types.
  • Runtime Control: Start, monitor, and control process instances using start_instance, get_instance, list_process_instances, get_instance_history, send_user_signal, and abort_instance. Instances are represented as ProcessInstance objects, with execution details and thread information accessible via get_thread_information.

The AILabManager is initialized with a GEAI_API_KEY, GEAI_API_BASE_URL, and optional alias, providing a unified entry point for all The Lab operations.

Its methods handle error mapping (ErrorListResponse) and response validation, making it ideal for rapid development and integration into larger applications.

Low-Level Interface: Client Classes

If you require fine-grained control or prefer to work directly with JSON responses, the SDK includes Low-Level Client Classes: AgentClient, ToolClient, ReasoningStrategyClient, and AgenticProcessClient. These Clients Classes interact with The Lab’s APIs without mapping responses to Python objects, returning raw JSON or text for maximum flexibility.

  • AgentClient: Supports operations like create_agent, update_agent, get_agent, list_agents, publish_agent_revision, create_sharing_link, and delete_agent. It handles agent-specific API endpoints, passing parameters like project ID, agent name, prompts, and LLM configurations as dictionaries.
  • ToolClient: Provides methods such as create_tool, update_tool, get_tool, list_tools, publish_tool_revision, get_parameter, set_parameter, and delete_tool. It manages tool configurations, including OpenAPI specifications and parameter lists, with validation for scopes and access levels.
  • ReasoningStrategyClient: Includes create_reasoning_strategy, update_reasoning_strategy, get_reasoning_strategy, and list_reasoning_strategies, allowing direct manipulation of strategy definitions like system prompts and localized descriptions.
  • AgenticProcessClient: Offers comprehensive Agentic Processes and Tasks management with methods like create_process, update_process, get_process, list_processes, publish_process_revision, delete_process, create_task, update_task, get_task, list_tasks, publish_task_revision, delete_task, start_instance, get_instance, list_process_instances, get_instance_history, get_thread_information, send_user_signal, and abort_instance. It handles complex process structures and runtime operations in JSON format.

Each client is initialized with a GEAI_API_KEY and GEAI_API_BASE_URL, using a BaseClient for HTTP requests.

They provide direct access to The Lab’s endpoints, enabling custom parsing or integration with external systems where object mapping is unnecessary.

Integration and Flexibility

Both the AILabManager (High-Level Interface) and Client Classes (Low-Level Interface) are installable via pip install pygeai and support cross-platform development.

The AILabManager is suited for structured applications requiring type safety and ease of use, while the Clients Classes cater to scenarios demanding raw API responses or custom workflows.

You can combine these interfaces within the same project, leveraging AILabManager for rapid prototyping and Client Classes for specialized Tasks.

Availability

Since version 2025-07.

Last update: December 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant