Skip to main content

MinimalAgent

A lightweight agent framework for building agentic applications with Amazon Bedrock.

Installation

pip install minimalagent

Quick Start

from minimalagent import Agent, tool

@tool
def get_weather(location: str):
    """Get weather for a location.

    Args:
        location: City name to get weather for

    Returns:
        Weather data dictionary
    """
    # Your implementation here
    return {"temperature": 22, "condition": "sunny"}

# Create agent
agent = Agent(tools=[get_weather])

# Run a query
response, reasoning = agent.run("What's the weather in San Francisco?")
print(response)

Key Features

  • Simple API: Intuitive design with minimal boilerplate
  • Tool-first approach: Easy tool creation with docstring parsing
  • Built-in session memory: Persistent conversations via DynamoDB
  • Step-by-step reasoning: Visibility into the agent's thought process

MinimalAgent is essentially a wrapper over the Bedrock Covnerse API (with optional session management using DDB), making it a simple framework for quickly bootstrapping AWS-native agents. It currently lacks integration with observability tools like Langfuse, so for large-scale production deployments I encourage you to use another framework.

Core Concepts

Tools

Tools give your agent capabilities. Simply decorate functions with @tool:

@tool
def search_database(query: str, limit: int = 10) -> list:
    """Search the database for records matching the query."""
    # Your implementation here
    return [{"id": 1, "name": query}]

Session Management

Enable persistent conversations across multiple interactions:

# Create an agent with session support
agent = Agent(use_session_memory=True)

# Use a consistent session ID for the same conversation
response1 = agent.run("Find information about electric cars", session_id="user123")
response2 = agent.run("What about hybrid models?", session_id="user123")  # Remembers context

Reasoning Display

Control the visibility of the agent's thinking process:

# Colorized reasoning in the terminal is enabled by default
agent = Agent(tools=[get_weather])  # show_reasoning=True is the default

# Explicitly enable reasoning display
agent_with_display = Agent(
    tools=[get_weather],
    show_reasoning=True
)

# Hide reasoning output for production use
agent_without_display = Agent(
    tools=[get_weather],
    show_reasoning=False,
    log_level="WARNING"  # Only log warnings and errors
)

Reasoning Process

Access the agent's step-by-step thinking programmatically:

response, reasoning = agent.run("Calculate 25 * 4 + 10")

# Access reasoning data
print(f"Query: {reasoning.query}")
print(f"Steps: {reasoning.total_steps}")
for step in reasoning.steps:
    print(f"Step {step.step_number} thinking: {step.thinking}")

Documentation

For more detailed documentation, visit https://niklas-palm.github.io/minimalagent/

AWS Setup

MinimalAgent requires AWS credentials for accessing Amazon Bedrock and DynamoDB.

  1. Install and configure the AWS CLI:
    aws configure
    

Option 2: Environment Variables

export AWS_ACCESS_KEY_ID=your_access_key_id
export AWS_SECRET_ACCESS_KEY=your_secret_access_key
export AWS_REGION=us-west-2

License

MIT

Metadata

Release files for minimalagent 0.2.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for minimalagent 0.2.7
File Size Uploaded
minimalagent-0.2.7.tar.gz 36.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for minimalagent 0.2.7
File Interpreter ABI Platform
minimalagent-0.2.7-py3-none-any.whl Python 3 none any Details

Total release size: 61.4 kB

Release files / minimalagent-0.2.7.tar.gz

Download URL minimalagent-0.2.7.tar.gz
Size 36.5 kB
Tags Source
SHA-256 checksum
How to use checksums
90b2c3901c58f577db4f4fd170d6e4136ba57b1c08c5dfd99082d284c89332a2
BLAKE2b-256 checksum
How to use checksums
94a0a328ca1f094475b73ba2e0053528371e2c809e4048ddba94298d7efe8f29
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release files / minimalagent-0.2.7-py3-none-any.whl

Download URL minimalagent-0.2.7-py3-none-any.whl
Size 25.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e603e22b8cf37e88f67ff2733d2a167e77eed2c5a257113706b32015a159170
BLAKE2b-256 checksum
How to use checksums
644d7af35b59cbe7d6f843e446792dd65813f5ea9ca8c5531e3df3eebce05a84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.2.7 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page