Iterative Agent Demo Visualization - See how the iterative agent builds a knowledge graph from natural language experiment descriptions.

Follow https://github.com/LLM4ELN/llm4eln-assessment to set up the project, virtual environment and llm provider (step 1-3).
Make sure to install the additional packages opensemantic.lab and "git+https://github.com/OpenSemanticLab/osw-python", overall
uv add langchain langchain-openai langchain-ollama langchain-anthropic langchain-google-genai langchain-ollama python-dotenv opensemantic.lab "git+https://github.com/OpenSemanticLab/osw-python"
or use
uv sync
Go to https://llm4eln.semos.dev and login via ORCID
Optional: Go to Preferences and set your Real Name (otherwise only your ORCID ID will be shown)
Got to https://llm4eln.semos.dev/wiki/Special:BotPasswords and create a bot password. Grant “edit existing pages”, “create, edit and move pages”, “upload new files”, “upload, replace and move files” and “delete pages, revisions and log entries” permissions.
Create a .env file in the project root based on the .env.example file and fill in your credentials.
# Azure OpenAI
API_PROVIDER=azure
API_KEY=<your-api-key>
API_ENDPOINT=https://your-deplyoment.openai.azure.com/ # example
API_VERSION=2024-10-21 # example
API_MODEL=gpt-5-nano-2025-08-07 # example
OSW_USER=<user-id>@<bot-name>
OSW_PASSWORD=<bot-password>
Construct a LaboratoryProcess entry based on a natural language description.
python demo_basic.py
You should not see any error in the console. A link should be logged that points to the generated entry in the demo instance - open it in your browser to validate the results.
Lookup or suggest a data model based on a natural language description.
python schema_catalog.py
Run an agent that iteratively creates a LaboratoryProcess entry and linked entities (people, organizations, etc.) based on a natural language description.
python demo_iterative_agent.py
define the tool create_linked_entity with the following steps:
range annotation by re-entering (via recursive tool call) at step 1 for each such propertycreate_linked_entity if the request is already stored in the global log in order to prevent endless loops (e.g. if Person -hasOrganization-> Organization -hasMember-> Person)Despite prompt engineering efforts, LLMs still struggle with certain aspects of the task:
deepseek-v3.2 creates keywords like “Keyword for Example Lab” when no keywords are provided in the description.range annotation are of type string in the JSON-SCHEMA representation of OSL schemas, LLMs sometimes try to fill them with textual descriptions instead of looking up / creating the linked entity.deepseek-v3.2 struggle to compare dates in different formats (e.g. “01.01.2025” vs “2025-01-01”) - using the ISO format (JSON-SCHEMA format date) on both sides helps here.The following models were evaluated for the simple iterative approach:
| Provider | Model | Result |
|---|---|---|
| azure | gpt-5-nano-2025-08-07 | ✅ Basic works, interactive works |
| azure | gpt-5-mini-2025-08-07 | ✅ Basic works, interactive works |
| azure-foundry-anthropic | claude-sonnet-4-5 | ✅ Basic works, interactive works |
| azure-foundry-anthropic | claude-haiku-4-5 | ✅ Basic works, interactive works |
| azure-foundry | deepseek-v3.2-speciale | ❌ Error: too many requests |
| azure-foundry | deepseek-v3.2 | ⚠️ Basic works, iterative not: cannot compare ISO dates correctly (works with structured data compare) |
| azure-foundry | cohere-command-a | ⚠️ Basic works, iterative not: cannot compare ISO dates correctly |
| azure-foundry | deepseek-r1-0528 | ⚠️ Basic works, iterative partially, struggles with tool calling |
| azure-foundry | mistral-large-3 | ❌ Error: invalid input |
| azure-foundry | llama-3.3-70b-instruct | ⚠️ Basic works, interactive not: model doesn’t support more than one tool call |
| azure-foundry | llama-4-maverick-17b-128e-instruct-fp8 | ⚠️ Basic works, interactive not: states entities are equal when they are not |
| azure-foundry | gpt-oss-120b | ❌ Error: tool_choice ‘required’ not supported |
| azure-foundry | kimi-k2-thinking | ✅ Basic works, interactive works |
| azure-foundry | phi-4-reasoning | ❌ Error: JSON schema contains unsupported xgrammar features |
| vllm | microsoft/Phi-4-reasoning | ⚠️ Basic works, interactive not: model refuses tool calling |
| vllm | microsoft/Phi-4-mini-instruct | ⚠️ Basic works, interactive not: model refuses tool calling |
| vllm | microsoft/Phi-4-mini-reasoning | ⚠️ Basic works, interactive not: model refuses tool calling |
range annotation as strings containing the descriptions of the linked entitiesrange annotation re-enter at step 1 with the description provided in step 4 to lookup / create the linked entity and the annotations of the corresponding property. Replace the textual description with the found / created entity ID.