API reference¶
The public surface (sweep_agent.__all__): the agent loop, the LLM backend
interface, and the tool registry. Auto-generated from source docstrings.
Agent¶
sweep_agent.Agent ¶
Agent(llm: BaseLLM, tools: Registry = <factory>, system_prompt: str = <factory>, max_steps: int = 12, history: list[ChatMessage] = <factory>, tool_selector: Callable[[str, list[str]], list[str]] | None = None, _used_tools: set[str] = <factory>, history_char_budget: int = 56000, last_tool_specs: list[dict] | None = None)
Agent(llm: 'BaseLLM', tools: 'Registry' =
history_char_budget
class-attribute
¶
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
max_steps
class-attribute
¶
int([x]) -> integer int(x, base=10) -> integer
Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.int(). For floating point numbers, this truncates towards zero.
If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by '+' or '-' and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal.
int('0b100', base=0) 4
chat ¶
Run one user→assistant turn (executing any intermediate tool calls).
iter_chat ¶
Stream each step (tool call + result, or final reply) of one turn.
LLM backend¶
Subclass this to point the agent at any endpoint.
sweep_agent.BaseLLM ¶
Bases: abc.ABC
Minimal protocol every backend must implement.
chat ¶
chat(
messages: list[ChatMessage],
tools: Iterable[dict[str, Any]] | None = None,
*,
temperature: float = 0.2,
max_tokens: int | None = None,
**kwargs: Any
) -> ChatMessage
Send one round; return the assistant message (may include tool calls).
Tools¶
Every registered tool is a Tool; call it directly via .fn(params) (no LLM):
from sweep_agent.tools.inspect import inspect_file, InspectFileParams
inspect_file.fn(InspectFileParams(path="vp_init.npy"))
sweep_agent.Tool ¶
Tool(name: 'str', description: 'str', params_model: 'Type[BaseModel]', fn: 'Callable[[BaseModel], Any]')