> ## Documentation Index
> Fetch the complete documentation index at: https://opensre.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Investigation tool calling

> Contributor guide for investigation ReAct tool schemas, LLM invoke payloads, and message shapes

<Info>
  This page is a **contributor reference** for how OpenSRE shapes tool-calling during investigations. End users do not need to configure any of this — see [How an investigation works](/docs/how-investigations-work) and [Investigations overview](/docs/investigation-overview) instead.
</Info>

The investigation agent does **not** call integration APIs through the LLM directly. The flow is:

1. **Tools** — `get_registered_tools("investigation")`, filtered with `tool.is_available(...)`.
2. **Schemas** — `llm.tool_schemas(tools)` from the active provider client.
3. **Invoke** — `llm.invoke(messages, system=..., tools=tool_schemas)`; the model returns tool calls.
4. **Execute** — Tools run locally; results append as turns for the next invoke.
5. **Seed path** — `_build_seed_calls` may inject deterministic tool runs before the loop.

## Where code lives

| Concern            | Location                                                                                                                             |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
| Provider routing   | `core/llm/factory.py`, `core/llm/client_builders.py`                                                                                 |
| Investigation loop | `tools/investigation/stages/gather_evidence/agent.py`                                                                                |
| Tool registry      | `tools/` and `integrations/<vendor>/tools/`                                                                                          |
| Pipeline stages    | [Investigation pipeline architecture](https://github.com/Tracer-Cloud/opensre/blob/main/docs/investigation-pipeline-architecture.md) |

## Full reference

The complete schema normalization rules, provider-specific adapters, and message-shape tables live in the repository source file:

[docs/investigation-tool-calling.md](https://github.com/Tracer-Cloud/opensre/blob/main/docs/investigation-tool-calling.md)

When changing investigation tools or LLM adapters, read that file and run the registry contract tests described in [adding tools and integrations](https://github.com/Tracer-Cloud/opensre/blob/main/docs/adding-tools-and-integrations.md).
