This document is for developers of sre-agent, specifically for v0.2.0.
Run the CLI once and complete the configuration wizard to create the user .env file in the platform config directory.
Start the agent server and the Slack MCP server:
docker compose up -dTrigger an error on the store by adding loaf to the cart, or change the currency from EUR to GBP. (Note, there is an bug that errors might take some time to be indexed so if you trigger the agent immediately after you cause an error it might not be able to find the log.)
Trigger the locally running agent:
uv run python run.py /aws/containerinsights/no-loafers-for-you/application cartserviceOr:
uv run python run.py /aws/containerinsights/no-loafers-for-you/application currencyserviceWhen adding a new tool/integration, follow one of these patterns:
If an MCP server exists for the service, you can use that. No interface implementation is needed.
# tools/example.py
from pydantic_ai.mcp import MCPServerStdio
from sre_agent.core.settings import AgentSettings
def create_example_mcp_toolset(config: AgentSettings) -> MCPServerStdio:
return MCPServerStdio(
"docker",
args=["run", "-i", "--rm", "-e", f"TOKEN={config.example.token}", "mcp/example"],
timeout=30,
)Examples: github.py, slack.py
Use this when no MCP server is available. You must implement the relevant interface.
# tools/example.py
from sre_agent.interfaces import LoggingInterface
from sre_agent.models import LogQueryResult
class ExampleLogging(LoggingInterface):
async def query_errors(
self,
source: str,
service_name: str,
time_range_minutes: int = 10,
) -> LogQueryResult:
# Implementation using direct API calls
...
def create_example_toolset(config: AgentSettings) -> FunctionToolset:
toolset = FunctionToolset()
impl = ExampleLogging(config.example.api_key)
@toolset.tool
async def search_logs(...) -> LogQueryResult:
return await impl.query_errors(...)
return toolsetExamples: cloudwatch.py