# GraphExecutionContext

> **Class** in `langchain_google_community`

📖 [View in docs](https://reference.langchain.com/python/langchain-google-community/callbacks/bigquery_callback/GraphExecutionContext)

Context manager for wrapping graph execution with GRAPH_START/GRAPH_END events.

## Signature

```python
GraphExecutionContext(
    self,
    handler: BigQueryCallbackHandler,
    graph_name: str,
    metadata: Optional[Dict[str, Any]] = None,
)
```

## Description

**Usage:**

with handler.graph_context("my_graph") as ctx:
# Graph execution happens here
result = graph.invoke(inputs)

This will emit GRAPH_START when entering and GRAPH_END when exiting.
If an exception occurs, GRAPH_ERROR will be emitted instead of GRAPH_END.

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `handler` | `BigQueryCallbackHandler` | Yes | The BigQueryCallbackHandler instance. |
| `graph_name` | `str` | Yes | Name of the graph being executed. |
| `metadata` | `Optional[Dict[str, Any]]` | No | Optional metadata to include in events. (default: `None`) |

## Constructors

```python
__init__(
    self,
    handler: BigQueryCallbackHandler,
    graph_name: str,
    metadata: Optional[Dict[str, Any]] = None,
) -> None
```

| Name | Type |
|------|------|
| `handler` | `BigQueryCallbackHandler` |
| `graph_name` | `str` |
| `metadata` | `Optional[Dict[str, Any]]` |


## Properties

- `handler`
- `graph_name`
- `metadata`
- `run_id`

---

[View source on GitHub](https://github.com/langchain-ai/langchain-google/blob/a3f016b2a6c4af535df275545f76fa7424aa39e5/libs/community/langchain_google_community/callbacks/bigquery_callback.py#L3431)