rendering
PlantUML Lua API for KosmoKrator Agents
Agent-facing Lua documentation and function reference for the PlantUML KosmoKrator integration.Lua Namespace
Agents call this integration through app.integrations.plantuml.*.
Use lua_read_doc("integrations.plantuml") inside KosmoKrator to discover the same reference at runtime.
Call Lua from the Headless CLI
Use kosmo integrations:lua when a shell script, CI job, cron job, or another coding CLI should run a deterministic
PlantUML workflow without starting an interactive agent session.
kosmo integrations:lua --eval 'dump(app.integrations.plantuml.render({syntax = "example_syntax", title = "example_title"}))' --json kosmo integrations:lua --eval 'print(docs.read("plantuml"))' --json
kosmo integrations:lua --eval 'print(docs.read("plantuml.render"))' --json Workflow file
Put repeatable logic in a Lua file, then execute it with JSON output for the calling process.
local plantuml = app.integrations.plantuml
local result = plantuml.render({syntax = "example_syntax", title = "example_title"})
dump(result) kosmo integrations:lua workflow.lua --json
kosmo integrations:lua workflow.lua --force --json integrations:lua exposes app.integrations.plantuml, app.mcp.*, docs.*, json.*, and regex.*. Use app.integrations.plantuml.default.* or app.integrations.plantuml.work.* when you configured named credential accounts.
MCP-only Lua
If the script only needs configured MCP servers and does not need PlantUML, use the narrower mcp:lua command.
# Use mcp:lua for MCP-only scripts; use integrations:lua for this integration namespace.
kosmo mcp:lua --eval 'dump(mcp.servers())' --json Agent-Facing Lua Docs
This is the rendered version of the full Lua documentation exposed to agents when they inspect the integration namespace.
PlantUML — Lua API Reference
render_plantuml
Render PlantUML diagram syntax (class, sequence, activity, component, state, use case, and more) to a PNG image.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
syntax | string | yes | PlantUML diagram syntax. Should be wrapped in @startuml/@enduml (auto-wrapped if missing). |
title | string | no | Diagram title used as alt text (default: "Diagram"). |
Examples
Render a class diagram
local result = app.integrations.plantuml.render_plantuml({
syntax = "@startuml\nclass Animal {\n +name: string\n +speak(): void\n}\nclass Dog extends Animal {\n +fetch(): void\n}\n@enduml",
title = "Class Diagram"
})
Render a sequence diagram
local result = app.integrations.plantuml.render_plantuml({
syntax = "@startuml\nAlice -> Bob: Hello\nBob --> Alice: Hi there!\n@enduml",
title = "Sequence Diagram"
})
Render a component diagram
local result = app.integrations.plantuml.render_plantuml({
syntax = "@startuml\n[Web App] --> [API Gateway]\n[API Gateway] --> [Auth Service]\n[API Gateway] --> [Database]\n@enduml",
title = "Architecture"
})Raw agent markdown
# PlantUML — Lua API Reference
## render_plantuml
Render PlantUML diagram syntax (class, sequence, activity, component, state, use case, and more) to a PNG image.
### Parameters
| Name | Type | Required | Description |
|------|------|----------|-------------|
| `syntax` | string | yes | PlantUML diagram syntax. Should be wrapped in `@startuml`/`@enduml` (auto-wrapped if missing). |
| `title` | string | no | Diagram title used as alt text (default: `"Diagram"`). |
### Examples
#### Render a class diagram
```lua
local result = app.integrations.plantuml.render_plantuml({
syntax = "@startuml\nclass Animal {\n +name: string\n +speak(): void\n}\nclass Dog extends Animal {\n +fetch(): void\n}\n@enduml",
title = "Class Diagram"
})
```
#### Render a sequence diagram
```lua
local result = app.integrations.plantuml.render_plantuml({
syntax = "@startuml\nAlice -> Bob: Hello\nBob --> Alice: Hi there!\n@enduml",
title = "Sequence Diagram"
})
```
#### Render a component diagram
```lua
local result = app.integrations.plantuml.render_plantuml({
syntax = "@startuml\n[Web App] --> [API Gateway]\n[API Gateway] --> [Auth Service]\n[API Gateway] --> [Database]\n@enduml",
title = "Architecture"
})
``` local result = app.integrations.plantuml.render({syntax = "example_syntax", title = "example_title"})
print(result) Functions
render Write
Render a PlantUML diagram to a PNG image. Pass valid PlantUML syntax and get back a markdown image embed. Supported diagram types: class, sequence, activity, component, state, use case, object, deployment, timing, network (nwdiag), wireframe (salt), Gantt, mindmap, WBS, JSON, YAML, ERD. Example syntax: ``` @startuml Alice -> Bob: Authentication Request Bob --> Alice: Authentication Response Alice -> Bob: Another request Bob --> Alice: Another response @enduml ``` Tips: - Always wrap syntax in @startuml / @enduml - Use `->` for solid arrows, `-->` for dashed arrows - Use `class ClassName { }` blocks for class diagrams - Use `(*) -->` for activity diagram start - Use `[Component]` for component diagrams - Use `state "Name" as s1` for state diagrams
- Lua path
app.integrations.plantuml.render- Full name
plantuml.render_plantuml
| Parameter | Type | Required | Description |
|---|---|---|---|
syntax | string | yes | PlantUML diagram syntax. Should be wrapped in @startuml/@enduml (auto-wrapped if missing). |
title | string | no | Diagram title used as alt text (default: "Diagram"). |