How yuyangsunshine/bioproagent works
Purpose and entry points
BioProAgent is an API-first, neuro-symbolic agent for constrained biological protocol planning. It couples LLM reasoning with a deterministic Design–Verify–Rectify FSM to produce automation-aligned machine instructions safely.
• Interactive CLI: main.py
• Reusable/evaluation runtime and ProAgent: main_evaluate.py
• Runtime settings and model credentials: config/settings.py, data/keys.env
Agent runtime and session boundary
ProAgent owns the request lifecycle: create/update session state, receive a scientific query, invoke planned tools, retain working/episodic artifacts, and return a response. Session state supports symbolic references such as drafts and retrieved knowledge instead of repeatedly embedding large payloads.
• main_evaluate.py
• src/tools/tool_definitions.py
• src/tools/tool_descriptions.json
Deterministic planner/FSM
The planner transfer matrix is the central control boundary around probabilistic LLM output. It infers the current FSM state and produces an allowed tool plan, enforcing ordered Design, Verify, and Rectify transitions rather than unconstrained agent actions.
• src/core/planner_transfer_matrix.py
• src/prompts/planner.py
• src/prompts/prompts.py
LLM and memory integration
LLM calls are external API-backed rather than local checkpoints. The LLM layer initializes configured model roles (fast, general, quality, long-context) and the long-memory backend interface. Model endpoint names, keys, and URLs come from environment-backed settings.
• src/core/llms.py
• config/settings.py
• data/keys.env.example
Design-stage capabilities
Design tools clarify experimental scope, retrieve relevant knowledge, produce a scientific draft, and reflect or modify it. Retrieval is an explicitly replaceable public shell, allowing private lab knowledge connectors or embedding endpoints without changing the FSM-facing tool contract.
• src/capabilities/retrieval/knowledge_sources.py
• src/baselines/base_agent.py
• src/baselines/react_agent.py
Automation grounding and registries
Automation modules transform a validated scientific draft into parameterized machine code. Registry abstractions resolve instruments and consumables from canonical data, forming the symbolic grounding boundary between natural-language plans and lab-specific resources.
• src/capabilities/automation/parameter_builder.py
• src/capabilities/automation/parameter_filler.py
• src/capabilities/registry/device_registry.py
• data/registry/instruments_en.json
• data/registry/consumables_en.json
Verification and repair loop
Verification separates scientific review from physical/code checks. Failed reviews return control to draft or code repair; only passing machine-code validation completes the execution-oriented planning flow. The public physical-rule implementation is intentionally a replaceable shell.
• src/capabilities/verification/engine.py
• src/capabilities/automation/parameter_processing.py
• src/tools/tool_definitions.py
Benchmark evaluation
Public evaluation drives the same ProAgent loop over four BioProBench-derived subsets. Profiles configure thresholds, sample limits, simulator/scientific-evaluation flags, and result behavior; benchmark JSON files supply task instances.
• config/evaluation_profiles.json
• tests/eval_config.py
• data/benchmarks/ProAgent-SubsetA.json
• data/benchmarks/ProAgent-SubsetB.json
Main entry points: tool_definitions.py Tool contract · main_evaluate.py ProAgent runtime · planner_transfer_matrix.py Planner transfer matrix · eval_config.py Evaluation runner
Components 21
Runtime
- Interactive CLI
main.py - ProAgent runtime · Owns sessions, artifacts, tool calls, and responses.
main_evaluate.py - Tool contract
src/tools/tool_definitions.py - Tool descriptions
src/tools/tool_descriptions.json - LLM and memory layer · Initializes API-backed model roles and long-memory backend.
src/core/llms.py
Planning Control
- Planner transfer matrix · Constrains LLM output to ordered Design, Verify, and Rectify tool plans.
src/core/planner_transfer_matrix.py - Planner prompts
src/prompts/planner.py
Protocol Capabilities
- Knowledge retrieval shell · Supports private knowledge connectors without changing tool contracts.
src/capabilities/retrieval/knowledge_sources.py - Design baselines · Provide scientific drafting, reflection, and modification patterns.
src/baselines/base_agent.py - Parameter builder · Transforms validated scientific drafts into parameterized machine code.
src/capabilities/automation/parameter_builder.py - Parameter filler
src/capabilities/automation/parameter_filler.py - Device registry · Grounds plans against canonical instrument and consumable data.
src/capabilities/registry/device_registry.py - Verification engine · Separates scientific review from physical and machine-code checks.
src/capabilities/verification/engine.py - Physical-rule shell
src/capabilities/automation/parameter_processing.py
External Resources
- Runtime settings · Environment-backed model roles, endpoints, and credentials.
config/settings.py - Instrument catalog
data/registry/instruments_en.json - Consumable catalog
data/registry/consumables_en.json
Benchmark Evaluation
- Evaluation profiles
config/evaluation_profiles.json - Evaluation runner · Runs the same ProAgent loop with subset-specific thresholds and flags.
tests/eval_config.py - BioProBench Subset A
data/benchmarks/ProAgent-SubsetA.json - BioProBench Subset B
data/benchmarks/ProAgent-SubsetB.json
Connections 21
- Interactive CLI → ProAgent runtime: starts session
- ProAgent runtime → Planner transfer matrix: requests allowed plan
- ProAgent runtime → Tool contract: invokes tools
- Tool descriptions → Tool contract: documents
- Planner prompts → Planner transfer matrix: guides inference
- Planner transfer matrix → LLM and memory layer: uses constrained reasoning
- Runtime settings → LLM and memory layer: configures
- Tool contract → Knowledge retrieval shell: design retrieval
- Tool contract → Design baselines: draft and reflect
- Tool contract → Parameter builder: compile validated draft
- Parameter builder → Parameter filler: fill machine parameters
- Parameter filler → Device registry: resolve resources
- Instrument catalog → Device registry: canonical instruments
- Consumable catalog → Device registry: canonical consumables
- Tool contract → Verification engine: review and validate
- Verification engine → Physical-rule shell: physical/code checks
- Verification engine → Planner transfer matrix: failure triggers rectify
- Evaluation runner → ProAgent runtime: drives agent loop
- Evaluation profiles → Evaluation runner: configures
- BioProBench Subset A → Evaluation runner: task instances
- BioProBench Subset B → Evaluation runner: task instances