Skip to content

Conversation

@BhavaniKondra
Copy link

Description

Adds test coverage for Agent synchronous APIs including positive and negative scenarios, and validates behavior for error cases and edge conditions. This improves coverage of agent tool APIs.

No existing issues are fixed directly; this is a test coverage improvement.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tests were executed locally against the existing test framework and verified by running the full test suite.

  • Agent sync API tests
  • Negative and edge case scenarios

Test Configuration:

  • Firmware version: N/A
  • Hardware: N/A
  • Toolchain: Python
  • SDK: python-select-ai

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@oracle-contributor-agreement
Copy link

Thank you for your pull request and welcome to our community! To contribute, please sign the Oracle Contributor Agreement (OCA).
The following contributors of this PR have not signed the OCA:

To sign the OCA, please create an Oracle account and sign the OCA in Oracle's Contributor Agreement Application.

When signing the OCA, please provide your GitHub username. After signing the OCA and getting an OCA approval from Oracle, this PR will be automatically updated.

If you are an Oracle employee, please make sure that you are a member of the main Oracle GitHub organization, and your membership in this organization is public.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Jan 13, 2026
@BhavaniKondra BhavaniKondra changed the title Add agent sync API tests and related updates Testcases on Sync Agent API's Jan 13, 2026
region="us-chicago-1",
oci_apiformat="GENERIC",
oci_compartment_id=oci_compartment_id,
model="meta.llama-4-maverick-17b-128e-instruct-fp8",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we pass region, model using environment variables ?

END;
"""
with select_ai.cursor() as cur:
cur.execute(ddl)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A log can be added to confirm creation of PL SQL function.


def test_3000_sql_tool_created(sql_tool):
logger.info("Validating SQL tool creation")
assert sql_tool.tool_name == SQL_TOOL_NAME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar log can be added to log the tool name and profile name.


def test_3001_rag_tool_created(rag_tool):
logger.info("Validating RAG tool creation")
assert rag_tool.tool_name == RAG_TOOL_NAME
Copy link
Member

@Pushpendra-Garg Pushpendra-Garg Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar log can be added to log the tool name and profile name.


def test_3002_plsql_tool_created(plsql_tool):
logger.info("Validating PL/SQL tool creation")
assert plsql_tool.tool_name == PLSQL_TOOL_NAME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar log can be added to log the tool name and function name.



def test_3006_enable_disable_sql_tool(sql_tool):
logger.info("Disabling SQL tool")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to confirm if tool is enabled/disabled ?

Copy link

@AKSHAY-058 AKSHAY-058 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please list all the bugs filed with this effort
Changes look good

assert task_a.task_name == TASK_A_NAME
assert task_a.description == "Primary analysis task"
assert task_a.attributes.enable_human_tool is False
assert task_a.attributes.tools == ["MOVIE_SQL_TOOL"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to log task object attributes.


def test_3102_fetch_task(task_a):
logger.info("Fetching TASK_A")
fetched = Task.fetch(TASK_A_NAME)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log fetched task ?

def test_3103_list_tasks_with_regex():
logger.info("Listing tasks with regex")
tasks = list(Task.list(f"{BASE}.*"))
names = [t.task_name for t in tasks]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

List all the names. Please log in sorted order to get consistent output every time.


def test_3104_disable_enable_task(task_b):
logger.info("Disabling TASK_B")
task_b.disable()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to verify this ?

logger.info("Creating and deleting disabled task")
attrs = TaskAttributes(instruction="Temporary task", tools=None)
task = Task(task_name=task_name, description="Temp task", attributes=attrs)
task.create()
Copy link
Member

@Pushpendra-Garg Pushpendra-Garg Jan 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log task here for debugging purpose ?

logger.info("Deleting initially disabled task")
attrs = TaskAttributes(instruction="Initially disabled task", tools=None)
task = Task(task_name=task_name, attributes=attrs)
task.create(enabled=False)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log the task details ?

logger.info("Verifying agent identity")
assert agent.agent_name == PYSAI_AGENT_NAME
assert agent.description == PYSAI_AGENT_DESC
assert agent.attributes == agent_attributes
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add log for agent attributes.


def test_3202_fetch(agent_attributes):
logger.info("Fetching agent: %s", PYSAI_AGENT_NAME)
a = Agent.fetch(PYSAI_AGENT_NAME)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log fetched agent ?


def test_3204_disable_enable(agent):
logger.info("Disabling agent")
agent.disable()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify this ?

a.create()

logger.info("Delete agent: %s", name)
a.delete(force=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify if agent is removed.


logger.info("Recreate agent: %s", name)
a.create(replace=False)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verify if agent is created


# As per your Teams learning: force=True allows idempotent delete
logger.info("Second delete with force=True should succeed")
a.delete(force=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second delete with force = False

It should raise an exception, please check

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It won't raise as force=True.


def test_3300_create_and_identity(team, team_attributes):
log_step("Validating team identity and attributes")
assert team.team_name == PYSAI_TEAM_NAME
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log team object attributes ?

t = Team(name, team_attributes, "TMP")
t.create()
t.delete(force=True)
expect_error("ORA-20053", lambda: t.delete(force=False))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Additional test case for double delete with force=True
It should pass successfully.

tool_params=ToolParams(
credential_name="EMAIL_CRED",
notification_type="EMAIL",
recipient="kondra.nagabhavani@oracle.com",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fetch recipient, sender and smtp_host from ENV variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

OCA Required At least one contributor does not have an approved Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants