PostgresAgent
What it is
A thin wrapper around IntentAgent that builds a PostgreSQL-focused assistant with Postgres integration tools and a small set of predefined tool-backed intents (query, schema, tables).
Public API
-
create_agent(agent_shared_state: Optional[AgentSharedState] = None, agent_configuration: Optional[AgentConfiguration] = None) -> Optional[IntentAgent]- Factory that:
- Loads the chat model (
gpt_4_1_minimodel import). - Applies a default
AgentConfigurationusingSYSTEM_PROMPTif none is provided. - Applies a default
AgentSharedState(thread_id="0")if none is provided. - Builds Postgres integration tools via
PostgresIntegrationConfiguration+as_tools(...). - Registers tool intents:
postgres_query(“Execute a SQL query”)postgres_schema(“Show database schema”)postgres_tables(“List tables”)
- Returns an instance of
PostgresAgent.
- Loads the chat model (
- Factory that:
-
class PostgresAgent(IntentAgent)- No additional behavior beyond
IntentAgent(empty subclass).
- No additional behavior beyond
Configuration/Dependencies
- Depends on Naas ABI core agent framework:
AgentConfiguration,AgentSharedState,Intent,IntentAgent,IntentType
- Depends on marketplace Postgres application/integration:
naas_abi_marketplace.applications.postgres.ABIModulePostgresIntegrationConfiguration,as_tools
- Uses Postgres configuration from
ABIModule.get_instance().configuration:postgres_hostpostgres_port(cast toint)postgres_dbnamepostgres_userpostgres_password
Usage
from naas_abi_marketplace.applications.postgres.agents.PostgresAgent import create_agent
agent = create_agent()
# agent is an IntentAgent configured with postgres tools and intents
Caveats
- The agent always attempts to create Postgres integration tools using
ABIModuleconfiguration; missing/invalid Postgres settings will likely prevent successful tool setup. - The
PostgresAgentclass itself adds no methods; behavior is inherited fromIntentAgent.