monte-carlo-data/mc-agent-toolkit / skills/instrument-agent
monte-carlo-instrument-agent
FlaggedInstrument a new AI agent in a Python codebase for Monte Carlo Agent Observability. Detects AI libraries, installs the Monte Carlo OpenTelemetry SDK, and proposes tracing setup and decorator placements as diffs. Asks before editing any file.
tests/fixtures/sample_agent/agent.py
View on GitHub"""Minimal LangGraph-shaped agent for instrument-agent smoke testing.
Long-running container shape — no Lambda handler, no serverless framework.
Used by test_detect_libraries.py to validate that detect_libraries.py
classifies a realistic agent codebase correctly.
"""
from typing import TypedDict
from langchain.chat_models import ChatOpenAI
from langgraph.graph import StateGraph
class AgentState(TypedDict):
messages: list[dict]
iterations: int
def call_model(state: AgentState) -> AgentState:
model = ChatOpenAI(model="gpt-4o-mini")
response = model.invoke(state["messages"])
state["messages"].append({"role": "assistant", "content": response.content})
state["iterations"] += 1
return state
def should_continue(state: AgentState) -> str:
return "END" if state["iterations"] >= 3 else "CONTINUE"
def build_graph() -> StateGraph:
graph = StateGraph(AgentState)
graph.add_node("call_model", call_model)
graph.set_entry_point("call_model")
graph.add_conditional_edges(
"call_model", should_continue, {"CONTINUE": "call_model", "END": "__end__"}
)
return graph.compile()
def run_agent(prompt: str) -> str:
graph = build_graph()
result = graph.invoke({"messages": [{"role": "user", "content": prompt}], "iterations": 0})
return result["messages"][-1]["content"]
if __name__ == "__main__":
print(run_agent("Hello, agent."))
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis. | Stars: 471k | Updated | Claude CodeCodex | Verified | Install |
| diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness. | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |