Skip to content

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Structural Design Assistant Agent

This repository contains a local AI agent built for civil engineering applications. It uses a local model to evaluate structural safety via a Model Context Protocol (MCP) server.

Agent Design

The system consists of a Python-based MCP server exposing physics calculation tools, and an agent script that uses openai to connect a local Ollama model to the server via standard input/output (stdio).

Tool Selection and Usage

The MCP server (server.py) exposes three distinct tools:

  1. get_material_properties: Fetches Young's Modulus and Yield Strength.
  2. calculate_beam_deflection: Computes physical deflection based on load and beam geometry.
  3. check_safety_factor: Evaluates stress ratios against standard safety limits.

The agent independently determines the correct sequence of tools based on the user's natural language prompt. For example, querying a load on a steel beam triggers the agent to sequence the deflection tool followed by the safety factor tool.

Reliability and Failure Handling

The MCP tools use standard try-except blocks. If an invalid material is requested or a mathematical operation fails, the tools return explicit string error messages (e.g., "Calculation failed: [reason]"). This allows the agent to read the error context and react appropriately rather than crashing the execution pipeline.

API Compatibility

The agent connects to the local Ollama instance using the AsyncOpenAI client pointing to http://localhost:11434/v1. To swap the local model for a stronger OpenAI-compatible API during final evaluation, you only need to change the base_url, api_key, and model parameters in agent.py. No other agent architecture changes are required.

Setup Instructions

  1. Run ollama run qwen2.5 to start the local model.
  2. Install requirements: pip install mcp<2 openai
  3. Execute the agent: python agent.py

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages