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

# Create Trace

> Create a single trace directly via the API.

## Returns

Returns a [Trace](/concepts/product/version/session/trace) object.

## Example

```python theme={"system"}
manual_trace = galtea.traces.create(
    inference_result_id=inference_result_id,
    name="manual_db_call",
    type=TraceType.TOOL,
    start_time="2023-01-01T12:00:00Z",
    end_time="2023-01-01T12:00:01Z",
)
```

## Parameters

<ResponseField name="inference_result_id" type="string" required>
  The ID of the inference result this trace belongs to.
</ResponseField>

<ResponseField name="name" type="string" required>
  The name of the tool or function that was called.
</ResponseField>

<ResponseField name="type" type="string" optional>
  TraceType value: `SPAN`, `GENERATION`, `EVENT`, `AGENT`, `TOOL`, `CHAIN`, `RETRIEVER`, `EVALUATOR`, `EMBEDDING`, `GUARDRAIL`. See [Trace Types](/concepts/product/version/session/trace#trace-types) for details. Other string values are sent to the API unchanged, so values added in newer API versions can be used; the API rejects invalid ones.
</ResponseField>

<ResponseField name="description" type="string" optional>
  Human-readable description of what this operation does. Useful for documentation and debugging. Maximum size: 1MB.
</ResponseField>

<ResponseField name="input_data" type="any" optional>
  The input data passed to the tool/function. Accepts any JSON-serializable value. Maximum size: 10MB.
</ResponseField>

<ResponseField name="output_data" type="any" optional>
  The output data returned by the tool/function. Accepts any JSON-serializable value. Maximum size: 10MB.
</ResponseField>

<ResponseField name="error" type="string" optional>
  Error message if the tool call failed.
</ResponseField>

<ResponseField name="latency_ms" type="float" optional>
  The time in milliseconds the tool call took.
</ResponseField>

<ResponseField name="metadata" type="any" optional>
  Additional metadata about the trace. Accepts any JSON-serializable value. Maximum size: 10MB.
</ResponseField>

<ResponseField name="start_time" type="string" optional>
  ISO 8601 timestamp when the trace started.
</ResponseField>

<ResponseField name="end_time" type="string" optional>
  ISO 8601 timestamp when the trace ended.
</ResponseField>
