Skip to main content

C3 – Python Execution

Back to index | ← C – Agents | ← C2 – APV Integrity Check


Session: 2026-04-30 · 12:23–14:39
Use Case: Detect elements with empty Notes on the current diagram — same as C1, but via Python execution instead of built-in EA tools.
Question: Does Kernaro invoke execute_python, or does it always fall back to built-in EA tools?


Attempt 1 – Basic Python Role + Prompt

Role:

You are an Enterprise Architect modeling assistant with access to the EA repository via Python scripting.
Your task is to analyze the currently open diagram and find all elements where the Notes field is empty or contains only whitespace.
Rules:
- Work only with elements visible on the current diagram
- Use EA Python API (ea_tools) available in Kernaro
- Return results as a structured list: Element Name | Element Type | GUID
- Do not modify any elements

Result: Kernaro called Get Diagram By Guid (built-in EA tool) and analyzed data via LLM text — execute_python was never invoked.

Finding: The output looked like a clean AI text report, not raw Python stdout. Built-in EA tools returned correct data; LLM composed the report.


Attempt 2 – CRITICAL RULES (Force execute_python)

Role rewritten with explicit bans:

You are an Enterprise Architect Python automation expert.
CRITICAL RULES - NO EXCEPTIONS:
- You MUST use execute_python tool to run actual Python code
- You MUST NOT use Get Diagram, Get Element, or any other EA built-in tools
- You MUST NOT analyze data from memory or previous context
- If execute_python tool is not available, report error and stop

Script template in prompt used win32com.client.GetActiveObject("EA.App") as the correct entry point for Python→EA COM automation on Windows.

Python configuration: Python 3.12.10 ✅ installed and verified in Kernaro settings.
Result: Agent still called Get Diagram By Guid. CRITICAL RULES were ignored.

Finding: LLM chose built-in EA tools even when the prompt explicitly prohibited them. When built-in tools are available and sufficient, the LLM prefers them regardless of prompt constraints.


Attempt 3 – Agent 04 on EA_OnPostCloseDiagram

Agent: 04-ElementsOnCurrentDiagramwithEmptyNotes
Trigger: EA_OnPostCloseDiagram

Test run 1 – Coffee Machine Activity diagram

Diagram: Coffee Machine - Activity (ID: 3)
Total elements: 8
Empty Notes: 0

✅ All elements documented. No action required.

Element NameTypeNotes Status
StartAction✅ Populated
Power OnAction✅ Populated
Heat WaterAction✅ Populated
Select DrinkAction✅ Populated
BrewAction✅ Populated
Dispense CoffeeAction✅ Populated
Power OffAction✅ Populated
EndAction✅ Populated

Test run 2 – Starter Use Case Model

Diagram: Starter Use Case Model (ID: 1)
Total elements: 8
Empty Notes: 3

Element NameTypeElement ID
CustomerActor404
Customer1Actor405
Customer2Actor406

Note: Customer1 and Customer2 appear to be duplicate or test elements. Coffee Machine (Boundary) had only a placeholder [Description of the System] — flagged in earlier runs as pseudo-empty.

Finding: Correct results on both diagrams. Still via built-in tools, not Python execution.


Side Effect 1 – Event Collision on EA_OnPostCloseDiagram

Each new agent in this session targeted the same trigger: EA_OnPostCloseDiagram.

Problem: Kernaro does not allow multiple agents to share one event directly.

Resolution applied:

  1. Priority escalated incrementally → reached 4 (lowest available)
  2. Previous agents set to inactive

Observation: Priority + inactive flag is the workaround — not native multi-agent event support.


Side Effect 2 – Parallel Agent Execution (Observed Once)

At one point during the session, two agents ran simultaneously on the same EA_OnPostCloseDiagram trigger — with different execution durations visible in the Agent Executions log.

This occurred before the inactive flag was applied to the previous agent.

⚠ Input/output details were captured but not fully analyzed. The behavior suggests Kernaro may allow brief parallel execution during the transition period between agent configurations.


Observations

#ObservationClassification
1Python 3.12 configured ✅, but execute_python never invoked — LLM chose built-in EA tools in all 3 attemptsCuriosity, not a bug
2Built-in EA tools returned correct results — the outcome was functionally equivalentExpected behavior
3Prompt constraints (MUST NOT use...) did not override LLM tool preference when built-ins were availableLLM behavior characteristic
4One EA_OnPostCloseDiagram event = one active agent at a timePlatform constraint
5Brief parallel execution observed during agent transitionUnanalyzed — needs screenshot review

Back to index | ← C – Agents | ← C2 – APV Integrity Check


Images

[IMG-01]

img/02-PYTHON.png

[IMG-02]

img/03-PYTHON.png

[IMG-03]

img/04-PYTHON.png

[IMG-04]

img/04-javascripts.png

[IMG-05]

img/05-PYTHON.png

[IMG-06]

img/06-PYTHON.png

[IMG-07]

img/07-PYTHON.png

[IMG-08]

img/08-PYTHON.png

[IMG-09]

img/09-PYTHON.png

[IMG-10]

img/10-PYTHON.png

[IMG-11]

img/11-PYTHON.png

[IMG-12]

img/12-PYTHON.png

[IMG-13]

img/13-PYTHON.png

[IMG-14]

img/14-PYTHON.png

[IMG-15]

img/15-PYTHON.png

[IMG-16]

img/16-PYTHON.png

[IMG-17]

img/17-PYTHON.png

[IMG-18]

img/18-PYTHON.png

[IMG-19]

img/19-PYTHON.png

[IMG-20]

img/20-PYTHON.png

[IMG-21]

img/21-PYTHON.png

[IMG-22]

img/22-PYTHON.png

[IMG-23]

img/23-PYTHON.png

[IMG-24]

img/24-PYTHON.png

[IMG-25]

img/25-PYTHON.png

[IMG-26]

img/26-PYTHON.png

[IMG-27]

img/27-PYTHON.png

[IMG-28]

img/28-PYTHON.png

[IMG-29]

img/29-PYTHON.png

[IMG-30]

img/30-PYTHON.png

[IMG-31]

img/31-PYTHON.png

[IMG-32]

img/32-PYTHON.png

[IMG-33]

img/33-PYTHON.png

[IMG-34]

img/34-PYTHON.png

[IMG-35]

img/35-PYTHON.png

[IMG-36]

img/36-PYTHON.png

[IMG-37]

img/37-PYTHON.png

[IMG-38]

img/38-PYTHON.png

[IMG-39]

img/39-PYTHON.png

[IMG-40]

img/40-PYTHON.png

[IMG-41]

img/41-PYTHON.png

[IMG-42]

img/42-PYTHON.png