Checks
Strands Version
v1.38.0
Python Version
3.13.12
Operating System
macOS Tahoe 26.4
Installation Method
pip
Steps to Reproduce
Use the below snippet to generate latencyMs metric:
from strands import Agent
from strands.models.ollama import OllamaModel
# Create an Ollama model instance
ollama_model = OllamaModel(
host="http://localhost:11434",
model_id="gpt-oss",
)
# Create an agent using the Ollama model
agent = Agent(
model=ollama_model,
)
# Use the agent
result = agent("Tell me about Strands agents in 2 lines")
# Returns latencyMs as a float type
print(result.metrics.get_summary()["accumulated_metrics"])
ollama.py returns float formatted value whereas latencyMs as per Usage class requires value to be int. This raises validation error when used with pydantic for type checking. Error: Input should be a valid integer, got a number with a fractional part [type=int_from_float, input_value=11441.835542, input_type=float]
Expected Behavior
Ollama model provider must return latencyMs as an int (11441)
Actual Behavior
Ollama returns float formatted value 11441.835542
Additional Context
No response
Possible Solution
Convert value to int type in ollama.py
Related Issues
No response
Checks
Strands Version
v1.38.0
Python Version
3.13.12
Operating System
macOS Tahoe 26.4
Installation Method
pip
Steps to Reproduce
Use the below snippet to generate latencyMs metric:
ollama.py returns float formatted value whereas latencyMs as per Usage class requires value to be int. This raises validation error when used with pydantic for type checking. Error: Input should be a valid integer, got a number with a fractional part [type=int_from_float, input_value=11441.835542, input_type=float]
Expected Behavior
Ollama model provider must return latencyMs as an int (11441)
Actual Behavior
Ollama returns float formatted value 11441.835542
Additional Context
No response
Possible Solution
Convert value to int type in ollama.py
Related Issues
No response